Commit b4b441e8 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

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: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809700}
parent 8af49901
......@@ -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 @@ class BASE_EXPORT AtExitManager {
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 @@ class BASE_EXPORT AtExitManager {
// Stack of managers to allow shadowing.
AtExitManager* const next_manager_;
DISALLOW_COPY_AND_ASSIGN(AtExitManager);
};
#if defined(UNIT_TEST)
......
......@@ -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 @@ namespace base {
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 @@ class AtomicSequenceNumber {
private:
std::atomic_int seq_{0};
DISALLOW_COPY_AND_ASSIGN(AtomicSequenceNumber);
};
} // namespace base
......
......@@ -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 IncompleteType;
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 @@ class NoRef {
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 @@ class BindTest : public ::testing::Test {
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 @@ class BindTest : public ::testing::Test {
// 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;
......
......@@ -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 @@ class AdaptCallbackForRepeatingHelper final {
: 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 @@ class AdaptCallbackForRepeatingHelper final {
private:
volatile subtle::Atomic32 has_run_ = 0;
base::OnceCallback<void(Args...)> callback_;
DISALLOW_COPY_AND_ASSIGN(AdaptCallbackForRepeatingHelper);
};
} // namespace internal
......@@ -112,6 +114,8 @@ class BASE_EXPORT ScopedClosureRunner {
public:
ScopedClosureRunner();
explicit ScopedClosureRunner(OnceClosure closure);
ScopedClosureRunner(const ScopedClosureRunner&) = delete;
ScopedClosureRunner& operator=(const ScopedClosureRunner&) = delete;
~ScopedClosureRunner();
ScopedClosureRunner(ScopedClosureRunner&& other);
......@@ -131,8 +135,6 @@ class BASE_EXPORT ScopedClosureRunner {
private:
OnceClosure closure_;
DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
};
} // namespace base
......
......@@ -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 @@ class BASE_EXPORT BindStateBase
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 @@ class BASE_EXPORT BindStateBase
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
......
......@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/macros.h"
namespace base {
......@@ -24,14 +23,13 @@ class Foo {
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);
};
......
......@@ -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 @@ namespace internal {
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 @@ class CancelableCallbackImpl {
// The stored closure that may be cancelled.
CallbackType callback_;
mutable base::WeakPtrFactory<CancelableCallbackImpl> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(CancelableCallbackImpl);
};
} // namespace internal
......
......@@ -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 @@ class TestThread : public PlatformThread::Delegate {
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 @@ class TestThread : public PlatformThread::Delegate {
mutable WaitableEvent termination_ready_;
WaitableEvent terminate_thread_;
bool done_ = false;
DISALLOW_COPY_AND_ASSIGN(TestThread);
};
} // namespace
......
......@@ -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 @@ bool IsMultiTaskingSupported();
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)
......
......@@ -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 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
// 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 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
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
......
......@@ -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 @@ extern BASE_EXPORT const Feature kDCheckIsFatalFeature;
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 FeatureList {
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 @@ class BASE_EXPORT FeatureList {
// Whether this object has been initialized from command line.
bool initialized_from_command_line_ = false;
DISALLOW_COPY_AND_ASSIGN(FeatureList);
};
} // namespace base
......
......@@ -51,12 +51,12 @@ class FeatureListTest : public testing::Test {
// 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) {
......
......@@ -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 @@ namespace base {
// 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 @@ class BASE_EXPORT FileDescriptorStore {
~FileDescriptorStore();
Mapping descriptors_;
DISALLOW_COPY_AND_ASSIGN(FileDescriptorStore);
};
} // namespace base
......
......@@ -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 @@ class FileVersionInfoMac : public FileVersionInfo {
base::string16 GetString16Value(CFStringRef name);
base::scoped_nsobject<NSBundle> bundle_;
DISALLOW_COPY_AND_ASSIGN(FileVersionInfoMac);
};
#endif // BASE_FILE_VERSION_INFO_MAC_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 @@ typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
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 @@ class BASE_EXPORT FileVersionInfoWin : public FileVersionInfo {
// 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_
......@@ -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 @@ FilePath GetTestDataPath() {
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 @@ class FileVersionInfoFactory {
private:
const FilePath path_;
DISALLOW_COPY_AND_ASSIGN(FileVersionInfoFactory);
};
class FileVersionInfoForModuleFactory {
......@@ -56,6 +55,10 @@ class FileVersionInfoForModuleFactory {
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 @@ class FileVersionInfoForModuleFactory {
private:
const base::ScopedNativeLibrary library_;
DISALLOW_COPY_AND_ASSIGN(FileVersionInfoForModuleFactory);
};
template <typename T>
......
......@@ -32,12 +32,12 @@ class ConstructAndDestructLogger {
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 @@ class SlowConstructor {
++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 @@ class SlowDelegate : public base::DelegateSimpleThread::Delegate {
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 @@ class SlowDelegate : public base::DelegateSimpleThread::Delegate {
private:
base::LazyInstance<SlowConstructor>::DestructorAtExit* lazy_;
DISALLOW_COPY_AND_ASSIGN(SlowDelegate);
};
} // namespace
......@@ -212,7 +212,8 @@ class BlockingConstructor {
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 @@ class BlockingConstructor {
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 @@ class BlockingConstructor {
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 @@ class BlockingConstructorThread : public base::SimpleThread {
: 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 @@ class BlockingConstructorThread : public base::SimpleThread {
private:
base::LazyInstance<BlockingConstructor>::DestructorAtExit* lazy_;
base::OnceClosure before_get_;
DISALLOW_COPY_AND_ASSIGN(BlockingConstructorThread);
};
// static
......
......@@ -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 @@ LogMessage::~LogMessage() {
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 @@ LogMessage::~LogMessage() {
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 @@ LogMessage::~LogMessage() {
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) {
......
......@@ -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 @@ using LogAssertHandlerFunction =
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 @@ class BASE_EXPORT LogMessage {
// 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 @@ class BASE_EXPORT LogMessage {
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 @@ class BASE_EXPORT Win32ErrorLogMessage : public LogMessage {
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 @@ class BASE_EXPORT ErrnoLogMessage : public LogMessage {
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
......
......@@ -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 @@ class TestLogListenerSafe
: 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 @@ class TestLogListenerSafe
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.
......
......@@ -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 @@ enum LogMessageTypes {
// 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 @@ class BASE_EXPORT LogEventProvider : public base::win::EtwTraceProvider {
logging::LogSeverity old_log_level_;
friend struct base::StaticMemorySingletonTraits<LogEventProvider>;
DISALLOW_COPY_AND_ASSIGN(LogEventProvider);
};
} // namespace logging
......
......@@ -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 @@ class TestLibrary {
exe_path.AppendASCII(kTestLibraryName), options, nullptr);
CHECK(library_);
}
TestLibrary(const TestLibrary&) = delete;
TestLibrary& operator=(const TestLibrary&) = delete;
~TestLibrary() {
UnloadNativeLibrary(library_);
}
......@@ -101,8 +101,6 @@ class TestLibrary {
private:
NativeLibrary library_;
DISALLOW_COPY_AND_ASSIGN(TestLibrary);
};
// NativeLibraaryTest.LoadLibrary is failing on M tablets only.
......
......@@ -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 @@ class BlockingConstructor {
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 @@ class BlockingConstructor {
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 @@ class BlockingConstructor {
static subtle::Atomic32 complete_construction_;
bool done_construction_ = false;
DISALLOW_COPY_AND_ASSIGN(BlockingConstructor);
};
// static
......@@ -132,6 +133,9 @@ class BlockingConstructorThread : public SimpleThread {
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 @@ class BlockingConstructorThread : public SimpleThread {
private:
OnceClosure before_get_;
DISALLOW_COPY_AND_ASSIGN(BlockingConstructorThread);
};
} // namespace
......
......@@ -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 @@ class ObserverList {
// 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 @@ class ObserverList {
const ObserverListPolicy policy_;
SEQUENCE_CHECKER(iteration_sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(ObserverList);
};
template <class ObserverType, bool check_empty = false>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment