Skip to content

Commit

Permalink
Remove DISALLOW_* macros from chromecast/
Browse files Browse the repository at this point in the history
This inlines all remaining DISALLOW_* macros in chromecast/. 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: I8986fc02493991173a7e0f4181bae50acc832d03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3203147
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#928220}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed Oct 5, 2021
1 parent 87d79ef commit ae0ffa0
Show file tree
Hide file tree
Showing 99 changed files with 476 additions and 288 deletions.
5 changes: 3 additions & 2 deletions chromecast/app/android/crash_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class CastCrashReporterClientAndroid;

class CrashHandler {
public:
CrashHandler(const CrashHandler&) = delete;
CrashHandler& operator=(const CrashHandler&) = delete;

// Initializes the crash handler for attempting to upload crash dumps with
// the current process's log file.
// Must not be called more than once.
Expand Down Expand Up @@ -54,8 +57,6 @@ class CrashHandler {
std::string process_type_;

std::unique_ptr<CastCrashReporterClientAndroid> crash_reporter_client_;

DISALLOW_COPY_AND_ASSIGN(CrashHandler);
};

} // namespace chromecast
Expand Down
7 changes: 5 additions & 2 deletions chromecast/app/linux/cast_crash_reporter_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ int WriteFakeDumpStateFile(const std::string& path) {
} // namespace

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

protected:
CastCrashReporterClientTest() {}
~CastCrashReporterClientTest() override {}
Expand Down Expand Up @@ -117,8 +122,6 @@ class CastCrashReporterClientTest : public testing::Test {
base::ScopedTempDir fake_home_dir_;
ScopedTempFile minidump_;
std::unique_ptr<base::ScopedPathOverride> home_override_;

DISALLOW_COPY_AND_ASSIGN(CastCrashReporterClientTest);
};

TEST_F(CastCrashReporterClientTest, EndToEndTestOnIORestrictedThread) {
Expand Down
7 changes: 4 additions & 3 deletions chromecast/base/android/dumpstate_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ namespace chromecast {
// JNI wrapper for DumpstateWriter.java.
class DumpstateWriter {
public:
static void AddDumpValue(const std::string& name, const std::string& value);
DumpstateWriter() = delete;
DumpstateWriter(const DumpstateWriter&) = delete;
DumpstateWriter& operator=(const DumpstateWriter&) = delete;

private:
DISALLOW_IMPLICIT_CONSTRUCTORS(DumpstateWriter);
static void AddDumpValue(const std::string& name, const std::string& value);
};

} // namespace chromecast
Expand Down
5 changes: 3 additions & 2 deletions chromecast/base/cast_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class CastResource {
virtual ~Client() {}
};

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

// Sets the Client for the CastResource to respond to when it is done with
// Acquire/ReleaseResource.
void SetCastResourceClient(Client* client);
Expand All @@ -95,8 +98,6 @@ class CastResource {

private:
Client* client_;

DISALLOW_COPY_AND_ASSIGN(CastResource);
};

} // namespace chromecast
Expand Down
6 changes: 3 additions & 3 deletions chromecast/base/chromecast_config_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class ChromecastConfigAndroid {
public:
static ChromecastConfigAndroid* GetInstance();

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

// Returns whether or not the user has allowed sending usage stats and
// crash reports.
// TODO(ziyangch): Remove CanSendUsageStats() and switch to pure callback
Expand All @@ -36,9 +39,6 @@ class ChromecastConfigAndroid {
ChromecastConfigAndroid() {}

virtual ~ChromecastConfigAndroid() {}

private:
DISALLOW_COPY_AND_ASSIGN(ChromecastConfigAndroid);
};

} // namespace android
Expand Down
5 changes: 3 additions & 2 deletions chromecast/base/component/component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class DependencyCount : public base::RefCountedThreadSafe<DependencyCount> {
DCHECK(component_);
}

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

