Use std::unique_ptr<> to pass frame ownership in DesktopCapturer impls.

Previously raw pointers were used for owned DesktopFrame instances.
Updated all screen and window capturer implementations to use
std::unique_ptr<>.

Also includes some other cleanups in the capturers:
 - s/NULL/nullptr
 - moved default initializers to class definition.

BUG=webrtc:5950

Review-Url: https://codereview.webrtc.org/1988783003
Cr-Commit-Position: refs/heads/master@{#13058}
diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc
index 815c7f5..47e7219 100644
--- a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc
+++ b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc
@@ -32,11 +32,13 @@
 class ScreenCapturerMacTest : public testing::Test {
  public:
   // Verifies that the whole screen is initially dirty.
-  void CaptureDoneCallback1(DesktopFrame* frame);
+  void CaptureDoneCallback1(DesktopCapturer::Result result,
+                            std::unique_ptr<DesktopFrame>* frame);
 
   // Verifies that a rectangle explicitly marked as dirty is propagated
   // correctly.
-  void CaptureDoneCallback2(DesktopFrame* frame);
+  void CaptureDoneCallback2(DesktopCapturer::Result result,
+                            std::unique_ptr<DesktopFrame>* frame);
 
  protected:
   void SetUp() override {
@@ -49,37 +51,40 @@
 };
 
 void ScreenCapturerMacTest::CaptureDoneCallback1(
-    DesktopFrame* frame) {
-  std::unique_ptr<DesktopFrame> owned_frame(frame);
+    DesktopCapturer::Result result,
+    std::unique_ptr<DesktopFrame>* frame) {
+  EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS);
 
   MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
       MacDesktopConfiguration::BottomLeftOrigin);
 
   // Verify that the region contains full frame.
-  DesktopRegion::Iterator it(frame->updated_region());
+  DesktopRegion::Iterator it((*frame)->updated_region());
   EXPECT_TRUE(!it.IsAtEnd() && it.rect().equals(config.pixel_bounds));
 }
 
 void ScreenCapturerMacTest::CaptureDoneCallback2(
-    DesktopFrame* frame) {
-  std::unique_ptr<DesktopFrame> owned_frame(frame);
+    DesktopCapturer::Result result,
+    std::unique_ptr<DesktopFrame>* frame) {
+  EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS);
 
   MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
       MacDesktopConfiguration::BottomLeftOrigin);
   int width = config.pixel_bounds.width();
   int height = config.pixel_bounds.height();
 
-  EXPECT_EQ(width, frame->size().width());
-  EXPECT_EQ(height, frame->size().height());
-  EXPECT_TRUE(frame->data() != NULL);
+  EXPECT_EQ(width, (*frame)->size().width());
+  EXPECT_EQ(height, (*frame)->size().height());
+  EXPECT_TRUE((*frame)->data() != NULL);
   // Depending on the capture method, the screen may be flipped or not, so
   // the stride may be positive or negative.
   EXPECT_EQ(static_cast<int>(sizeof(uint32_t) * width),
-            abs(frame->stride()));
+            abs((*frame)->stride()));
 }
 
 TEST_F(ScreenCapturerMacTest, Capture) {
-  EXPECT_CALL(callback_, OnCaptureCompleted(_))
+  EXPECT_CALL(callback_,
+              OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
       .Times(2)
       .WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback1))
       .WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback2));