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:
zijiehe
2016-11-11 15:13:32 -08:00
committed by Commit bot
parent b7510d3f49
commit c9a6e4a67e
3 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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.

View File

@ -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