void Detach() {
DCHECK(task_runner_->BelongsToCurrentThread());
component_ = nullptr;
Expand Down Expand Up @@ -160,8 +163,6 @@ class DependencyCount : public base::RefCountedThreadSafe<DependencyCount> {
AtomicWord dep_count_;
bool disabling_;
std::set<DependencyBase*> strong_dependents_;

DISALLOW_COPY_AND_ASSIGN(DependencyCount);
};

DependencyBase::DependencyBase(const WeakReferenceBase& dependency,
Expand Down
17 changes: 9 additions & 8 deletions chromecast/base/component/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ class ComponentBase {
virtual ~Observer() {}
};

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

virtual ~ComponentBase();

// Enables this component if possible. Attempts to enable all strong
Expand Down Expand Up @@ -266,8 +269,6 @@ class ComponentBase {
bool async_call_in_progress_;
int pending_dependency_count_;
const scoped_refptr<base::ObserverListThreadSafe<Observer>> observers_;

DISALLOW_COPY_AND_ASSIGN(ComponentBase);
};

template <typename C>
Expand All @@ -276,13 +277,13 @@ class StrongDependency : public subtle::DependencyBase {
StrongDependency(const WeakReference<C>& dependency, ComponentBase* dependent)
: subtle::DependencyBase(dependency, dependent) {}

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

C* operator->() const {
DCHECK(dependency_);
return static_cast<C*>(dependency_);
}

private:
DISALLOW_COPY_AND_ASSIGN(StrongDependency);
};

template <typename C>
Expand Down Expand Up @@ -316,10 +317,10 @@ class Component : public ComponentBase {

Component() = default;

WeakRef GetRef() { return WeakRef(*static_cast<C*>(this)); }
Component(const Component&) = delete;
Component& operator=(const Component&) = delete;

private:
DISALLOW_COPY_AND_ASSIGN(Component);
WeakRef GetRef() { return WeakRef(*static_cast<C*>(this)); }
};

} // namespace chromecast
Expand Down
15 changes: 9 additions & 6 deletions chromecast/base/device_capabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class DeviceCapabilities {
// Validator class and implement its interface.
class Validator {
public:
Validator(const Validator&) = delete;
Validator& operator=(const Validator&) = delete;

// |path| is full path to capability, which could include paths expanded on
// the capability key that gets registered through the Register() method.
// For example, if a key of "foo" is registered for a Validator, |path|
Expand Down Expand Up @@ -101,15 +104,16 @@ class DeviceCapabilities {

private:
DeviceCapabilities* const capabilities_;

DISALLOW_COPY_AND_ASSIGN(Validator);
};

// Class used to store/own capabilities-related data. It is immutable and
// RefCountedThreadSafe, so client code can freely query it throughout its
// lifetime without worrying about the data getting invalidated in any way.
class Data : public base::RefCountedThreadSafe<Data> {
public:
Data(const Data&) = delete;
Data& operator=(const Data&) = delete;

// Accessor for complete capabilities in dictionary format.
const base::Value& dictionary() const { return dictionary_; }

Expand All @@ -130,8 +134,6 @@ class DeviceCapabilities {

const base::Value dictionary_;
std::string json_string_;

DISALLOW_COPY_AND_ASSIGN(Data);
};

// Default Capability keys
Expand All @@ -140,6 +142,9 @@ class DeviceCapabilities {
static const char kKeyDisplaySupported[];
static const char kKeyHiResAudioSupported[];

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

// This class should get destroyed after all Validators have been
// unregistered, all Observers have been removed, and the class is no longer
// being accessed.
Expand Down Expand Up @@ -245,8 +250,6 @@ class DeviceCapabilities {
// visible in GetAllData().
virtual void SetPrivateValidatedValue(const std::string& path,
base::Value new_value) = 0;

DISALLOW_COPY_AND_ASSIGN(DeviceCapabilities);
};

} // namespace chromecast
Expand Down
5 changes: 3 additions & 2 deletions chromecast/base/metrics/cast_metrics_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class CastMetricsHelper {

static CastMetricsHelper* GetInstance();

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

// This records the startup time of an app load (note: another app
// may be running and still collecting metrics).
virtual void DidStartLoad(const std::string& app_id);
Expand Down Expand Up @@ -186,8 +189,6 @@ class CastMetricsHelper {

// Default RecordAction callback when metrics_sink_ is not set.
RecordActionCallback record_action_callback_;

DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper);
};

} // namespace metrics
Expand Down
20 changes: 12 additions & 8 deletions chromecast/base/observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class Observer {
public:
Observer(const Observer& other);

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

~Observer();

void SetOnUpdateCallback(base::RepeatingClosure callback) {
Expand All @@ -158,8 +160,6 @@ class Observer {
const T& value_;
base::RepeatingClosure on_update_callback_;
SEQUENCE_CHECKER(sequence_checker_);

DISALLOW_ASSIGN(Observer);
};

template <typename T>
Expand All @@ -171,6 +171,10 @@ class Observable {

public:
explicit Observable(const T& initial_value);

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

Observer<T> Observe();

void SetValue(const T& new_value);
Expand All @@ -181,8 +185,6 @@ class Observable {
// By using a refcounted object to store the value and observer list, we can
// avoid tying the lifetime of Observable to its Observers or vice versa.
const scoped_refptr<subtle::ObservableInternals<T>> internals_;

DISALLOW_COPY_AND_ASSIGN(Observable);
};

namespace subtle {
Expand All @@ -194,6 +196,9 @@ class ObservableInternals
explicit ObservableInternals(const T& initial_value)
: value_(initial_value) {}

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

void SetValue(const T& new_value) {
base::AutoLock lock(lock_);
value_ = new_value;
Expand Down Expand Up @@ -259,6 +264,9 @@ class ObservableInternals
public:
explicit SequenceOwnedInfo(const T& value) : value_(value) {}

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

const T& value() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return value_;
Expand Down Expand Up @@ -301,8 +309,6 @@ class ObservableInternals
std::vector<Observer<T>*> observers_;
T value_;
SEQUENCE_CHECKER(sequence_checker_);

DISALLOW_COPY_AND_ASSIGN(SequenceOwnedInfo);
};

class PerSequenceInfo {
Expand Down Expand Up @@ -371,8 +377,6 @@ class ObservableInternals
mutable base::Lock lock_;
T value_;
std::vector<PerSequenceInfo> per_sequence_;

DISALLOW_COPY_AND_ASSIGN(ObservableInternals);
};

} // namespace subtle
Expand Down
5 changes: 3 additions & 2 deletions chromecast/base/observer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class ThreadedObservable {
thread_.Start();
}

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

Observer<int> Observe() { return value_.Observe(); }

void SetValue(int value) {
Expand All @@ -51,8 +54,6 @@ class ThreadedObservable {

base::Thread thread_;
Observable<int> value_;

DISALLOW_COPY_AND_ASSIGN(ThreadedObservable);
};

class ThreadedObserver {
Expand Down
5 changes: 3 additions & 2 deletions chromecast/base/system_time_change_notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class SystemTimeChangeNotifier {
virtual ~Observer() {}
};

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

virtual ~SystemTimeChangeNotifier();

void AddObserver(Observer* observer);
Expand All @@ -43,8 +46,6 @@ class SystemTimeChangeNotifier {

private:
scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_;

DISALLOW_COPY_AND_ASSIGN(SystemTimeChangeNotifier);
};

// Default implementation of SystemTimeChangeNotifier for most platform.
Expand Down
6 changes: 4 additions & 2 deletions chromecast/base/system_time_change_notifier_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class SequencedTaskRunnerNoDelay : public base::SequencedTaskRunner {
public:
SequencedTaskRunnerNoDelay() {}

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

// base::SequencedTaskRunner implementation:
bool PostDelayedTask(const base::Location& from_here,
base::OnceClosure task,
Expand All @@ -44,8 +48,6 @@ class SequencedTaskRunnerNoDelay : public base::SequencedTaskRunner {

private:
~SequencedTaskRunnerNoDelay() override {}

DISALLOW_COPY_AND_ASSIGN(SequencedTaskRunnerNoDelay);
};

class TimeChangeObserver : public SystemTimeChangeNotifier::Observer {
Expand Down
9 changes: 6 additions & 3 deletions chromecast/bindings/bindings_manager_cast_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ class MockWebContentsDelegate : public content::WebContentsDelegate {
// Test class
// =============================================================================
class BindingsManagerCastBrowserTest : public content::BrowserTestBase {
public:
BindingsManagerCastBrowserTest(const BindingsManagerCastBrowserTest&) =
delete;
BindingsManagerCastBrowserTest& operator=(
const BindingsManagerCastBrowserTest&) = delete;

protected:
BindingsManagerCastBrowserTest() = default;
~BindingsManagerCastBrowserTest() override = default;
Expand Down Expand Up @@ -177,9 +183,6 @@ class BindingsManagerCastBrowserTest : public content::BrowserTestBase {
std::unique_ptr<CastWebContentsImpl> cast_web_contents_;

std::unique_ptr<bindings::BindingsManagerCast> bindings_manager_;

private:
DISALLOW_COPY_AND_ASSIGN(BindingsManagerCastBrowserTest);
};

// Handles connected ports from the NamedMessagePortConnector and
Expand Down
Loading

0 comments on commit ae0ffa0

Please sign in to comment.