From 6acd9f49d9b3038d3718ab36e99438cba45ec3a1 Mon Sep 17 00:00:00 2001 From: sergeyu Date: Thu, 21 Apr 2016 09:46:22 -0700 Subject: [PATCH] Cleanup webrtc/modules/desktop_capture Removed deprecated files, types and methods in modules/webrtc that were kept there to avoid breaking chromium, and which are no longer needed. BUG=172183 Review URL: https://codereview.webrtc.org/1909593002 Cr-Commit-Position: refs/heads/master@{#12457} --- webrtc/modules/desktop_capture/BUILD.gn | 2 -- .../desktop_capture/desktop_capture.gypi | 2 -- .../desktop_capture/desktop_capturer.h | 5 --- .../desktop_capture/desktop_frame_win.cc | 3 +- .../desktop_capture/mouse_cursor_shape.h | 17 --------- .../desktop_capture/screen_capturer.cc | 36 ------------------- .../modules/desktop_capture/screen_capturer.h | 26 +------------- .../screen_capturer_mac_unittest.cc | 6 +++- .../win/screen_capturer_win_gdi.cc | 18 ---------- .../desktop_capture/window_capturer.cc | 22 ------------ .../modules/desktop_capture/window_capturer.h | 3 -- 11 files changed, 7 insertions(+), 133 deletions(-) delete mode 100644 webrtc/modules/desktop_capture/mouse_cursor_shape.h delete mode 100644 webrtc/modules/desktop_capture/screen_capturer.cc delete mode 100644 webrtc/modules/desktop_capture/window_capturer.cc diff --git a/webrtc/modules/desktop_capture/BUILD.gn b/webrtc/modules/desktop_capture/BUILD.gn index aa33993192..9451d8be9f 100644 --- a/webrtc/modules/desktop_capture/BUILD.gn +++ b/webrtc/modules/desktop_capture/BUILD.gn @@ -62,7 +62,6 @@ source_set("desktop_capture") { "mouse_cursor_monitor_win.cc", "screen_capture_frame_queue.cc", "screen_capture_frame_queue.h", - "screen_capturer.cc", "screen_capturer.h", "screen_capturer_helper.cc", "screen_capturer_helper.h", @@ -87,7 +86,6 @@ source_set("desktop_capture") { "win/screen_capturer_win_magnifier.h", "win/window_capture_utils.cc", "win/window_capture_utils.h", - "window_capturer.cc", "window_capturer.h", "window_capturer_mac.mm", "window_capturer_win.cc", diff --git a/webrtc/modules/desktop_capture/desktop_capture.gypi b/webrtc/modules/desktop_capture/desktop_capture.gypi index b92447c349..d11cf7680e 100644 --- a/webrtc/modules/desktop_capture/desktop_capture.gypi +++ b/webrtc/modules/desktop_capture/desktop_capture.gypi @@ -58,7 +58,6 @@ "mouse_cursor_monitor_x11.cc", "screen_capture_frame_queue.cc", "screen_capture_frame_queue.h", - "screen_capturer.cc", "screen_capturer.h", "screen_capturer_helper.cc", "screen_capturer_helper.h", @@ -84,7 +83,6 @@ "win/screen_capture_utils.h", "win/window_capture_utils.cc", "win/window_capture_utils.h", - "window_capturer.cc", "window_capturer.h", "window_capturer_mac.mm", "window_capturer_win.cc", diff --git a/webrtc/modules/desktop_capture/desktop_capturer.h b/webrtc/modules/desktop_capture/desktop_capturer.h index 47f78dc3ff..9c2b8c308a 100644 --- a/webrtc/modules/desktop_capture/desktop_capturer.h +++ b/webrtc/modules/desktop_capture/desktop_capturer.h @@ -28,11 +28,6 @@ class DesktopCapturer { // Interface that must be implemented by the DesktopCapturer consumers. class Callback { public: - // Deprecated. - // TODO(sergeyu): Remove this method once all references to it are removed - // from chromium. - virtual SharedMemory* CreateSharedMemory(size_t size) { return nullptr; } - // Called after a frame has been captured. Handler must take ownership of // |frame|. If capture has failed for any reason |frame| is set to NULL // (e.g. the window has been closed). diff --git a/webrtc/modules/desktop_capture/desktop_frame_win.cc b/webrtc/modules/desktop_capture/desktop_frame_win.cc index f139fb5cdd..e91e37eb5a 100644 --- a/webrtc/modules/desktop_capture/desktop_frame_win.cc +++ b/webrtc/modules/desktop_capture/desktop_frame_win.cc @@ -51,8 +51,7 @@ DesktopFrameWin* DesktopFrameWin::Create( if (shared_memory_factory) { shared_memory = rtc::ScopedToUnique( shared_memory_factory->CreateSharedMemory(buffer_size)); - if (shared_memory) - section_handle = shared_memory->handle(); + section_handle = shared_memory->handle(); } void* data = nullptr; HBITMAP bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &data, diff --git a/webrtc/modules/desktop_capture/mouse_cursor_shape.h b/webrtc/modules/desktop_capture/mouse_cursor_shape.h deleted file mode 100644 index 57120a0b3f..0000000000 --- a/webrtc/modules/desktop_capture/mouse_cursor_shape.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_SHAPE_H_ -#define WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_SHAPE_H_ - -// This file is no longer needed, but some code in chromium still includes it. -// TODO(sergeyu): Cleanup dependencies in chromium and remove this file. - -#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_SHAPE_H_ diff --git a/webrtc/modules/desktop_capture/screen_capturer.cc b/webrtc/modules/desktop_capture/screen_capturer.cc deleted file mode 100644 index 97f69d3baf..0000000000 --- a/webrtc/modules/desktop_capture/screen_capturer.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/desktop_capture/screen_capturer.h" - -#include "webrtc/modules/desktop_capture/desktop_capture_options.h" - -namespace webrtc { - -ScreenCapturer* ScreenCapturer::Create() { - return Create(DesktopCaptureOptions::CreateDefault()); -} - -#if defined(WEBRTC_LINUX) -ScreenCapturer* ScreenCapturer::CreateWithXDamage( - bool use_update_notifications) { - DesktopCaptureOptions options; - options.set_use_update_notifications(use_update_notifications); - return Create(options); -} -#elif defined(WEBRTC_WIN) -ScreenCapturer* ScreenCapturer::CreateWithDisableAero(bool disable_effects) { - DesktopCaptureOptions options; - options.set_disable_effects(disable_effects); - return Create(options); -} -#endif - -} // namespace webrtc diff --git a/webrtc/modules/desktop_capture/screen_capturer.h b/webrtc/modules/desktop_capture/screen_capturer.h index b4e3488766..48ecc31fbd 100644 --- a/webrtc/modules/desktop_capture/screen_capturer.h +++ b/webrtc/modules/desktop_capture/screen_capturer.h @@ -48,34 +48,10 @@ class ScreenCapturer : public DesktopCapturer { }; typedef std::vector ScreenList; - // TODO(sergeyu): Remove this class once all dependencies are removed from - // chromium. - class MouseShapeObserver { - }; - virtual ~ScreenCapturer() {} - // Creates platform-specific capturer. - // - // TODO(sergeyu): Remove all Create() methods except the first one. - // crbug.com/172183 + // Creates a platform-specific capturer. static ScreenCapturer* Create(const DesktopCaptureOptions& options); - static ScreenCapturer* Create(); - -#if defined(WEBRTC_LINUX) - // Creates platform-specific capturer and instructs it whether it should use - // X DAMAGE support. - static ScreenCapturer* CreateWithXDamage(bool use_x_damage); -#elif defined(WEBRTC_WIN) - // Creates Windows-specific capturer and instructs it whether or not to - // disable desktop compositing. - static ScreenCapturer* CreateWithDisableAero(bool disable_aero); -#endif // defined(WEBRTC_WIN) - - // TODO(sergeyu): Remove this method once all dependencies are removed from - // chromium. - virtual void SetMouseShapeObserver( - MouseShapeObserver* mouse_shape_observer) {}; // Get the list of screens (not containing kFullDesktopScreenId). Returns // false in case of a failure. diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc index 64d649cd9d..815c7f53af 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc @@ -16,6 +16,7 @@ #include #include "testing/gtest/include/gtest/gtest.h" +#include "webrtc/modules/desktop_capture/desktop_capture_options.h" #include "webrtc/modules/desktop_capture/desktop_frame.h" #include "webrtc/modules/desktop_capture/desktop_geometry.h" #include "webrtc/modules/desktop_capture/desktop_region.h" @@ -38,7 +39,10 @@ class ScreenCapturerMacTest : public testing::Test { void CaptureDoneCallback2(DesktopFrame* frame); protected: - void SetUp() override { capturer_.reset(ScreenCapturer::Create()); } + void SetUp() override { + capturer_.reset( + ScreenCapturer::Create(DesktopCaptureOptions::CreateDefault())); + } std::unique_ptr capturer_; MockScreenCapturerCallback callback_; diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc index d3035a15ca..31c79cdda3 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc @@ -36,22 +36,6 @@ const UINT DWM_EC_ENABLECOMPOSITION = 1; const wchar_t kDwmapiLibraryName[] = L"dwmapi.dll"; -// SharedMemoryFactory that creates SharedMemory using the deprecated -// DesktopCapturer::Callback::CreateSharedMemory(). -class CallbackSharedMemoryFactory : public SharedMemoryFactory { - public: - CallbackSharedMemoryFactory(DesktopCapturer::Callback* callback) - : callback_(callback) {} - ~CallbackSharedMemoryFactory() override {} - - rtc::scoped_ptr CreateSharedMemory(size_t size) override { - return rtc::scoped_ptr(callback_->CreateSharedMemory(size)); - } - - private: - DesktopCapturer::Callback* callback_; -}; - } // namespace ScreenCapturerWinGdi::ScreenCapturerWinGdi(const DesktopCaptureOptions& options) @@ -172,8 +156,6 @@ void ScreenCapturerWinGdi::Start(Callback* callback) { assert(callback); callback_ = callback; - if (!shared_memory_factory_) - shared_memory_factory_.reset(new CallbackSharedMemoryFactory(callback)); // Vote to disable Aero composited desktop effects while capturing. Windows // will restore Aero automatically if the process exits. This has no effect diff --git a/webrtc/modules/desktop_capture/window_capturer.cc b/webrtc/modules/desktop_capture/window_capturer.cc deleted file mode 100644 index c5176d5e60..0000000000 --- a/webrtc/modules/desktop_capture/window_capturer.cc +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/desktop_capture/window_capturer.h" - -#include "webrtc/modules/desktop_capture/desktop_capture_options.h" - -namespace webrtc { - -// static -WindowCapturer* WindowCapturer::Create() { - return Create(DesktopCaptureOptions::CreateDefault()); -} - -} // namespace webrtc diff --git a/webrtc/modules/desktop_capture/window_capturer.h b/webrtc/modules/desktop_capture/window_capturer.h index 9ba441a8ec..eb9b9feaf0 100644 --- a/webrtc/modules/desktop_capture/window_capturer.h +++ b/webrtc/modules/desktop_capture/window_capturer.h @@ -38,9 +38,6 @@ class WindowCapturer : public DesktopCapturer { static WindowCapturer* Create(const DesktopCaptureOptions& options); - // TODO(sergeyu): Remove this method. crbug.com/172183 - static WindowCapturer* Create(); - virtual ~WindowCapturer() {} // Get list of windows. Returns false in case of a failure.