Skip to content

Commit

Permalink
Remove DISALLOW_* macros from remoting/
Browse files Browse the repository at this point in the history
This inlines all remaining DISALLOW_* macros in remoting/. This is done
manually (vim regex + manually finding insertion position).

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I8d7970f7775beb02c28876002a06a7f0d35d7f5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3205668
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Joe Downing <joedow@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#928261}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed Oct 5, 2021
1 parent 8aaf96f commit 7c0127b
Show file tree
Hide file tree
Showing 71 changed files with 236 additions and 163 deletions.
5 changes: 3 additions & 2 deletions remoting/base/auto_thread_task_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class AutoThreadTaskRunner : public base::SingleThreadTaskRunner {
AutoThreadTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::OnceClosure stop_task);

AutoThreadTaskRunner(const AutoThreadTaskRunner&) = delete;
AutoThreadTaskRunner& operator=(const AutoThreadTaskRunner&) = delete;

// SingleThreadTaskRunner implementation
bool PostDelayedTask(const base::Location& from_here,
base::OnceClosure task,
Expand All @@ -43,8 +46,6 @@ class AutoThreadTaskRunner : public base::SingleThreadTaskRunner {

// The wrapped task runner.
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;

DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner);
};

} // namespace remoting
Expand Down
5 changes: 3 additions & 2 deletions remoting/base/rsa_key_pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class RsaKeyPair : public base::RefCountedThreadSafe<RsaKeyPair> {
// Loads a private key from a base64-encoded string. Returns true on success.
static scoped_refptr<RsaKeyPair> FromString(const std::string& key_base64);

RsaKeyPair(const RsaKeyPair&) = delete;
RsaKeyPair& operator=(const RsaKeyPair&) = delete;

// Returns a base64 encoded string representing the private key.
std::string ToString() const;

Expand All @@ -47,8 +50,6 @@ class RsaKeyPair : public base::RefCountedThreadSafe<RsaKeyPair> {
virtual ~RsaKeyPair();

std::unique_ptr<crypto::RSAPrivateKey> key_;

DISALLOW_COPY_AND_ASSIGN(RsaKeyPair);
};

} // namespace remoting
Expand Down
7 changes: 4 additions & 3 deletions remoting/base/scoped_sc_handle_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class ScHandleTraits {
public:
typedef SC_HANDLE Handle;

ScHandleTraits() = delete;
ScHandleTraits(const ScHandleTraits&) = delete;
ScHandleTraits& operator=(const ScHandleTraits&) = delete;

// Closes the handle.
static bool CloseHandle(SC_HANDLE handle) {
return ::CloseServiceHandle(handle) != FALSE;
Expand All @@ -30,9 +34,6 @@ class ScHandleTraits {
static SC_HANDLE NullHandle() {
return NULL;
}

private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ScHandleTraits);
};

typedef base::win::GenericScopedHandle<
Expand Down
5 changes: 3 additions & 2 deletions remoting/base/service_urls.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class ServiceUrls {
public:
static ServiceUrls* GetInstance();

ServiceUrls(const ServiceUrls&) = delete;
ServiceUrls& operator=(const ServiceUrls&) = delete;

const std::string& ftl_server_endpoint() const {
return ftl_server_endpoint_;
}
Expand All @@ -39,8 +42,6 @@ class ServiceUrls {
std::string ice_config_url_;
std::string ftl_server_endpoint_;
std::string remoting_server_endpoint_;

DISALLOW_COPY_AND_ASSIGN(ServiceUrls);
};

} // namespace remoting
Expand Down
5 changes: 3 additions & 2 deletions remoting/base/url_request_context_getter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
explicit URLRequestContextGetter(
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner);

URLRequestContextGetter(const URLRequestContextGetter&) = delete;
URLRequestContextGetter& operator=(const URLRequestContextGetter&) = delete;

// Overridden from net::URLRequestContextGetter:
net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
Expand All @@ -39,8 +42,6 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
std::unique_ptr<net::URLRequestContext> url_request_context_;
scoped_refptr<net::CertNetFetcherURLRequest> cert_net_fetcher_;

DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
};

} // namespace remoting
Expand Down
5 changes: 3 additions & 2 deletions remoting/client/chromoting_client_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class ChromotingClientRuntime {

static ChromotingClientRuntime* GetInstance();

ChromotingClientRuntime(const ChromotingClientRuntime&) = delete;
ChromotingClientRuntime& operator=(const ChromotingClientRuntime&) = delete;

// Must be called before calling any other methods on this object.
void Init(ChromotingClientRuntime::Delegate* delegate);

Expand Down Expand Up @@ -122,8 +125,6 @@ class ChromotingClientRuntime {
ChromotingClientRuntime::Delegate* delegate_ = nullptr;

friend struct base::DefaultSingletonTraits<ChromotingClientRuntime>;

DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntime);
};

} // namespace remoting
Expand Down
5 changes: 3 additions & 2 deletions remoting/client/display/gl_cursor_feedback_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class GlCursorFeedbackTexture {

static GlCursorFeedbackTexture* GetInstance();

GlCursorFeedbackTexture(const GlCursorFeedbackTexture&) = delete;
GlCursorFeedbackTexture& operator=(const GlCursorFeedbackTexture&) = delete;

const std::vector<uint8_t>& GetTexture() const;

private:
Expand All @@ -29,8 +32,6 @@ class GlCursorFeedbackTexture {
friend struct base::DefaultSingletonTraits<GlCursorFeedbackTexture>;

std::vector<uint8_t> texture_;

DISALLOW_COPY_AND_ASSIGN(GlCursorFeedbackTexture);
};

} // namespace remoting
Expand Down
10 changes: 6 additions & 4 deletions remoting/client/display/gl_renderer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class FakeGlRendererDelegate : public GlRendererDelegate {
public:
FakeGlRendererDelegate() {}

FakeGlRendererDelegate(const FakeGlRendererDelegate&) = delete;
FakeGlRendererDelegate& operator=(const FakeGlRendererDelegate&) = delete;

bool CanRenderFrame() override {
can_render_frame_call_count_++;
return can_render_frame_;
Expand Down Expand Up @@ -70,14 +73,15 @@ class FakeGlRendererDelegate : public GlRendererDelegate {

base::RepeatingClosure on_frame_rendered_callback_;
base::WeakPtrFactory<FakeGlRendererDelegate> weak_factory_{this};

DISALLOW_COPY_AND_ASSIGN(FakeGlRendererDelegate);
};

class FakeDrawable : public Drawable {
public:
FakeDrawable() {}

FakeDrawable(const FakeDrawable&) = delete;
FakeDrawable& operator=(const FakeDrawable&) = delete;

void SetId(int id) { id_ = id; }
int GetId() { return id_; }

Expand All @@ -104,8 +108,6 @@ class FakeDrawable : public Drawable {
int z_index_ = -1;

base::WeakPtrFactory<FakeDrawable> weak_factory_{this};

DISALLOW_COPY_AND_ASSIGN(FakeDrawable);
};

class GlRendererTest : public testing::Test {
Expand Down
7 changes: 4 additions & 3 deletions remoting/client/in_memory_log_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ namespace remoting {
// Class for capturing logs in memory before printing out.
class InMemoryLogHandler {
public:
InMemoryLogHandler() = delete;
InMemoryLogHandler(const InMemoryLogHandler&) = delete;
InMemoryLogHandler& operator=(const InMemoryLogHandler&) = delete;

// Registers the log handler. This is not thread safe and should be called
// exactly once in the main function.
static void Register();

// Returns most recently captured logs (#lines <= kMaxNumberOfLogs) since the
// app is launched. This must be called after Register() is called.
static std::string GetInMemoryLogs();

private:
DISALLOW_IMPLICIT_CONSTRUCTORS(InMemoryLogHandler);
};

} // namespace remoting
Expand Down
6 changes: 4 additions & 2 deletions remoting/client/input/touch_input_scaler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const PointInfo kDefaultPointInfo = {kDefaultXCoord, kDefaultYCoord,
} // namespace

class TouchInputScalerTest : public ::testing::Test {
public:
TouchInputScalerTest(const TouchInputScalerTest&) = delete;
TouchInputScalerTest& operator=(const TouchInputScalerTest&) = delete;

protected:
TouchInputScalerTest() : touch_input_scaler_(&mock_stub_) {}

Expand Down Expand Up @@ -89,8 +93,6 @@ class TouchInputScalerTest : public ::testing::Test {

private:
std::vector<PointInfo> point_infos_;

DISALLOW_COPY_AND_ASSIGN(TouchInputScalerTest);
};

// TouchInputFilter require both input and output dimensions.
Expand Down
5 changes: 3 additions & 2 deletions remoting/client/jni/jni_runtime_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class JniRuntimeDelegate : public ChromotingClientRuntime::Delegate {
// we close. Its components are reused across |JniRuntimeDelegate|s.
static JniRuntimeDelegate* GetInstance();

JniRuntimeDelegate(const JniRuntimeDelegate&) = delete;
JniRuntimeDelegate& operator=(const JniRuntimeDelegate&) = delete;

// remoting::ChromotingClientRuntime::Delegate overrides.
void RuntimeWillShutdown() override;
void RuntimeDidShutdown() override;
Expand All @@ -60,8 +63,6 @@ class JniRuntimeDelegate : public ChromotingClientRuntime::Delegate {
std::unique_ptr<JniOAuthTokenGetter> token_getter_;

friend struct base::DefaultSingletonTraits<JniRuntimeDelegate>;

DISALLOW_COPY_AND_ASSIGN(JniRuntimeDelegate);
};

} // namespace remoting
Expand Down
5 changes: 3 additions & 2 deletions remoting/codec/codec_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class VideoDecoderTester {
frame_(new BasicDesktopFrame(screen_size)),
expected_frame_(nullptr) {}

VideoDecoderTester(const VideoDecoderTester&) = delete;
VideoDecoderTester& operator=(const VideoDecoderTester&) = delete;

void Reset() {
frame_ = std::make_unique<BasicDesktopFrame>(frame_->size());
expected_region_.Clear();
Expand Down Expand Up @@ -167,8 +170,6 @@ class VideoDecoderTester {
VideoDecoder* decoder_;
std::unique_ptr<DesktopFrame> frame_;
DesktopFrame* expected_frame_;

DISALLOW_COPY_AND_ASSIGN(VideoDecoderTester);
};

// The VideoEncoderTester provides a hook for retrieving the data, and passing
Expand Down
5 changes: 3 additions & 2 deletions remoting/codec/video_encoder_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class VideoEncoderHelper {
public:
VideoEncoderHelper();

VideoEncoderHelper(const VideoEncoderHelper&) = delete;
VideoEncoderHelper& operator=(const VideoEncoderHelper&) = delete;

// Returns a new VideoPacket with common fields (e.g. capture_time_ms, rects
// list, frame shape if any) initialized based on the supplied |frame|.
// Screen width and height will be set iff |frame|'s size differs from that
Expand All @@ -41,8 +44,6 @@ class VideoEncoderHelper {
private:
// The most recent screen size. Used to detect screen size changes.
webrtc::DesktopSize screen_size_;

DISALLOW_COPY_AND_ASSIGN(VideoEncoderHelper);
};

} // namespace remoting
Expand Down
7 changes: 4 additions & 3 deletions remoting/host/chromeos/clipboard_aura_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ const base::TimeDelta kTestOverridePollingInterval = base::Milliseconds(1);
class ClientClipboard : public protocol::ClipboardStub {
public:
ClientClipboard();

ClientClipboard(const ClientClipboard&) = delete;
ClientClipboard& operator=(const ClientClipboard&) = delete;

MOCK_METHOD1(InjectClipboardEvent,
void(const protocol::ClipboardEvent& event));

private:
DISALLOW_COPY_AND_ASSIGN(ClientClipboard);
};

ClientClipboard::ClientClipboard() = default;
Expand Down
5 changes: 3 additions & 2 deletions remoting/host/chromeos/mouse_cursor_monitor_aura.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class MouseCursorMonitorAura : public webrtc::MouseCursorMonitor {
public:
MouseCursorMonitorAura();

MouseCursorMonitorAura(const MouseCursorMonitorAura&) = delete;
MouseCursorMonitorAura& operator=(const MouseCursorMonitorAura&) = delete;

// webrtc::MouseCursorMonitor implementation.
void Init(Callback* callback, Mode mode) override;
void Capture() override;
Expand All @@ -29,8 +32,6 @@ class MouseCursorMonitorAura : public webrtc::MouseCursorMonitor {
Mode mode_;
ui::Cursor last_cursor_;
gfx::Point last_mouse_location_;

DISALLOW_COPY_AND_ASSIGN(MouseCursorMonitorAura);
};

} // namespace remoting
Expand Down
6 changes: 4 additions & 2 deletions remoting/host/client_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class ClientSession : public protocol::HostStub,
const base::TimeDelta& max_duration,
scoped_refptr<protocol::PairingRegistry> pairing_registry,
const std::vector<HostExtension*>& extensions);

ClientSession(const ClientSession&) = delete;
ClientSession& operator=(const ClientSession&) = delete;

~ClientSession() override;

// Returns the set of capabilities negotiated between client and host.
Expand Down Expand Up @@ -361,8 +365,6 @@ class ClientSession : public protocol::HostStub,
// Used to disable callbacks to |this| once DisconnectSession() has been
// called.
base::WeakPtrFactory<ClientSessionControl> weak_factory_{this};

DISALLOW_COPY_AND_ASSIGN(ClientSession);
};

} // namespace remoting
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/config_file_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ConfigFileWatcherImpl
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
const base::FilePath& config_path);

ConfigFileWatcherImpl(const ConfigFileWatcherImpl&) = delete;
ConfigFileWatcherImpl& operator=(const ConfigFileWatcherImpl&) = delete;

// Notify |delegate| of config changes.
void Watch(ConfigWatcher::Delegate* delegate);
Expand Down Expand Up @@ -85,8 +87,6 @@ class ConfigFileWatcherImpl
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;

base::WeakPtrFactory<ConfigFileWatcherImpl> weak_factory_{this};

DISALLOW_COPY_AND_ASSIGN(ConfigFileWatcherImpl);
};

ConfigFileWatcher::ConfigFileWatcher(
Expand Down
5 changes: 3 additions & 2 deletions remoting/host/curtain_mode_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ class CurtainModeLinux : public CurtainMode {
public:
CurtainModeLinux();

CurtainModeLinux(const CurtainModeLinux&) = delete;
CurtainModeLinux& operator=(const CurtainModeLinux&) = delete;

// Overriden from CurtainMode.
bool Activate() override;

private:
// Returns true if the host is running under a virtual session.
bool IsVirtualSession();

DISALLOW_COPY_AND_ASSIGN(CurtainModeLinux);
};

CurtainModeLinux::CurtainModeLinux() = default;
Expand Down
5 changes: 3 additions & 2 deletions remoting/host/curtain_mode_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class SessionWatcher : public base::RefCountedThreadSafe<SessionWatcher> {
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control);

SessionWatcher(const SessionWatcher&) = delete;
SessionWatcher& operator=(const SessionWatcher&) = delete;

void Start();
void Stop();

Expand Down Expand Up @@ -115,8 +118,6 @@ class SessionWatcher : public base::RefCountedThreadSafe<SessionWatcher> {
base::WeakPtr<ClientSessionControl> client_session_control_;

EventHandlerRef event_handler_;

DISALLOW_COPY_AND_ASSIGN(SessionWatcher);
};

SessionWatcher::SessionWatcher(
Expand Down
6 changes: 3 additions & 3 deletions remoting/host/curtain_mode_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class CurtainModeWin : public CurtainMode {
public:
CurtainModeWin();

CurtainModeWin(const CurtainModeWin&) = delete;
CurtainModeWin& operator=(const CurtainModeWin&) = delete;

// Overriden from CurtainMode.
bool Activate() override;

private:
DISALLOW_COPY_AND_ASSIGN(CurtainModeWin);
};

CurtainModeWin::CurtainModeWin() {
Expand Down
Loading

0 comments on commit 7c0127b

Please sign in to comment.