CroppingWindowCapturer::CreateCapturer() function to replace raw pointer version
The old CroppingWindowCapturer::Create() function returns a raw pointer, which cannot explain the ownership. So this change adds a CreateCapturer() function to return a unique_ptr. BUG=webrtc:6513 Review-Url: https://codereview.webrtc.org/2496993003 Cr-Commit-Position: refs/heads/master@{#15045}
This commit is contained in:
@ -106,6 +106,12 @@ DesktopCapturer* CroppingWindowCapturer::Create(
|
||||
const DesktopCaptureOptions& options) {
|
||||
return DesktopCapturer::CreateWindowCapturer(options).release();
|
||||
}
|
||||
|
||||
// static
|
||||
std::unique_ptr<DesktopCapturer> CroppingWindowCapturer::CreateCapturer(
|
||||
const DesktopCaptureOptions& options) {
|
||||
return DesktopCapturer::CreateWindowCapturer(options);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -24,7 +24,11 @@ namespace webrtc {
|
||||
class CroppingWindowCapturer : public DesktopCapturer,
|
||||
public DesktopCapturer::Callback {
|
||||
public:
|
||||
// Deprecated, use CreateCapturer()
|
||||
static DesktopCapturer* Create(const DesktopCaptureOptions& options);
|
||||
static std::unique_ptr<DesktopCapturer> CreateCapturer(
|
||||
const DesktopCaptureOptions& options);
|
||||
|
||||
~CroppingWindowCapturer() override;
|
||||
|
||||
// DesktopCapturer implementation.
|
||||
|
||||
@ -215,4 +215,11 @@ DesktopCapturer* CroppingWindowCapturer::Create(
|
||||
return new CroppingWindowCapturerWin(options);
|
||||
}
|
||||
|
||||
// static
|
||||
std::unique_ptr<DesktopCapturer> CroppingWindowCapturer::CreateCapturer(
|
||||
const DesktopCaptureOptions& options) {
|
||||
return std::unique_ptr<DesktopCapturer>(
|
||||
new CroppingWindowCapturerWin(options));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user