remove DISALLOW_COPY_AND_ASSIGN from files in base/*
Also fixes a few cpp lint errors. No functional changes.
Bug: 1010217
Change-Id: Ibdbac42980740d26392812b39f86859b238b7a64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422964
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809700}
diff --git a/base/at_exit.h b/base/at_exit.h
index fa652ac..2a11046 100644
--- a/base/at_exit.h
+++ b/base/at_exit.h
@@ -8,7 +8,6 @@
#include "base/base_export.h"
#include "base/callback.h"
#include "base/containers/stack.h"
-#include "base/macros.h"
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
@@ -33,6 +32,8 @@
typedef void (*AtExitCallbackType)(void*);
AtExitManager();
+ AtExitManager(const AtExitManager&) = delete;
+ AtExitManager& operator=(const AtExitManager&) = delete;
// The dtor calls all the registered callbacks. Do not try to register more
// callbacks after this point.
@@ -71,8 +72,6 @@
// Stack of managers to allow shadowing.
AtExitManager* const next_manager_;
-
- DISALLOW_COPY_AND_ASSIGN(AtExitManager);
};
#if defined(UNIT_TEST)
diff --git a/base/atomic_sequence_num.h b/base/atomic_sequence_num.h
index 717e37a..d0ab9eb4 100644
--- a/base/atomic_sequence_num.h
+++ b/base/atomic_sequence_num.h
@@ -7,8 +7,6 @@
#include <atomic>
-#include "base/macros.h"
-
namespace base {
// AtomicSequenceNumber is a thread safe increasing sequence number generator.
@@ -17,6 +15,8 @@
class AtomicSequenceNumber {
public:
constexpr AtomicSequenceNumber() = default;
+ AtomicSequenceNumber(const AtomicSequenceNumber&) = delete;
+ AtomicSequenceNumber& operator=(const AtomicSequenceNumber&) = delete;
// Returns an increasing sequence number starts from 0 for each call.
// This function can be called from any thread without data race.
@@ -24,8 +24,6 @@
private:
std::atomic_int seq_{0};
-
- DISALLOW_COPY_AND_ASSIGN(AtomicSequenceNumber);
};
} // namespace base
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc
index 36282ac1..7336240 100644
--- a/base/bind_unittest.cc
+++ b/base/bind_unittest.cc
@@ -10,7 +10,6 @@
#include <vector>
#include "base/callback.h"
-#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -35,6 +34,9 @@
class NoRef {
public:
NoRef() = default;
+ NoRef(const NoRef&) = delete;
+ // Particularly important in this test to ensure no copies are made.
+ NoRef& operator=(const NoRef&) = delete;
MOCK_METHOD0(VoidMethod0, void());
MOCK_CONST_METHOD0(VoidConstMethod0, void());
@@ -45,22 +47,18 @@
MOCK_METHOD1(VoidMethodWithIntArg, void(int));
MOCK_METHOD0(UniquePtrMethod0, std::unique_ptr<int>());
- private:
- // Particularly important in this test to ensure no copies are made.
- DISALLOW_COPY_AND_ASSIGN(NoRef);
};
class HasRef : public NoRef {
public:
HasRef() = default;
+ HasRef(const HasRef&) = delete;
+ // Particularly important in this test to ensure no copies are made.
+ HasRef& operator=(const HasRef&) = delete;
MOCK_CONST_METHOD0(AddRef, void());
MOCK_CONST_METHOD0(Release, bool());
MOCK_CONST_METHOD0(HasAtLeastOneRef, bool());
-
- private:
- // Particularly important in this test to ensure no copies are made.
- DISALLOW_COPY_AND_ASSIGN(HasRef);
};
class HasRefPrivateDtor : public HasRef {
@@ -326,7 +324,8 @@
const_no_ref_ptr_ = &no_ref_;
static_func_mock_ptr = &static_func_mock_;
}
-
+ BindTest(const BindTest&) = delete;
+ BindTest& operator=(const BindTest&) = delete;
~BindTest() override = default;
static void VoidFunc0() {
@@ -346,9 +345,6 @@
// Used by the static functions to perform expectations.
static StrictMock<NoRef>* static_func_mock_ptr;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BindTest);
};
StrictMock<NoRef>* BindTest::static_func_mock_ptr;
diff --git a/base/callback_helpers.h b/base/callback_helpers.h
index ad3fc32..2ed1011 100644
--- a/base/callback_helpers.h
+++ b/base/callback_helpers.h
@@ -10,6 +10,7 @@
#ifndef BASE_CALLBACK_HELPERS_H_
#define BASE_CALLBACK_HELPERS_H_
+#include <memory>
#include <type_traits>
#include <utility>
@@ -17,7 +18,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
-#include "base/macros.h"
#include "base/memory/ptr_util.h"
namespace base {
@@ -72,6 +72,10 @@
: callback_(std::move(callback)) {
DCHECK(callback_);
}
+ AdaptCallbackForRepeatingHelper(const AdaptCallbackForRepeatingHelper&) =
+ delete;
+ AdaptCallbackForRepeatingHelper& operator=(
+ const AdaptCallbackForRepeatingHelper&) = delete;
void Run(Args... args) {
if (subtle::NoBarrier_AtomicExchange(&has_run_, 1))
@@ -83,8 +87,6 @@
private:
volatile subtle::Atomic32 has_run_ = 0;
base::OnceCallback<void(Args...)> callback_;
-
- DISALLOW_COPY_AND_ASSIGN(AdaptCallbackForRepeatingHelper);
};
} // namespace internal
@@ -112,6 +114,8 @@
public:
ScopedClosureRunner();
explicit ScopedClosureRunner(OnceClosure closure);
+ ScopedClosureRunner(const ScopedClosureRunner&) = delete;
+ ScopedClosureRunner& operator=(const ScopedClosureRunner&) = delete;
~ScopedClosureRunner();
ScopedClosureRunner(ScopedClosureRunner&& other);
@@ -131,8 +135,6 @@
private:
OnceClosure closure_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
};
} // namespace base
diff --git a/base/callback_internal.h b/base/callback_internal.h
index fdfdf7f8..54add71 100644
--- a/base/callback_internal.h
+++ b/base/callback_internal.h
@@ -10,7 +10,6 @@
#include "base/base_export.h"
#include "base/callback_forward.h"
-#include "base/macros.h"
#include "base/memory/ref_counted.h"
namespace base {
@@ -61,6 +60,9 @@
using InvokeFuncStorage = void(*)();
+ BindStateBase(const BindStateBase&) = delete;
+ BindStateBase& operator=(const BindStateBase&) = delete;
+
private:
BindStateBase(InvokeFuncStorage polymorphic_invoke,
void (*destructor)(const BindStateBase*));
@@ -100,8 +102,6 @@
void (*destructor_)(const BindStateBase*);
bool (*query_cancellation_traits_)(const BindStateBase*,
CancellationQueryMode mode);
-
- DISALLOW_COPY_AND_ASSIGN(BindStateBase);
};
// Holds the Callback methods that don't require specialization to reduce
diff --git a/base/callback_list_unittest.nc b/base/callback_list_unittest.nc
index c6af89a..7a0e1c1e 100644
--- a/base/callback_list_unittest.nc
+++ b/base/callback_list_unittest.nc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/macros.h"
namespace base {
@@ -24,14 +23,13 @@
class FooListener {
public:
- FooListener() {}
+ FooListener() = default;
+ FooListener(const FooListener&) = delete;
+ FooListener& operator=(const FooListener&) = delete;
void GotAScopedFoo(std::unique_ptr<Foo> f) { foo_ = std::move(f); }
std::unique_ptr<Foo> foo_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(FooListener);
};
diff --git a/base/cancelable_callback.h b/base/cancelable_callback.h
index aafa6d75..c19e9a3 100644
--- a/base/cancelable_callback.h
+++ b/base/cancelable_callback.h
@@ -53,7 +53,6 @@
#include "base/callback_internal.h"
#include "base/check.h"
#include "base/compiler_specific.h"
-#include "base/macros.h"
#include "base/memory/weak_ptr.h"
namespace base {
@@ -62,7 +61,9 @@
template <typename CallbackType>
class CancelableCallbackImpl {
public:
- CancelableCallbackImpl() {}
+ CancelableCallbackImpl() = default;
+ CancelableCallbackImpl(const CancelableCallbackImpl&) = delete;
+ CancelableCallbackImpl& operator=(const CancelableCallbackImpl&) = delete;
// |callback| must not be null.
explicit CancelableCallbackImpl(CallbackType callback)
@@ -130,8 +131,6 @@
// The stored closure that may be cancelled.
CallbackType callback_;
mutable base::WeakPtrFactory<CancelableCallbackImpl> weak_ptr_factory_{this};
-
- DISALLOW_COPY_AND_ASSIGN(CancelableCallbackImpl);
};
} // namespace internal
diff --git a/base/cpu_affinity_posix_unittest.cc b/base/cpu_affinity_posix_unittest.cc
index 406ccae8..aa476d67 100644
--- a/base/cpu_affinity_posix_unittest.cc
+++ b/base/cpu_affinity_posix_unittest.cc
@@ -6,6 +6,8 @@
#include <sched.h>
+#include <string>
+
#include "base/synchronization/waitable_event.h"
#include "base/system/sys_info.h"
#include "base/threading/platform_thread.h"
@@ -24,6 +26,8 @@
WaitableEvent::InitialState::NOT_SIGNALED),
terminate_thread_(WaitableEvent::ResetPolicy::MANUAL,
WaitableEvent::InitialState::NOT_SIGNALED) {}
+ TestThread(const TestThread&) = delete;
+ TestThread& operator=(const TestThread&) = delete;
~TestThread() override {
EXPECT_TRUE(terminate_thread_.IsSignaled())
<< "Need to mark thread for termination and join the underlying thread "
@@ -66,8 +70,6 @@
mutable WaitableEvent termination_ready_;
WaitableEvent terminate_thread_;
bool done_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(TestThread);
};
} // namespace
diff --git a/base/critical_closure.h b/base/critical_closure.h
index 0eb6a3e..d47442d 100644
--- a/base/critical_closure.h
+++ b/base/critical_closure.h
@@ -8,7 +8,6 @@
#include <utility>
#include "base/callback.h"
-#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "build/build_config.h"
@@ -31,14 +30,14 @@
class CriticalClosure {
public:
explicit CriticalClosure(StringPiece task_name, OnceClosure closure);
+ CriticalClosure(const CriticalClosure&) = delete;
+ CriticalClosure& operator=(const CriticalClosure&) = delete;
~CriticalClosure();
void Run();
private:
ios::ScopedCriticalAction critical_action_;
OnceClosure closure_;
-
- DISALLOW_COPY_AND_ASSIGN(CriticalClosure);
};
#endif // defined(OS_IOS)
diff --git a/base/deferred_sequenced_task_runner.h b/base/deferred_sequenced_task_runner.h
index c5fb57b7..864b8d5 100644
--- a/base/deferred_sequenced_task_runner.h
+++ b/base/deferred_sequenced_task_runner.h
@@ -10,7 +10,6 @@
#include "base/base_export.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
-#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/synchronization/lock.h"
@@ -33,6 +32,9 @@
// Use this constructor when you don't have the target SequencedTaskRunner.
// When using this call StartWithTaskRunner().
DeferredSequencedTaskRunner();
+ DeferredSequencedTaskRunner(const DeferredSequencedTaskRunner&) = delete;
+ DeferredSequencedTaskRunner& operator=(const DeferredSequencedTaskRunner&) =
+ delete;
// TaskRunner implementation
bool PostDelayedTask(const Location& from_here,
@@ -87,8 +89,6 @@
bool started_ GUARDED_BY(lock_) = false;
scoped_refptr<SequencedTaskRunner> target_task_runner_ GUARDED_BY(lock_);
std::vector<DeferredTask> deferred_tasks_queue_ GUARDED_BY(lock_);
-
- DISALLOW_COPY_AND_ASSIGN(DeferredSequencedTaskRunner);
};
} // namespace base
diff --git a/base/feature_list.h b/base/feature_list.h
index 4618d02..4474b510 100644
--- a/base/feature_list.h
+++ b/base/feature_list.h
@@ -9,11 +9,11 @@
#include <map>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include "base/base_export.h"
#include "base/gtest_prod_util.h"
-#include "base/macros.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/persistent_memory_allocator.h"
#include "base/strings/string_piece.h"
@@ -99,6 +99,8 @@
class BASE_EXPORT FeatureList {
public:
FeatureList();
+ FeatureList(const FeatureList&) = delete;
+ FeatureList& operator=(const FeatureList&) = delete;
~FeatureList();
// Used by common test fixture classes to prevent abuse of ScopedFeatureList
@@ -106,14 +108,14 @@
class BASE_EXPORT ScopedDisallowOverrides {
public:
explicit ScopedDisallowOverrides(const char* reason);
+ ScopedDisallowOverrides(const ScopedDisallowOverrides&) = delete;
+ ScopedDisallowOverrides& operator=(const ScopedDisallowOverrides&) = delete;
~ScopedDisallowOverrides();
private:
#if DCHECK_IS_ON()
const char* const previous_reason_;
#endif
-
- DISALLOW_COPY_AND_ASSIGN(ScopedDisallowOverrides);
};
// Specifies whether a feature override enables or disables the feature.
@@ -370,8 +372,6 @@
// Whether this object has been initialized from command line.
bool initialized_from_command_line_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(FeatureList);
};
} // namespace base
diff --git a/base/feature_list_unittest.cc b/base/feature_list_unittest.cc
index 9aae7d0..86dcfc0 100644
--- a/base/feature_list_unittest.cc
+++ b/base/feature_list_unittest.cc
@@ -51,12 +51,12 @@
// Provide an empty FeatureList to each test by default.
scoped_feature_list_.InitWithFeatureList(std::make_unique<FeatureList>());
}
+ FeatureListTest(const FeatureListTest&) = delete;
+ FeatureListTest& operator=(const FeatureListTest&) = delete;
~FeatureListTest() override = default;
private:
test::ScopedFeatureList scoped_feature_list_;
-
- DISALLOW_COPY_AND_ASSIGN(FeatureListTest);
};
TEST_F(FeatureListTest, DefaultStates) {
diff --git a/base/file_descriptor_store.h b/base/file_descriptor_store.h
index b6bd079..f22e124 100644
--- a/base/file_descriptor_store.h
+++ b/base/file_descriptor_store.h
@@ -10,7 +10,6 @@
#include "base/files/memory_mapped_file.h"
#include "base/files/scoped_file.h"
-#include "base/macros.h"
namespace base {
@@ -19,6 +18,8 @@
// It is used to share file descriptors from a process to its child.
class BASE_EXPORT FileDescriptorStore {
public:
+ FileDescriptorStore(const FileDescriptorStore&) = delete;
+ FileDescriptorStore& operator=(const FileDescriptorStore&) = delete;
struct Descriptor {
Descriptor(const std::string& key, base::ScopedFD fd);
Descriptor(const std::string& key,
@@ -64,8 +65,6 @@
~FileDescriptorStore();
Mapping descriptors_;
-
- DISALLOW_COPY_AND_ASSIGN(FileDescriptorStore);
};
} // namespace base
diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h
index cd10a9c..0ac2b41 100644
--- a/base/file_version_info_mac.h
+++ b/base/file_version_info_mac.h
@@ -10,13 +10,14 @@
#include "base/file_version_info.h"
#include "base/mac/scoped_nsobject.h"
-#include "base/macros.h"
@class NSBundle;
class FileVersionInfoMac : public FileVersionInfo {
public:
explicit FileVersionInfoMac(NSBundle *bundle);
+ FileVersionInfoMac(const FileVersionInfoMac&) = delete;
+ FileVersionInfoMac& operator=(const FileVersionInfoMac&) = delete;
~FileVersionInfoMac() override;
// Accessors to the different version properties.
@@ -38,8 +39,6 @@
base::string16 GetString16Value(CFStringRef name);
base::scoped_nsobject<NSBundle> bundle_;
-
- DISALLOW_COPY_AND_ASSIGN(FileVersionInfoMac);
};
#endif // BASE_FILE_VERSION_INFO_MAC_H_
diff --git a/base/file_version_info_win.h b/base/file_version_info_win.h
index f0dbde8..7fd4d20 100644
--- a/base/file_version_info_win.h
+++ b/base/file_version_info_win.h
@@ -15,7 +15,6 @@
#include "base/base_export.h"
#include "base/file_version_info.h"
-#include "base/macros.h"
#include "base/version.h"
struct tagVS_FIXEDFILEINFO;
@@ -23,6 +22,8 @@
class BASE_EXPORT FileVersionInfoWin : public FileVersionInfo {
public:
+ FileVersionInfoWin(const FileVersionInfoWin&) = delete;
+ FileVersionInfoWin& operator=(const FileVersionInfoWin&) = delete;
~FileVersionInfoWin() override;
// Accessors to the different version properties.
@@ -70,8 +71,6 @@
// This is a reference for a portion of |data_|.
const VS_FIXEDFILEINFO& fixed_file_info_;
-
- DISALLOW_COPY_AND_ASSIGN(FileVersionInfoWin);
};
#endif // BASE_FILE_VERSION_INFO_WIN_H_
diff --git a/base/file_version_info_win_unittest.cc b/base/file_version_info_win_unittest.cc
index 4886896..dea983b 100644
--- a/base/file_version_info_win_unittest.cc
+++ b/base/file_version_info_win_unittest.cc
@@ -12,7 +12,6 @@
#include "base/file_version_info.h"
#include "base/files/file_path.h"
-#include "base/macros.h"
#include "base/path_service.h"
#include "base/scoped_native_library.h"
#include "base/strings/string_util.h"
@@ -35,6 +34,8 @@
class FileVersionInfoFactory {
public:
explicit FileVersionInfoFactory(const FilePath& path) : path_(path) {}
+ FileVersionInfoFactory(const FileVersionInfoFactory&) = delete;
+ FileVersionInfoFactory& operator=(const FileVersionInfoFactory&) = delete;
std::unique_ptr<FileVersionInfo> Create() const {
return FileVersionInfo::CreateFileVersionInfo(path_);
@@ -42,8 +43,6 @@
private:
const FilePath path_;
-
- DISALLOW_COPY_AND_ASSIGN(FileVersionInfoFactory);
};
class FileVersionInfoForModuleFactory {
@@ -56,6 +55,10 @@
LOAD_LIBRARY_AS_IMAGE_RESOURCE)) {
EXPECT_TRUE(library_.is_valid());
}
+ FileVersionInfoForModuleFactory(const FileVersionInfoForModuleFactory&) =
+ delete;
+ FileVersionInfoForModuleFactory& operator=(
+ const FileVersionInfoForModuleFactory&) = delete;
std::unique_ptr<FileVersionInfo> Create() const {
return FileVersionInfo::CreateFileVersionInfoForModule(library_.get());
@@ -63,8 +66,6 @@
private:
const base::ScopedNativeLibrary library_;
-
- DISALLOW_COPY_AND_ASSIGN(FileVersionInfoForModuleFactory);
};
template <typename T>
diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc
index ad1f0eb..bc990b0 100644
--- a/base/lazy_instance_unittest.cc
+++ b/base/lazy_instance_unittest.cc
@@ -32,12 +32,12 @@
ConstructAndDestructLogger() {
constructed_seq_.GetNext();
}
+ ConstructAndDestructLogger(const ConstructAndDestructLogger&) = delete;
+ ConstructAndDestructLogger& operator=(const ConstructAndDestructLogger&) =
+ delete;
~ConstructAndDestructLogger() {
destructed_seq_.GetNext();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ConstructAndDestructLogger);
};
class SlowConstructor {
@@ -48,13 +48,13 @@
++constructed;
some_int_ = 12;
}
+ SlowConstructor(const SlowConstructor&) = delete;
+ SlowConstructor& operator=(const SlowConstructor&) = delete;
int some_int() const { return some_int_; }
static int constructed;
private:
int some_int_;
-
- DISALLOW_COPY_AND_ASSIGN(SlowConstructor);
};
// static
@@ -65,6 +65,8 @@
explicit SlowDelegate(
base::LazyInstance<SlowConstructor>::DestructorAtExit* lazy)
: lazy_(lazy) {}
+ SlowDelegate(const SlowDelegate&) = delete;
+ SlowDelegate& operator=(const SlowDelegate&) = delete;
void Run() override {
EXPECT_EQ(12, lazy_->Get().some_int());
@@ -73,8 +75,6 @@
private:
base::LazyInstance<SlowConstructor>::DestructorAtExit* lazy_;
-
- DISALLOW_COPY_AND_ASSIGN(SlowDelegate);
};
} // namespace
@@ -212,7 +212,8 @@
base::PlatformThread::YieldCurrentThread();
done_construction_ = true;
}
-
+ BlockingConstructor(const BlockingConstructor&) = delete;
+ BlockingConstructor& operator=(const BlockingConstructor&) = delete;
~BlockingConstructor() {
// Restore static state for the next test.
base::subtle::NoBarrier_Store(&constructor_called_, 0);
@@ -229,7 +230,7 @@
base::subtle::NoBarrier_Store(&complete_construction_, 1);
}
- bool done_construction() { return done_construction_; }
+ bool done_construction() const { return done_construction_; }
private:
// Use Atomic32 instead of AtomicFlag for them to be trivially initialized.
@@ -237,8 +238,6 @@
static base::subtle::Atomic32 complete_construction_;
bool done_construction_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(BlockingConstructor);
};
// A SimpleThread running at |thread_priority| which invokes |before_get|
@@ -252,6 +251,9 @@
: SimpleThread("BlockingConstructorThread", Options(thread_priority)),
lazy_(lazy),
before_get_(std::move(before_get)) {}
+ BlockingConstructorThread(const BlockingConstructorThread&) = delete;
+ BlockingConstructorThread& operator=(const BlockingConstructorThread&) =
+ delete;
void Run() override {
if (before_get_)
@@ -262,8 +264,6 @@
private:
base::LazyInstance<BlockingConstructor>::DestructorAtExit* lazy_;
base::OnceClosure before_get_;
-
- DISALLOW_COPY_AND_ASSIGN(BlockingConstructorThread);
};
// static
diff --git a/base/logging.cc b/base/logging.cc
index 3ced75a20..2696c0e 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -18,6 +18,8 @@
#include <limits.h>
#include <stdint.h>
+#include <vector>
+
#include "base/pending_task.h"
#include "base/stl_util.h"
#include "base/task/common/task_annotator.h"
@@ -635,26 +637,28 @@
public:
explicit ASLClient(const std::string& facility)
: client_(asl_open(nullptr, facility.c_str(), ASL_OPT_NO_DELAY)) {}
+ ASLClient(const ASLClient&) = delete;
+ ASLClient& operator=(const ASLClient&) = delete;
~ASLClient() { asl_close(client_); }
aslclient get() const { return client_; }
private:
aslclient client_;
- DISALLOW_COPY_AND_ASSIGN(ASLClient);
} asl_client(main_bundle_id.empty() ? main_bundle_id
: "com.apple.console");
const class ASLMessage {
public:
ASLMessage() : message_(asl_new(ASL_TYPE_MSG)) {}
+ ASLMessage(const ASLMessage&) = delete;
+ ASLMessage& operator=(const ASLMessage&) = delete;
~ASLMessage() { asl_free(message_); }
aslmsg get() const { return message_; }
private:
aslmsg message_;
- DISALLOW_COPY_AND_ASSIGN(ASLMessage);
} asl_message;
// By default, messages are only readable by the admin group. Explicitly
@@ -697,6 +701,8 @@
explicit OSLog(const char* subsystem)
: os_log_(subsystem ? os_log_create(subsystem, "chromium_logging")
: OS_LOG_DEFAULT) {}
+ OSLog(const OSLog&) = delete;
+ OSLog& operator=(const OSLog&) = delete;
~OSLog() {
if (os_log_ != OS_LOG_DEFAULT) {
os_release(os_log_);
@@ -706,7 +712,6 @@
private:
os_log_t os_log_;
- DISALLOW_COPY_AND_ASSIGN(OSLog);
} log(main_bundle_id.empty() ? nullptr : main_bundle_id.c_str());
const os_log_type_t os_log_type = [](LogSeverity severity) {
switch (severity) {
diff --git a/base/logging.h b/base/logging.h
index cbf6da4..9e06ae9 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -16,7 +16,6 @@
#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/dcheck_is_on.h"
-#include "base/macros.h"
#include "base/scoped_clear_last_error.h"
#include "base/strings/string_piece_forward.h"
@@ -336,10 +335,9 @@
class BASE_EXPORT ScopedLogAssertHandler {
public:
explicit ScopedLogAssertHandler(LogAssertHandlerFunction handler);
+ ScopedLogAssertHandler(const ScopedLogAssertHandler&) = delete;
+ ScopedLogAssertHandler& operator=(const ScopedLogAssertHandler&) = delete;
~ScopedLogAssertHandler();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ScopedLogAssertHandler);
};
// Sets the Log Message Handler that gets passed every log message before
@@ -580,7 +578,8 @@
// Used for CHECK(). Implied severity = LOG_FATAL.
LogMessage(const char* file, int line, const char* condition);
-
+ LogMessage(const LogMessage&) = delete;
+ LogMessage& operator=(const LogMessage&) = delete;
virtual ~LogMessage();
std::ostream& stream() { return stream_; }
@@ -616,8 +615,6 @@
bool enable_timestamp,
bool enable_tickcount);
#endif
-
- DISALLOW_COPY_AND_ASSIGN(LogMessage);
};
// This class is used to explicitly ignore values in the conditional
@@ -650,14 +647,13 @@
int line,
LogSeverity severity,
SystemErrorCode err);
-
+ Win32ErrorLogMessage(const Win32ErrorLogMessage&) = delete;
+ Win32ErrorLogMessage& operator=(const Win32ErrorLogMessage&) = delete;
// Appends the error message before destructing the encapsulated class.
~Win32ErrorLogMessage() override;
private:
SystemErrorCode err_;
-
- DISALLOW_COPY_AND_ASSIGN(Win32ErrorLogMessage);
};
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
// Appends a formatted system message of the errno type
@@ -667,14 +663,13 @@
int line,
LogSeverity severity,
SystemErrorCode err);
-
+ ErrnoLogMessage(const ErrnoLogMessage&) = delete;
+ ErrnoLogMessage& operator=(const ErrnoLogMessage&) = delete;
// Appends the error message before destructing the encapsulated class.
~ErrnoLogMessage() override;
private:
SystemErrorCode err_;
-
- DISALLOW_COPY_AND_ASSIGN(ErrnoLogMessage);
};
#endif // OS_WIN
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
index b11ce9d..389f1ef 100644
--- a/base/logging_unittest.cc
+++ b/base/logging_unittest.cc
@@ -10,7 +10,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "base/no_destructor.h"
#include "base/run_loop.h"
#include "base/sanitizer_buildflags.h"
@@ -719,6 +718,8 @@
: public fuchsia::logger::testing::LogListenerSafe_TestBase {
public:
TestLogListenerSafe() = default;
+ TestLogListenerSafe(const TestLogListenerSafe&) = delete;
+ TestLogListenerSafe& operator=(const TestLogListenerSafe&) = delete;
~TestLogListenerSafe() override = default;
void set_on_dump_logs_done(base::OnceClosure on_dump_logs_done) {
@@ -755,8 +756,6 @@
fuchsia::logger::LogListenerSafePtr log_listener_;
std::vector<fuchsia::logger::LogMessage> log_messages_;
base::OnceClosure on_dump_logs_done_;
-
- DISALLOW_COPY_AND_ASSIGN(TestLogListenerSafe);
};
// Verifies that calling the log macro goes to the Fuchsia system logs.
diff --git a/base/logging_win.h b/base/logging_win.h
index cdde7bb..8aca72b9 100644
--- a/base/logging_win.h
+++ b/base/logging_win.h
@@ -11,7 +11,6 @@
#include "base/base_export.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "base/win/event_trace_provider.h"
namespace base {
@@ -55,6 +54,8 @@
// with Event Tracing for Windows.
class BASE_EXPORT LogEventProvider : public base::win::EtwTraceProvider {
public:
+ LogEventProvider(const LogEventProvider&) = delete;
+ LogEventProvider& operator=(const LogEventProvider&) = delete;
static LogEventProvider* GetInstance();
static bool LogMessage(logging::LogSeverity severity, const char* file,
@@ -76,7 +77,6 @@
logging::LogSeverity old_log_level_;
friend struct base::StaticMemorySingletonTraits<LogEventProvider>;
- DISALLOW_COPY_AND_ASSIGN(LogEventProvider);
};
} // namespace logging
diff --git a/base/native_library_unittest.cc b/base/native_library_unittest.cc
index 623f636..3933202d 100644
--- a/base/native_library_unittest.cc
+++ b/base/native_library_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/files/file_path.h"
-#include "base/macros.h"
#include "base/native_library.h"
#include "base/path_service.h"
#include "base/test/native_library_test_utils.h"
@@ -88,7 +87,8 @@
exe_path.AppendASCII(kTestLibraryName), options, nullptr);
CHECK(library_);
}
-
+ TestLibrary(const TestLibrary&) = delete;
+ TestLibrary& operator=(const TestLibrary&) = delete;
~TestLibrary() {
UnloadNativeLibrary(library_);
}
@@ -101,8 +101,6 @@
private:
NativeLibrary library_;
-
- DISALLOW_COPY_AND_ASSIGN(TestLibrary);
};
// NativeLibraaryTest.LoadLibrary is failing on M tablets only.
diff --git a/base/no_destructor_unittest.cc b/base/no_destructor_unittest.cc
index 63d5c13..54ac1b53 100644
--- a/base/no_destructor_unittest.cc
+++ b/base/no_destructor_unittest.cc
@@ -4,8 +4,10 @@
#include "base/no_destructor.h"
+#include <memory>
#include <string>
#include <utility>
+#include <vector>
#include "base/atomicops.h"
#include "base/barrier_closure.h"
@@ -93,7 +95,8 @@
PlatformThread::YieldCurrentThread();
done_construction_ = true;
}
-
+ BlockingConstructor(const BlockingConstructor&) = delete;
+ BlockingConstructor& operator=(const BlockingConstructor&) = delete;
~BlockingConstructor() = delete;
// Returns true if BlockingConstructor() was entered.
@@ -106,7 +109,7 @@
subtle::NoBarrier_Store(&complete_construction_, 1);
}
- bool done_construction() { return done_construction_; }
+ bool done_construction() const { return done_construction_; }
private:
// Use Atomic32 instead of AtomicFlag for them to be trivially initialized.
@@ -114,8 +117,6 @@
static subtle::Atomic32 complete_construction_;
bool done_construction_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(BlockingConstructor);
};
// static
@@ -132,6 +133,9 @@
OnceClosure before_get)
: SimpleThread("BlockingConstructorThread", Options(thread_priority)),
before_get_(std::move(before_get)) {}
+ BlockingConstructorThread(const BlockingConstructorThread&) = delete;
+ BlockingConstructorThread& operator=(const BlockingConstructorThread&) =
+ delete;
void Run() override {
if (before_get_)
@@ -143,8 +147,6 @@
private:
OnceClosure before_get_;
-
- DISALLOW_COPY_AND_ASSIGN(BlockingConstructorThread);
};
} // namespace
diff --git a/base/observer_list.h b/base/observer_list.h
index 52c8fad0..28369a25 100644
--- a/base/observer_list.h
+++ b/base/observer_list.h
@@ -15,7 +15,6 @@
#include "base/check_op.h"
#include "base/gtest_prod_util.h"
-#include "base/macros.h"
#include "base/notreached.h"
#include "base/observer_list_internal.h"
#include "base/sequence_checker.h"
@@ -247,7 +246,8 @@
// Sequence checks only apply when iterators are live.
DETACH_FROM_SEQUENCE(iteration_sequence_checker_);
}
-
+ ObserverList(const ObserverList&) = delete;
+ ObserverList& operator=(const ObserverList&) = delete;
~ObserverList() {
// If there are live iterators, ensure destruction is thread-safe.
if (!live_iterators_.empty())
@@ -337,8 +337,6 @@
const ObserverListPolicy policy_;
SEQUENCE_CHECKER(iteration_sequence_checker_);
-
- DISALLOW_COPY_AND_ASSIGN(ObserverList);
};
template <class ObserverType, bool check_empty = false>