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}
This commit is contained in:
sergeyu 2016-04-21 09:46:22 -07:00 committed by Commit bot
parent cd5c25cb80
commit 6acd9f49d9
11 changed files with 7 additions and 133 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,34 +48,10 @@ class ScreenCapturer : public DesktopCapturer {
};
typedef std::vector<Screen> 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.

View File

@ -16,6 +16,7 @@
#include <ostream>
#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<ScreenCapturer> capturer_;
MockScreenCapturerCallback callback_;

View File

@ -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<SharedMemory> CreateSharedMemory(size_t size) override {
return rtc::scoped_ptr<SharedMemory>(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

View File

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

View File

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