Enable clang style plugin in webrtc/modules/desktop_capture
Enabled the plugin and cleaned up all issues it found, mainly virtual destructors not being marked as override. BUG=webrtc:163 Review-Url: https://codereview.webrtc.org/2436503004 Cr-Commit-Position: refs/heads/master@{#14793}
This commit is contained in:
parent
54b0acb432
commit
e183121657
@ -150,11 +150,6 @@ rtc_static_library("desktop_capture") {
|
||||
]
|
||||
}
|
||||
|
||||
if (!build_with_chromium && is_clang) {
|
||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||
}
|
||||
|
||||
deps = [
|
||||
":primitives",
|
||||
"../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
|
||||
|
||||
@ -26,7 +26,7 @@ class CroppingWindowCapturer : public WindowCapturer,
|
||||
public DesktopCapturer::Callback {
|
||||
public:
|
||||
static WindowCapturer* Create(const DesktopCaptureOptions& options);
|
||||
virtual ~CroppingWindowCapturer();
|
||||
~CroppingWindowCapturer() override;
|
||||
|
||||
// DesktopCapturer implementation.
|
||||
void Start(DesktopCapturer::Callback* callback) override;
|
||||
|
||||
@ -60,7 +60,7 @@ class DesktopFrameWithCursor : public DesktopFrame {
|
||||
DesktopFrameWithCursor(std::unique_ptr<DesktopFrame> frame,
|
||||
const MouseCursor& cursor,
|
||||
const DesktopVector& position);
|
||||
virtual ~DesktopFrameWithCursor();
|
||||
~DesktopFrameWithCursor() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<DesktopFrame> original_frame_;
|
||||
|
||||
@ -31,7 +31,7 @@ class DesktopAndCursorComposer : public DesktopCapturer,
|
||||
// of both arguments.
|
||||
DesktopAndCursorComposer(DesktopCapturer* desktop_capturer,
|
||||
MouseCursorMonitor* mouse_monitor);
|
||||
virtual ~DesktopAndCursorComposer();
|
||||
~DesktopAndCursorComposer() override;
|
||||
|
||||
// DesktopCapturer interface.
|
||||
void Start(DesktopCapturer::Callback* callback) override;
|
||||
|
||||
@ -12,6 +12,18 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
DesktopCaptureOptions::DesktopCaptureOptions() {}
|
||||
DesktopCaptureOptions::DesktopCaptureOptions(
|
||||
const DesktopCaptureOptions& options) = default;
|
||||
DesktopCaptureOptions::DesktopCaptureOptions(DesktopCaptureOptions&& options) =
|
||||
default;
|
||||
DesktopCaptureOptions::~DesktopCaptureOptions() {}
|
||||
|
||||
DesktopCaptureOptions& DesktopCaptureOptions::operator=(
|
||||
const DesktopCaptureOptions& options) = default;
|
||||
DesktopCaptureOptions& DesktopCaptureOptions::operator=(
|
||||
DesktopCaptureOptions&& options) = default;
|
||||
|
||||
// static
|
||||
DesktopCaptureOptions DesktopCaptureOptions::CreateDefault() {
|
||||
DesktopCaptureOptions result;
|
||||
|
||||
@ -33,6 +33,14 @@ class DesktopCaptureOptions {
|
||||
// X11 connection failed (e.g. DISPLAY isn't set).
|
||||
static DesktopCaptureOptions CreateDefault();
|
||||
|
||||
DesktopCaptureOptions();
|
||||
DesktopCaptureOptions(const DesktopCaptureOptions& options);
|
||||
DesktopCaptureOptions(DesktopCaptureOptions&& options);
|
||||
~DesktopCaptureOptions();
|
||||
|
||||
DesktopCaptureOptions& operator=(const DesktopCaptureOptions& options);
|
||||
DesktopCaptureOptions& operator=(DesktopCaptureOptions&& options);
|
||||
|
||||
#if defined(USE_X11)
|
||||
SharedXDisplay* x_display() const { return x_display_; }
|
||||
void set_x_display(rtc::scoped_refptr<SharedXDisplay> x_display) {
|
||||
|
||||
@ -25,7 +25,7 @@ namespace webrtc {
|
||||
// Frame data is stored in a GDI bitmap.
|
||||
class DesktopFrameWin : public DesktopFrame {
|
||||
public:
|
||||
virtual ~DesktopFrameWin();
|
||||
~DesktopFrameWin() override;
|
||||
|
||||
static std::unique_ptr<DesktopFrameWin>
|
||||
Create(DesktopSize size, SharedMemoryFactory* shared_memory_factory, HDC hdc);
|
||||
|
||||
@ -22,9 +22,15 @@ namespace webrtc {
|
||||
// Describes the configuration of a specific display.
|
||||
struct MacDisplayConfiguration {
|
||||
MacDisplayConfiguration();
|
||||
MacDisplayConfiguration(const MacDisplayConfiguration& other);
|
||||
MacDisplayConfiguration(MacDisplayConfiguration&& other);
|
||||
~MacDisplayConfiguration();
|
||||
|
||||
MacDisplayConfiguration& operator=(const MacDisplayConfiguration& other);
|
||||
MacDisplayConfiguration& operator=(MacDisplayConfiguration&& other);
|
||||
|
||||
// Cocoa identifier for this display.
|
||||
CGDirectDisplayID id;
|
||||
CGDirectDisplayID id = 0;
|
||||
|
||||
// Bounds of this display in Density-Independent Pixels (DIPs).
|
||||
DesktopRect bounds;
|
||||
@ -33,7 +39,7 @@ struct MacDisplayConfiguration {
|
||||
DesktopRect pixel_bounds;
|
||||
|
||||
// Scale factor from DIPs to physical pixels.
|
||||
float dip_to_pixel_scale;
|
||||
float dip_to_pixel_scale = 1.0f;
|
||||
};
|
||||
|
||||
typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations;
|
||||
@ -44,8 +50,13 @@ struct MacDesktopConfiguration {
|
||||
enum Origin { BottomLeftOrigin, TopLeftOrigin };
|
||||
|
||||
MacDesktopConfiguration();
|
||||
MacDesktopConfiguration(const MacDesktopConfiguration& other);
|
||||
MacDesktopConfiguration(MacDesktopConfiguration&& other);
|
||||
~MacDesktopConfiguration();
|
||||
|
||||
MacDesktopConfiguration& operator=(const MacDesktopConfiguration& other);
|
||||
MacDesktopConfiguration& operator=(MacDesktopConfiguration&& other);
|
||||
|
||||
// Returns the desktop & display configurations in Cocoa-style "bottom-up"
|
||||
// (the origin is the bottom-left of the primary monitor, and coordinates
|
||||
// increase as you move up the screen).
|
||||
@ -66,7 +77,7 @@ struct MacDesktopConfiguration {
|
||||
DesktopRect pixel_bounds;
|
||||
|
||||
// Scale factor from DIPs to physical pixels.
|
||||
float dip_to_pixel_scale;
|
||||
float dip_to_pixel_scale = 1.0f;
|
||||
|
||||
// Configurations of the displays making up the desktop area.
|
||||
MacDisplayConfigurations displays;
|
||||
|
||||
@ -85,17 +85,29 @@ MacDisplayConfiguration GetConfigurationForScreen(NSScreen* screen) {
|
||||
|
||||
} // namespace
|
||||
|
||||
MacDisplayConfiguration::MacDisplayConfiguration()
|
||||
: id(0),
|
||||
dip_to_pixel_scale(1.0f) {
|
||||
}
|
||||
MacDisplayConfiguration::MacDisplayConfiguration() = default;
|
||||
MacDisplayConfiguration::MacDisplayConfiguration(
|
||||
const MacDisplayConfiguration& other) = default;
|
||||
MacDisplayConfiguration::MacDisplayConfiguration(
|
||||
MacDisplayConfiguration&& other) = default;
|
||||
MacDisplayConfiguration::~MacDisplayConfiguration() = default;
|
||||
|
||||
MacDesktopConfiguration::MacDesktopConfiguration()
|
||||
: dip_to_pixel_scale(1.0f) {
|
||||
}
|
||||
MacDisplayConfiguration& MacDisplayConfiguration::operator=(
|
||||
const MacDisplayConfiguration& other) = default;
|
||||
MacDisplayConfiguration& MacDisplayConfiguration::operator=(
|
||||
MacDisplayConfiguration&& other) = default;
|
||||
|
||||
MacDesktopConfiguration::~MacDesktopConfiguration() {
|
||||
}
|
||||
MacDesktopConfiguration::MacDesktopConfiguration() = default;
|
||||
MacDesktopConfiguration::MacDesktopConfiguration(
|
||||
const MacDesktopConfiguration& other) = default;
|
||||
MacDesktopConfiguration::MacDesktopConfiguration(
|
||||
MacDesktopConfiguration&& other) = default;
|
||||
MacDesktopConfiguration::~MacDesktopConfiguration() = default;
|
||||
|
||||
MacDesktopConfiguration& MacDesktopConfiguration::operator=(
|
||||
const MacDesktopConfiguration& other) = default;
|
||||
MacDesktopConfiguration& MacDesktopConfiguration::operator=(
|
||||
MacDesktopConfiguration&& other) = default;
|
||||
|
||||
// static
|
||||
MacDesktopConfiguration MacDesktopConfiguration::GetCurrent(Origin origin) {
|
||||
|
||||
@ -54,7 +54,7 @@ class MouseCursorMonitorMac : public MouseCursorMonitor {
|
||||
MouseCursorMonitorMac(const DesktopCaptureOptions& options,
|
||||
CGWindowID window_id,
|
||||
ScreenId screen_id);
|
||||
virtual ~MouseCursorMonitorMac();
|
||||
~MouseCursorMonitorMac() override;
|
||||
|
||||
void Init(Callback* callback, Mode mode) override;
|
||||
void Capture() override;
|
||||
|
||||
@ -39,7 +39,7 @@ class MouseCursorMonitorWin : public MouseCursorMonitor {
|
||||
public:
|
||||
explicit MouseCursorMonitorWin(HWND window);
|
||||
explicit MouseCursorMonitorWin(ScreenId screen);
|
||||
virtual ~MouseCursorMonitorWin();
|
||||
~MouseCursorMonitorWin() override;
|
||||
|
||||
void Init(Callback* callback, Mode mode) override;
|
||||
void Capture() override;
|
||||
|
||||
@ -62,7 +62,7 @@ class MouseCursorMonitorX11 : public MouseCursorMonitor,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window);
|
||||
virtual ~MouseCursorMonitorX11();
|
||||
~MouseCursorMonitorX11() override;
|
||||
|
||||
void Init(Callback* callback, Mode mode) override;
|
||||
void Capture() override;
|
||||
|
||||
@ -48,7 +48,7 @@ class ScreenCapturer : public DesktopCapturer {
|
||||
};
|
||||
typedef std::vector<Screen> ScreenList;
|
||||
|
||||
virtual ~ScreenCapturer() {}
|
||||
~ScreenCapturer() override {}
|
||||
|
||||
// Creates a platform-specific capturer.
|
||||
static ScreenCapturer* Create(const DesktopCaptureOptions& options);
|
||||
|
||||
@ -279,7 +279,7 @@ class ScreenCapturerMac : public ScreenCapturer {
|
||||
public:
|
||||
explicit ScreenCapturerMac(
|
||||
rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor);
|
||||
virtual ~ScreenCapturerMac();
|
||||
~ScreenCapturerMac() override;
|
||||
|
||||
bool Init();
|
||||
|
||||
@ -374,7 +374,7 @@ class InvertedDesktopFrame : public DesktopFrame {
|
||||
set_capture_time_ms(original_frame_->capture_time_ms());
|
||||
mutable_updated_region()->Swap(original_frame_->mutable_updated_region());
|
||||
}
|
||||
virtual ~InvertedDesktopFrame() {}
|
||||
~InvertedDesktopFrame() override {}
|
||||
|
||||
private:
|
||||
std::unique_ptr<DesktopFrame> original_frame_;
|
||||
|
||||
@ -34,7 +34,7 @@ class MockScreenCapturer : public ScreenCapturer {
|
||||
class MockScreenCapturerCallback : public ScreenCapturer::Callback {
|
||||
public:
|
||||
MockScreenCapturerCallback() {}
|
||||
virtual ~MockScreenCapturerCallback() {}
|
||||
~MockScreenCapturerCallback() override {}
|
||||
|
||||
MOCK_METHOD2(OnCaptureResultPtr,
|
||||
void(DesktopCapturer::Result result,
|
||||
|
||||
@ -47,7 +47,7 @@ class ScreenCapturerLinux : public ScreenCapturer,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
ScreenCapturerLinux();
|
||||
virtual ~ScreenCapturerLinux();
|
||||
~ScreenCapturerLinux() override;
|
||||
|
||||
// TODO(ajwong): Do we really want this to be synchronous?
|
||||
bool Init(const DesktopCaptureOptions& options);
|
||||
|
||||
@ -19,6 +19,8 @@ namespace webrtc {
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
D3dDevice::D3dDevice() = default;
|
||||
D3dDevice::D3dDevice(const D3dDevice& other) = default;
|
||||
D3dDevice::D3dDevice(D3dDevice&& other) = default;
|
||||
D3dDevice::~D3dDevice() = default;
|
||||
|
||||
bool D3dDevice::Initialize(const ComPtr<IDXGIAdapter>& adapter) {
|
||||
|
||||
@ -24,6 +24,8 @@ namespace webrtc {
|
||||
// This class represents one video card in the system.
|
||||
class D3dDevice {
|
||||
public:
|
||||
D3dDevice(const D3dDevice& other);
|
||||
D3dDevice(D3dDevice&& other);
|
||||
~D3dDevice();
|
||||
|
||||
ID3D11Device* d3d_device() const { return d3d_device_.Get(); }
|
||||
|
||||
@ -31,10 +31,14 @@ bool IsValidRect(const RECT& rect) {
|
||||
|
||||
} // namespace
|
||||
|
||||
DxgiAdapterDuplicator::Context::Context() = default;
|
||||
DxgiAdapterDuplicator::Context::Context(const Context& other) = default;
|
||||
DxgiAdapterDuplicator::Context::~Context() = default;
|
||||
|
||||
DxgiAdapterDuplicator::DxgiAdapterDuplicator(const D3dDevice& device)
|
||||
: device_(device) {}
|
||||
|
||||
DxgiAdapterDuplicator::DxgiAdapterDuplicator(DxgiAdapterDuplicator&&) = default;
|
||||
DxgiAdapterDuplicator::~DxgiAdapterDuplicator() = default;
|
||||
|
||||
bool DxgiAdapterDuplicator::Initialize() {
|
||||
if (DoInitialize()) {
|
||||
|
||||
@ -28,6 +28,10 @@ namespace webrtc {
|
||||
class DxgiAdapterDuplicator {
|
||||
public:
|
||||
struct Context {
|
||||
Context();
|
||||
Context(const Context& other);
|
||||
~Context();
|
||||
|
||||
// Child DxgiOutputDuplicator::Context belongs to this
|
||||
// DxgiAdapterDuplicator::Context.
|
||||
std::vector<DxgiOutputDuplicator::Context> contexts;
|
||||
@ -41,6 +45,8 @@ class DxgiAdapterDuplicator {
|
||||
// DxgiAdapterDuplicator in std::vector<>.
|
||||
DxgiAdapterDuplicator(DxgiAdapterDuplicator&& other);
|
||||
|
||||
~DxgiAdapterDuplicator();
|
||||
|
||||
// Initializes the DxgiAdapterDuplicator from a D3dDevice.
|
||||
bool Initialize();
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
DxgiDuplicatorController::Context::Context() {}
|
||||
|
||||
DxgiDuplicatorController::Context::~Context() {
|
||||
DxgiDuplicatorController::Instance()->Unregister(this);
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ class DxgiDuplicatorController {
|
||||
// DxgiDuplicatorController.
|
||||
class Context {
|
||||
public:
|
||||
Context();
|
||||
// Unregister this Context instance from all Dxgi duplicators during
|
||||
// destructing.
|
||||
~Context();
|
||||
|
||||
@ -24,7 +24,7 @@ class DxgiDesktopFrame : public DesktopFrame {
|
||||
texture.bits(),
|
||||
nullptr) {}
|
||||
|
||||
virtual ~DxgiDesktopFrame() = default;
|
||||
~DxgiDesktopFrame() override = default;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -32,6 +32,8 @@ class DxgiDesktopFrame : public DesktopFrame {
|
||||
DxgiTexture::DxgiTexture(const DesktopRect& desktop_rect)
|
||||
: desktop_rect_(desktop_rect) {}
|
||||
|
||||
DxgiTexture::~DxgiTexture() {}
|
||||
|
||||
const DesktopFrame& DxgiTexture::AsDesktopFrame() {
|
||||
if (!frame_) {
|
||||
frame_.reset(new DxgiDesktopFrame(*this));
|
||||
|
||||
@ -29,7 +29,7 @@ class DxgiTexture {
|
||||
// entire screen -- usually a monitor on the system.
|
||||
explicit DxgiTexture(const DesktopRect& desktop_rect);
|
||||
|
||||
virtual ~DxgiTexture() = default;
|
||||
virtual ~DxgiTexture();
|
||||
|
||||
// Copies selected regions of a frame represented by frame_info and resource.
|
||||
// Returns false if anything wrong.
|
||||
|
||||
@ -33,7 +33,7 @@ class ScreenCapturerWinDirectx : public ScreenCapturer {
|
||||
|
||||
explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options);
|
||||
|
||||
virtual ~ScreenCapturerWinDirectx();
|
||||
~ScreenCapturerWinDirectx() override;
|
||||
|
||||
void Start(Callback* callback) override;
|
||||
void SetSharedMemoryFactory(
|
||||
|
||||
@ -33,7 +33,7 @@ namespace webrtc {
|
||||
class ScreenCapturerWinGdi : public ScreenCapturer {
|
||||
public:
|
||||
explicit ScreenCapturerWinGdi(const DesktopCaptureOptions& options);
|
||||
virtual ~ScreenCapturerWinGdi();
|
||||
~ScreenCapturerWinGdi() override;
|
||||
|
||||
// Overridden from ScreenCapturer:
|
||||
void Start(Callback* callback) override;
|
||||
|
||||
@ -45,7 +45,7 @@ class ScreenCapturerWinMagnifier : public ScreenCapturer {
|
||||
// the magnifier capturer fails (e.g. in Windows8 Metro mode).
|
||||
explicit ScreenCapturerWinMagnifier(
|
||||
std::unique_ptr<ScreenCapturer> fallback_capturer);
|
||||
virtual ~ScreenCapturerWinMagnifier();
|
||||
~ScreenCapturerWinMagnifier() override;
|
||||
|
||||
// Overridden from ScreenCapturer:
|
||||
void Start(Callback* callback) override;
|
||||
|
||||
@ -38,7 +38,7 @@ class WindowCapturer : public DesktopCapturer {
|
||||
|
||||
static WindowCapturer* Create(const DesktopCaptureOptions& options);
|
||||
|
||||
virtual ~WindowCapturer() {}
|
||||
~WindowCapturer() override {}
|
||||
|
||||
// Get list of windows. Returns false in case of a failure.
|
||||
virtual bool GetWindowList(WindowList* windows) = 0;
|
||||
|
||||
@ -46,7 +46,7 @@ class WindowCapturerMac : public WindowCapturer {
|
||||
public:
|
||||
explicit WindowCapturerMac(rtc::scoped_refptr<FullScreenChromeWindowDetector>
|
||||
full_screen_chrome_window_detector);
|
||||
virtual ~WindowCapturerMac();
|
||||
~WindowCapturerMac() override;
|
||||
|
||||
// WindowCapturer interface.
|
||||
bool GetWindowList(WindowList* windows) override;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace {
|
||||
class WindowCapturerNull : public WindowCapturer {
|
||||
public:
|
||||
WindowCapturerNull();
|
||||
virtual ~WindowCapturerNull();
|
||||
~WindowCapturerNull() override;
|
||||
|
||||
// WindowCapturer interface.
|
||||
bool GetWindowList(WindowList* windows) override;
|
||||
|
||||
@ -83,7 +83,7 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
|
||||
class WindowCapturerWin : public WindowCapturer {
|
||||
public:
|
||||
WindowCapturerWin();
|
||||
virtual ~WindowCapturerWin();
|
||||
~WindowCapturerWin() override;
|
||||
|
||||
// WindowCapturer interface.
|
||||
bool GetWindowList(WindowList* windows) override;
|
||||
|
||||
@ -86,7 +86,7 @@ class WindowCapturerLinux : public WindowCapturer,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
WindowCapturerLinux(const DesktopCaptureOptions& options);
|
||||
virtual ~WindowCapturerLinux();
|
||||
~WindowCapturerLinux() override;
|
||||
|
||||
// WindowCapturer interface.
|
||||
bool GetWindowList(WindowList* windows) override;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user