Commit 5f4d4f03 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Remove DISALLOW_COPY_AND_ASSIGN from base/*

Also fix cpp lint warnings. No functional changes.

Bug: 1010217
Change-Id: I60c13a4f4667522c7661b3ab91b948e71a06e657
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432204
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811059}
parent 6a6360f4
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/base_export.h" #include "base/base_export.h"
#include "base/check_op.h" #include "base/check_op.h"
#include "base/containers/linked_list.h" #include "base/containers/linked_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list_types.h" #include "base/observer_list_types.h"
...@@ -20,6 +19,8 @@ class BASE_EXPORT UncheckedObserverAdapter { ...@@ -20,6 +19,8 @@ class BASE_EXPORT UncheckedObserverAdapter {
public: public:
explicit UncheckedObserverAdapter(const void* observer) explicit UncheckedObserverAdapter(const void* observer)
: ptr_(const_cast<void*>(observer)) {} : ptr_(const_cast<void*>(observer)) {}
UncheckedObserverAdapter(const UncheckedObserverAdapter&) = delete;
UncheckedObserverAdapter& operator=(const UncheckedObserverAdapter&) = delete;
UncheckedObserverAdapter(UncheckedObserverAdapter&& other) = default; UncheckedObserverAdapter(UncheckedObserverAdapter&& other) = default;
UncheckedObserverAdapter& operator=(UncheckedObserverAdapter&& other) = UncheckedObserverAdapter& operator=(UncheckedObserverAdapter&& other) =
default; default;
...@@ -39,8 +40,6 @@ class BASE_EXPORT UncheckedObserverAdapter { ...@@ -39,8 +40,6 @@ class BASE_EXPORT UncheckedObserverAdapter {
private: private:
void* ptr_; void* ptr_;
DISALLOW_COPY_AND_ASSIGN(UncheckedObserverAdapter);
}; };
// Adapter for CheckedObserver types so that they can use the same syntax as a // Adapter for CheckedObserver types so that they can use the same syntax as a
...@@ -56,6 +55,8 @@ class BASE_EXPORT CheckedObserverAdapter { ...@@ -56,6 +55,8 @@ class BASE_EXPORT CheckedObserverAdapter {
// types. // types.
CheckedObserverAdapter(CheckedObserverAdapter&& other); CheckedObserverAdapter(CheckedObserverAdapter&& other);
CheckedObserverAdapter& operator=(CheckedObserverAdapter&& other); CheckedObserverAdapter& operator=(CheckedObserverAdapter&& other);
CheckedObserverAdapter(const CheckedObserverAdapter&) = delete;
CheckedObserverAdapter& operator=(const CheckedObserverAdapter&) = delete;
~CheckedObserverAdapter(); ~CheckedObserverAdapter();
void MarkForRemoval() { void MarkForRemoval() {
...@@ -92,8 +93,6 @@ class BASE_EXPORT CheckedObserverAdapter { ...@@ -92,8 +93,6 @@ class BASE_EXPORT CheckedObserverAdapter {
private: private:
WeakPtr<CheckedObserver> weak_ptr_; WeakPtr<CheckedObserver> weak_ptr_;
DISALLOW_COPY_AND_ASSIGN(CheckedObserverAdapter);
}; };
// Wraps a pointer in a stack-allocated, base::LinkNode. The node is // Wraps a pointer in a stack-allocated, base::LinkNode. The node is
...@@ -106,6 +105,8 @@ class WeakLinkNode : public base::LinkNode<WeakLinkNode<ObserverList>> { ...@@ -106,6 +105,8 @@ class WeakLinkNode : public base::LinkNode<WeakLinkNode<ObserverList>> {
public: public:
WeakLinkNode() = default; WeakLinkNode() = default;
explicit WeakLinkNode(ObserverList* list) { SetList(list); } explicit WeakLinkNode(ObserverList* list) { SetList(list); }
WeakLinkNode(const WeakLinkNode&) = delete;
WeakLinkNode& operator=(const WeakLinkNode&) = delete;
~WeakLinkNode() { Invalidate(); } ~WeakLinkNode() { Invalidate(); }
...@@ -138,8 +139,6 @@ class WeakLinkNode : public base::LinkNode<WeakLinkNode<ObserverList>> { ...@@ -138,8 +139,6 @@ class WeakLinkNode : public base::LinkNode<WeakLinkNode<ObserverList>> {
private: private:
ObserverList* list_ = nullptr; ObserverList* list_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(WeakLinkNode);
}; };
} // namespace internal } // namespace internal
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <memory> #include <memory>
#include "base/check_op.h" #include "base/check_op.h"
#include "base/observer_list.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -34,12 +33,11 @@ perf_test::PerfResultReporter SetUpReporter(const std::string& story_name) { ...@@ -34,12 +33,11 @@ perf_test::PerfResultReporter SetUpReporter(const std::string& story_name) {
class ObserverInterface { class ObserverInterface {
public: public:
ObserverInterface() {} ObserverInterface() = default;
virtual ~ObserverInterface() {} ObserverInterface(const ObserverInterface&) = delete;
ObserverInterface& operator=(const ObserverInterface&) = delete;
virtual ~ObserverInterface() = default;
virtual void Observe() const { ++g_observer_list_perf_test_counter; } virtual void Observe() const { ++g_observer_list_perf_test_counter; }
private:
DISALLOW_COPY_AND_ASSIGN(ObserverInterface);
}; };
class UnsafeObserver : public ObserverInterface {}; class UnsafeObserver : public ObserverInterface {};
...@@ -64,10 +62,9 @@ class ObserverListPerfTest : public ::testing::Test { ...@@ -64,10 +62,9 @@ class ObserverListPerfTest : public ::testing::Test {
public: public:
using ObserverListType = typename Pick<ObserverType>::ObserverListType; using ObserverListType = typename Pick<ObserverType>::ObserverListType;
ObserverListPerfTest() {} ObserverListPerfTest() = default;
ObserverListPerfTest(const ObserverListPerfTest&) = delete;
private: ObserverListPerfTest& operator=(const ObserverListPerfTest&) = delete;
DISALLOW_COPY_AND_ASSIGN(ObserverListPerfTest);
}; };
typedef ::testing::Types<UnsafeObserver, TestCheckedObserver> ObserverTypes; typedef ::testing::Types<UnsafeObserver, TestCheckedObserver> ObserverTypes;
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include <vector>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/check_op.h" #include "base/check_op.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/location.h" #include "base/location.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
...@@ -55,6 +55,9 @@ class BASE_EXPORT ObserverListThreadSafeBase ...@@ -55,6 +55,9 @@ class BASE_EXPORT ObserverListThreadSafeBase
: public RefCountedThreadSafe<ObserverListThreadSafeBase> { : public RefCountedThreadSafe<ObserverListThreadSafeBase> {
public: public:
ObserverListThreadSafeBase() = default; ObserverListThreadSafeBase() = default;
ObserverListThreadSafeBase(const ObserverListThreadSafeBase&) = delete;
ObserverListThreadSafeBase& operator=(const ObserverListThreadSafeBase&) =
delete;
protected: protected:
template <typename ObserverType, typename Method> template <typename ObserverType, typename Method>
...@@ -84,8 +87,6 @@ class BASE_EXPORT ObserverListThreadSafeBase ...@@ -84,8 +87,6 @@ class BASE_EXPORT ObserverListThreadSafeBase
private: private:
friend class RefCountedThreadSafe<ObserverListThreadSafeBase>; friend class RefCountedThreadSafe<ObserverListThreadSafeBase>;
DISALLOW_COPY_AND_ASSIGN(ObserverListThreadSafeBase);
}; };
} // namespace internal } // namespace internal
...@@ -96,6 +97,8 @@ class ObserverListThreadSafe : public internal::ObserverListThreadSafeBase { ...@@ -96,6 +97,8 @@ class ObserverListThreadSafe : public internal::ObserverListThreadSafeBase {
ObserverListThreadSafe() = default; ObserverListThreadSafe() = default;
explicit ObserverListThreadSafe(ObserverListPolicy policy) explicit ObserverListThreadSafe(ObserverListPolicy policy)
: policy_(policy) {} : policy_(policy) {}
ObserverListThreadSafe(const ObserverListThreadSafe&) = delete;
ObserverListThreadSafe& operator=(const ObserverListThreadSafe&) = delete;
// Adds |observer| to the list. |observer| must not already be in the list. // Adds |observer| to the list. |observer| must not already be in the list.
void AddObserver(ObserverType* observer) { void AddObserver(ObserverType* observer) {
...@@ -260,8 +263,6 @@ class ObserverListThreadSafe : public internal::ObserverListThreadSafeBase { ...@@ -260,8 +263,6 @@ class ObserverListThreadSafe : public internal::ObserverListThreadSafeBase {
// be notified. // be notified.
std::unordered_map<ObserverType*, scoped_refptr<SequencedTaskRunner>> std::unordered_map<ObserverType*, scoped_refptr<SequencedTaskRunner>>
observers_ GUARDED_BY(lock_); observers_ GUARDED_BY(lock_);
DISALLOW_COPY_AND_ASSIGN(ObserverListThreadSafe);
}; };
} // namespace base } // namespace base
......
...@@ -304,6 +304,9 @@ class SequenceVerificationObserver : public Foo { ...@@ -304,6 +304,9 @@ class SequenceVerificationObserver : public Foo {
explicit SequenceVerificationObserver( explicit SequenceVerificationObserver(
scoped_refptr<SequencedTaskRunner> task_runner) scoped_refptr<SequencedTaskRunner> task_runner)
: task_runner_(std::move(task_runner)) {} : task_runner_(std::move(task_runner)) {}
SequenceVerificationObserver(const SequenceVerificationObserver&) = delete;
SequenceVerificationObserver& operator=(const SequenceVerificationObserver&) =
delete;
~SequenceVerificationObserver() override = default; ~SequenceVerificationObserver() override = default;
void Observe(int x) override { void Observe(int x) override {
...@@ -315,8 +318,6 @@ class SequenceVerificationObserver : public Foo { ...@@ -315,8 +318,6 @@ class SequenceVerificationObserver : public Foo {
private: private:
const scoped_refptr<SequencedTaskRunner> task_runner_; const scoped_refptr<SequencedTaskRunner> task_runner_;
bool called_on_valid_sequence_ = false; bool called_on_valid_sequence_ = false;
DISALLOW_COPY_AND_ASSIGN(SequenceVerificationObserver);
}; };
} // namespace } // namespace
...@@ -378,6 +379,10 @@ class RemoveWhileNotificationIsRunningObserver : public Foo { ...@@ -378,6 +379,10 @@ class RemoveWhileNotificationIsRunningObserver : public Foo {
WaitableEvent::InitialState::NOT_SIGNALED), WaitableEvent::InitialState::NOT_SIGNALED),
barrier_(WaitableEvent::ResetPolicy::AUTOMATIC, barrier_(WaitableEvent::ResetPolicy::AUTOMATIC,
WaitableEvent::InitialState::NOT_SIGNALED) {} WaitableEvent::InitialState::NOT_SIGNALED) {}
RemoveWhileNotificationIsRunningObserver(
const RemoveWhileNotificationIsRunningObserver&) = delete;
RemoveWhileNotificationIsRunningObserver& operator=(
const RemoveWhileNotificationIsRunningObserver&) = delete;
~RemoveWhileNotificationIsRunningObserver() override = default; ~RemoveWhileNotificationIsRunningObserver() override = default;
void Observe(int x) override { void Observe(int x) override {
...@@ -392,8 +397,6 @@ class RemoveWhileNotificationIsRunningObserver : public Foo { ...@@ -392,8 +397,6 @@ class RemoveWhileNotificationIsRunningObserver : public Foo {
private: private:
WaitableEvent notification_running_; WaitableEvent notification_running_;
WaitableEvent barrier_; WaitableEvent barrier_;
DISALLOW_COPY_AND_ASSIGN(RemoveWhileNotificationIsRunningObserver);
}; };
} // namespace } // namespace
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define BASE_OBSERVER_LIST_TYPES_H_ #define BASE_OBSERVER_LIST_TYPES_H_
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
namespace base { namespace base {
...@@ -27,6 +26,8 @@ class CheckedObserverAdapter; ...@@ -27,6 +26,8 @@ class CheckedObserverAdapter;
class BASE_EXPORT CheckedObserver { class BASE_EXPORT CheckedObserver {
public: public:
CheckedObserver(); CheckedObserver();
CheckedObserver(const CheckedObserver&) = delete;
CheckedObserver& operator=(const CheckedObserver&) = delete;
protected: protected:
virtual ~CheckedObserver(); virtual ~CheckedObserver();
...@@ -40,8 +41,6 @@ class BASE_EXPORT CheckedObserver { ...@@ -40,8 +41,6 @@ class BASE_EXPORT CheckedObserver {
// Must be mutable to allow ObserverList<const Foo>. // Must be mutable to allow ObserverList<const Foo>.
mutable WeakPtrFactory<CheckedObserver> factory_{this}; mutable WeakPtrFactory<CheckedObserver> factory_{this};
DISALLOW_COPY_AND_ASSIGN(CheckedObserver);
}; };
} // namespace base } // namespace base
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "base/observer_list.h" #include "base/observer_list.h"
#include <memory>
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/test/gtest_util.h" #include "base/test/gtest_util.h"
#include "base/threading/simple_thread.h" #include "base/threading/simple_thread.h"
...@@ -143,7 +145,9 @@ class ObserverListCreator : public DelegateSimpleThread::Delegate { ...@@ -143,7 +145,9 @@ class ObserverListCreator : public DelegateSimpleThread::Delegate {
class ObserverListTestBase { class ObserverListTestBase {
public: public:
ObserverListTestBase() {} ObserverListTestBase() = default;
ObserverListTestBase(const ObserverListTestBase&) = delete;
ObserverListTestBase& operator=(const ObserverListTestBase&) = delete;
template <class T> template <class T>
const decltype(T::list_.get()) list(const T& iter) { const decltype(T::list_.get()) list(const T& iter) {
...@@ -163,9 +167,6 @@ class ObserverListTestBase { ...@@ -163,9 +167,6 @@ class ObserverListTestBase {
EXPECT_DCHECK_DEATH(return iter->GetCurrent()); EXPECT_DCHECK_DEATH(return iter->GetCurrent());
return nullptr; return nullptr;
} }
private:
DISALLOW_COPY_AND_ASSIGN(ObserverListTestBase);
}; };
// Templatized test fixture that can pick between CheckedBase and UncheckedBase. // Templatized test fixture that can pick between CheckedBase and UncheckedBase.
...@@ -179,10 +180,9 @@ class ObserverListTest : public ObserverListTestBase, public ::testing::Test { ...@@ -179,10 +180,9 @@ class ObserverListTest : public ObserverListTestBase, public ::testing::Test {
using iterator = typename ObserverList<ObserverType>::iterator; using iterator = typename ObserverList<ObserverType>::iterator;
using const_iterator = typename ObserverList<ObserverType>::const_iterator; using const_iterator = typename ObserverList<ObserverType>::const_iterator;
ObserverListTest() {} ObserverListTest() = default;
ObserverListTest(const ObserverListTest&) = delete;
private: ObserverListTest& operator=(const ObserverListTest&) = delete;
DISALLOW_COPY_AND_ASSIGN(ObserverListTest);
}; };
using ObserverTypes = ::testing::Types<CheckedBase, UncheckedBase>; using ObserverTypes = ::testing::Types<CheckedBase, UncheckedBase>;
...@@ -200,10 +200,10 @@ TYPED_TEST_SUITE(ObserverListTest, ObserverTypes); ...@@ -200,10 +200,10 @@ TYPED_TEST_SUITE(ObserverListTest, ObserverTypes);
using Disrupter = DisrupterT<ObserverListFoo>; \ using Disrupter = DisrupterT<ObserverListFoo>; \
using const_iterator = typename TestFixture::const_iterator; \ using const_iterator = typename TestFixture::const_iterator; \
using iterator = typename TestFixture::iterator; \ using iterator = typename TestFixture::iterator; \
(void)(Disrupter*)(0); \ (void)reinterpret_cast<Disrupter*>(0); \
(void)(Adder*)(0); \ (void)reinterpret_cast<Adder*>(0); \
(void)(const_iterator*)(0); \ (void)reinterpret_cast<const_iterator*>(0); \
(void)(iterator*)(0) (void)reinterpret_cast<iterator*>(0)
TYPED_TEST(ObserverListTest, BasicTest) { TYPED_TEST(ObserverListTest, BasicTest) {
DECLARE_TYPES; DECLARE_TYPES;
...@@ -950,26 +950,26 @@ TYPED_TEST(ObserverListTest, ReentrantObserverList) { ...@@ -950,26 +950,26 @@ TYPED_TEST(ObserverListTest, ReentrantObserverList) {
class TestCheckedObserver : public CheckedObserver { class TestCheckedObserver : public CheckedObserver {
public: public:
explicit TestCheckedObserver(int* count) : count_(count) {} explicit TestCheckedObserver(int* count) : count_(count) {}
TestCheckedObserver(const TestCheckedObserver&) = delete;
TestCheckedObserver& operator=(const TestCheckedObserver&) = delete;
void Observe() { ++(*count_); } void Observe() { ++(*count_); }
private: private:
int* count_; int* count_;
DISALLOW_COPY_AND_ASSIGN(TestCheckedObserver);
}; };
// A second, identical observer, used to test multiple inheritance. // A second, identical observer, used to test multiple inheritance.
class TestCheckedObserver2 : public CheckedObserver { class TestCheckedObserver2 : public CheckedObserver {
public: public:
explicit TestCheckedObserver2(int* count) : count_(count) {} explicit TestCheckedObserver2(int* count) : count_(count) {}
TestCheckedObserver2(const TestCheckedObserver2&) = delete;
TestCheckedObserver2& operator=(const TestCheckedObserver2&) = delete;
void Observe() { ++(*count_); } void Observe() { ++(*count_); }
private: private:
int* count_; int* count_;
DISALLOW_COPY_AND_ASSIGN(TestCheckedObserver2);
}; };
using CheckedObserverListTest = ::testing::Test; using CheckedObserverListTest = ::testing::Test;
......
...@@ -24,6 +24,8 @@ class RefCountedClass : public base::RefCounted<RefCountedClass> { ...@@ -24,6 +24,8 @@ class RefCountedClass : public base::RefCounted<RefCountedClass> {
: did_delete_instance_(did_delete_instance) { : did_delete_instance_(did_delete_instance) {
DCHECK(!*did_delete_instance_); DCHECK(!*did_delete_instance_);
} }
RefCountedClass(const RefCountedClass&) = delete;
RefCountedClass& operator=(const RefCountedClass&) = delete;
void PerformTask() { did_perform_task_ = true; } void PerformTask() { did_perform_task_ = true; }
bool did_perform_task() const { return did_perform_task_; } bool did_perform_task() const { return did_perform_task_; }
...@@ -36,8 +38,6 @@ class RefCountedClass : public base::RefCounted<RefCountedClass> { ...@@ -36,8 +38,6 @@ class RefCountedClass : public base::RefCounted<RefCountedClass> {
bool* const did_delete_instance_; // Not owned. bool* const did_delete_instance_; // Not owned.
bool did_perform_task_ = false; bool did_perform_task_ = false;
DISALLOW_COPY_AND_ASSIGN(RefCountedClass);
}; };
TEST(OneShotEventTest, RecordsSignal) { TEST(OneShotEventTest, RecordsSignal) {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/base_export.h" #include "base/base_export.h"
#include "base/check_op.h" #include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/containers/span.h" #include "base/containers/span.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
...@@ -136,12 +135,12 @@ class BASE_EXPORT Pickle { ...@@ -136,12 +135,12 @@ class BASE_EXPORT Pickle {
class BASE_EXPORT Attachment : public RefCountedThreadSafe<Attachment> { class BASE_EXPORT Attachment : public RefCountedThreadSafe<Attachment> {
public: public:
Attachment(); Attachment();
Attachment(const Attachment&) = delete;
Attachment& operator=(const Attachment&) = delete;
protected: protected:
friend class RefCountedThreadSafe<Attachment>; friend class RefCountedThreadSafe<Attachment>;
virtual ~Attachment(); virtual ~Attachment();
DISALLOW_COPY_AND_ASSIGN(Attachment);
}; };
// Initialize a Pickle object using the default header size. // Initialize a Pickle object using the default header size.
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef BASE_RUN_LOOP_H_ #ifndef BASE_RUN_LOOP_H_
#define BASE_RUN_LOOP_H_ #define BASE_RUN_LOOP_H_
#include <stack>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -12,7 +13,6 @@ ...@@ -12,7 +13,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/containers/stack.h" #include "base/containers/stack.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
...@@ -74,7 +74,9 @@ class BASE_EXPORT RunLoop { ...@@ -74,7 +74,9 @@ class BASE_EXPORT RunLoop {
kNestableTasksAllowed, kNestableTasksAllowed,
}; };
RunLoop(Type type = Type::kDefault); explicit RunLoop(Type type = Type::kDefault);
RunLoop(const RunLoop&) = delete;
RunLoop& operator=(const RunLoop&) = delete;
~RunLoop(); ~RunLoop();
// Run the current RunLoop::Delegate. This blocks until Quit is called // Run the current RunLoop::Delegate. This blocks until Quit is called
...@@ -176,6 +178,8 @@ class BASE_EXPORT RunLoop { ...@@ -176,6 +178,8 @@ class BASE_EXPORT RunLoop {
class BASE_EXPORT Delegate { class BASE_EXPORT Delegate {
public: public:
Delegate(); Delegate();
Delegate(const Delegate&) = delete;
Delegate& operator=(const Delegate&) = delete;
virtual ~Delegate(); virtual ~Delegate();
// Used by RunLoop to inform its Delegate to Run/Quit. Implementations are // Used by RunLoop to inform its Delegate to Run/Quit. Implementations are
...@@ -231,8 +235,6 @@ class BASE_EXPORT RunLoop { ...@@ -231,8 +235,6 @@ class BASE_EXPORT RunLoop {
// Thread-affine per its use of TLS. // Thread-affine per its use of TLS.
THREAD_CHECKER(bound_thread_checker_); THREAD_CHECKER(bound_thread_checker_);
DISALLOW_COPY_AND_ASSIGN(Delegate);
}; };
// Registers |delegate| on the current thread. Must be called once and only // Registers |delegate| on the current thread. Must be called once and only
...@@ -261,6 +263,10 @@ class BASE_EXPORT RunLoop { ...@@ -261,6 +263,10 @@ class BASE_EXPORT RunLoop {
class BASE_EXPORT ScopedDisallowRunningForTesting { class BASE_EXPORT ScopedDisallowRunningForTesting {
public: public:
ScopedDisallowRunningForTesting(); ScopedDisallowRunningForTesting();
ScopedDisallowRunningForTesting(const ScopedDisallowRunningForTesting&) =
delete;
ScopedDisallowRunningForTesting& operator=(
const ScopedDisallowRunningForTesting&) = delete;
~ScopedDisallowRunningForTesting(); ~ScopedDisallowRunningForTesting();
private: private:
...@@ -268,8 +274,6 @@ class BASE_EXPORT RunLoop { ...@@ -268,8 +274,6 @@ class BASE_EXPORT RunLoop {
Delegate* current_delegate_; Delegate* current_delegate_;
const bool previous_run_allowance_; const bool previous_run_allowance_;
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
DISALLOW_COPY_AND_ASSIGN(ScopedDisallowRunningForTesting);
}; };
// Support for //base/test/scoped_run_loop_timeout.h. // Support for //base/test/scoped_run_loop_timeout.h.
...@@ -344,8 +348,6 @@ class BASE_EXPORT RunLoop { ...@@ -344,8 +348,6 @@ class BASE_EXPORT RunLoop {
// WeakPtrFactory for QuitClosure safety. // WeakPtrFactory for QuitClosure safety.
WeakPtrFactory<RunLoop> weak_factory_{this}; WeakPtrFactory<RunLoop> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(RunLoop);
}; };
} // namespace base } // namespace base
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include <functional> #include <functional>
#include <memory>
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/containers/queue.h" #include "base/containers/queue.h"
#include "base/location.h" #include "base/location.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
...@@ -62,6 +62,9 @@ void RunNestedLoopTask(int* counter) { ...@@ -62,6 +62,9 @@ void RunNestedLoopTask(int* counter) {
class SimpleSingleThreadTaskRunner : public SingleThreadTaskRunner { class SimpleSingleThreadTaskRunner : public SingleThreadTaskRunner {
public: public:
SimpleSingleThreadTaskRunner() = default; SimpleSingleThreadTaskRunner() = default;
SimpleSingleThreadTaskRunner(const SimpleSingleThreadTaskRunner&) = delete;
SimpleSingleThreadTaskRunner& operator=(const SimpleSingleThreadTaskRunner&) =
delete;
bool PostDelayedTask(const Location& from_here, bool PostDelayedTask(const Location& from_here,
OnceClosure task, OnceClosure task,
...@@ -108,8 +111,6 @@ class SimpleSingleThreadTaskRunner : public SingleThreadTaskRunner { ...@@ -108,8 +111,6 @@ class SimpleSingleThreadTaskRunner : public SingleThreadTaskRunner {
// ThreadCheckerImpl to be able to reliably provide that signal even in // ThreadCheckerImpl to be able to reliably provide that signal even in
// non-dcheck builds. // non-dcheck builds.
ThreadCheckerImpl origin_thread_checker_; ThreadCheckerImpl origin_thread_checker_;
DISALLOW_COPY_AND_ASSIGN(SimpleSingleThreadTaskRunner);
}; };
// The basis of all TestDelegates, allows safely injecting a OnceClosure to be // The basis of all TestDelegates, allows safely injecting a OnceClosure to be
...@@ -209,7 +210,7 @@ enum class RunLoopTestType { ...@@ -209,7 +210,7 @@ enum class RunLoopTestType {
// so it can be instantiated on the stack in the RunLoopTest fixture. // so it can be instantiated on the stack in the RunLoopTest fixture.
class RunLoopTestEnvironment { class RunLoopTestEnvironment {
public: public:
RunLoopTestEnvironment(RunLoopTestType type) { explicit RunLoopTestEnvironment(RunLoopTestType type) {
switch (type) { switch (type) {
case RunLoopTestType::kRealEnvironment: { case RunLoopTestType::kRealEnvironment: {
task_environment_ = std::make_unique<test::TaskEnvironment>(); task_environment_ = std::make_unique<test::TaskEnvironment>();
...@@ -231,14 +232,15 @@ class RunLoopTestEnvironment { ...@@ -231,14 +232,15 @@ class RunLoopTestEnvironment {
}; };
class RunLoopTest : public testing::TestWithParam<RunLoopTestType> { class RunLoopTest : public testing::TestWithParam<RunLoopTestType> {
public:
RunLoopTest(const RunLoopTest&) = delete;
RunLoopTest& operator=(const RunLoopTest&) = delete;
protected: protected:
RunLoopTest() : test_environment_(GetParam()) {} RunLoopTest() : test_environment_(GetParam()) {}
RunLoopTestEnvironment test_environment_; RunLoopTestEnvironment test_environment_;
RunLoop run_loop_; RunLoop run_loop_;
private:
DISALLOW_COPY_AND_ASSIGN(RunLoopTest);
}; };
} // namespace } // namespace
...@@ -470,22 +472,21 @@ namespace { ...@@ -470,22 +472,21 @@ namespace {
class MockNestingObserver : public RunLoop::NestingObserver { class MockNestingObserver : public RunLoop::NestingObserver {
public: public:
MockNestingObserver() = default; MockNestingObserver() = default;
MockNestingObserver(const MockNestingObserver&) = delete;
MockNestingObserver& operator=(const MockNestingObserver&) = delete;
// RunLoop::NestingObserver: // RunLoop::NestingObserver:
MOCK_METHOD0(OnBeginNestedRunLoop, void()); MOCK_METHOD0(OnBeginNestedRunLoop, void());
MOCK_METHOD0(OnExitNestedRunLoop, void()); MOCK_METHOD0(OnExitNestedRunLoop, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockNestingObserver);
}; };
class MockTask { class MockTask {
public: public:
MockTask() = default; MockTask() = default;
MOCK_METHOD0(Task, void()); MockTask(const MockTask&) = delete;
MockTask& operator=(const MockTask&) = delete;
private: MOCK_METHOD0(Task, void());
DISALLOW_COPY_AND_ASSIGN(MockTask);
}; };
} // namespace } // namespace
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <errno.h> #include <errno.h>
#include "base/base_export.h" #include "base/base_export.h"
// TODO(crbug.com/1010217) Remove once no #includers are getting base/macros.h
// by including this header.
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -23,12 +25,12 @@ namespace base { ...@@ -23,12 +25,12 @@ namespace base {
class BASE_EXPORT ScopedClearLastErrorBase { class BASE_EXPORT ScopedClearLastErrorBase {
public: public:
ScopedClearLastErrorBase() : last_errno_(errno) { errno = 0; } ScopedClearLastErrorBase() : last_errno_(errno) { errno = 0; }
ScopedClearLastErrorBase(const ScopedClearLastErrorBase&) = delete;
ScopedClearLastErrorBase& operator=(const ScopedClearLastErrorBase&) = delete;
~ScopedClearLastErrorBase() { errno = last_errno_; } ~ScopedClearLastErrorBase() { errno = last_errno_; }
private: private:
const int last_errno_; const int last_errno_;
DISALLOW_COPY_AND_ASSIGN(ScopedClearLastErrorBase);
}; };
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -37,12 +39,12 @@ class BASE_EXPORT ScopedClearLastErrorBase { ...@@ -37,12 +39,12 @@ class BASE_EXPORT ScopedClearLastErrorBase {
class BASE_EXPORT ScopedClearLastError : public ScopedClearLastErrorBase { class BASE_EXPORT ScopedClearLastError : public ScopedClearLastErrorBase {
public: public:
ScopedClearLastError(); ScopedClearLastError();
ScopedClearLastError(const ScopedClearLastError&) = delete;
ScopedClearLastError& operator=(const ScopedClearLastError&) = delete;
~ScopedClearLastError(); ~ScopedClearLastError();
private: private:
const unsigned long last_system_error_; const unsigned long last_system_error_;
DISALLOW_COPY_AND_ASSIGN(ScopedClearLastError);
}; };
#elif defined(OS_POSIX) || defined(OS_FUCHSIA) #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
......
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
#include <ostream> #include <ostream>
#include <algorithm> #include <algorithm>
#include <utility>
#include "base/check.h" #include "base/check.h"
#include "base/compiler_specific.h" // TODO(crbug.com/1010217) Remove once no #includers are getting base/macros.h
// by including this header.
#include "base/macros.h" #include "base/macros.h"
namespace base { namespace base {
...@@ -119,6 +121,8 @@ class ScopedGeneric { ...@@ -119,6 +121,8 @@ class ScopedGeneric {
: data_(rvalue.release(), rvalue.get_traits()) { : data_(rvalue.release(), rvalue.get_traits()) {
TrackAcquire(data_.generic); TrackAcquire(data_.generic);
} }
ScopedGeneric(const ScopedGeneric&) = delete;
ScopedGeneric& operator=(const ScopedGeneric&) = delete;
virtual ~ScopedGeneric() { virtual ~ScopedGeneric() {
CHECK(!receiving_) << "ScopedGeneric destroyed with active receiver"; CHECK(!receiving_) << "ScopedGeneric destroyed with active receiver";
...@@ -215,15 +219,8 @@ class ScopedGeneric { ...@@ -215,15 +219,8 @@ class ScopedGeneric {
"Receiver"; "Receiver";
scoped_generic_->receiving_ = true; scoped_generic_->receiving_ = true;
} }
Receiver(const Receiver&) = delete;
~Receiver() { Receiver& operator=(const Receiver&) = delete;
if (scoped_generic_) {
CHECK(scoped_generic_->receiving_);
scoped_generic_->reset(value_);
scoped_generic_->receiving_ = false;
}
}
Receiver(Receiver&& move) { Receiver(Receiver&& move) {
CHECK(!used_) << "moving into already-used Receiver"; CHECK(!used_) << "moving into already-used Receiver";
CHECK(!move.used_) << "moving from already-used Receiver"; CHECK(!move.used_) << "moving from already-used Receiver";
...@@ -237,7 +234,13 @@ class ScopedGeneric { ...@@ -237,7 +234,13 @@ class ScopedGeneric {
scoped_generic_ = move.scoped_generic_; scoped_generic_ = move.scoped_generic_;
move.scoped_generic_ = nullptr; move.scoped_generic_ = nullptr;
} }
~Receiver() {
if (scoped_generic_) {
CHECK(scoped_generic_->receiving_);
scoped_generic_->reset(value_);
scoped_generic_->receiving_ = false;
}
}
// We hand out a pointer to a field in Receiver instead of directly to // We hand out a pointer to a field in Receiver instead of directly to
// ScopedGeneric's internal storage in order to make it so that users can't // ScopedGeneric's internal storage in order to make it so that users can't
// accidentally silently break ScopedGeneric's invariants. This way, an // accidentally silently break ScopedGeneric's invariants. This way, an
...@@ -253,8 +256,6 @@ class ScopedGeneric { ...@@ -253,8 +256,6 @@ class ScopedGeneric {
T value_ = Traits::InvalidValue(); T value_ = Traits::InvalidValue();
ScopedGeneric* scoped_generic_; ScopedGeneric* scoped_generic_;
bool used_ = false; bool used_ = false;
DISALLOW_COPY_AND_ASSIGN(Receiver);
}; };
const element_type& get() const { return data_.generic; } const element_type& get() const { return data_.generic; }
...@@ -324,8 +325,6 @@ class ScopedGeneric { ...@@ -324,8 +325,6 @@ class ScopedGeneric {
Data data_; Data data_;
bool receiving_ = false; bool receiving_ = false;
DISALLOW_COPY_AND_ASSIGN(ScopedGeneric);
}; };
template<class T, class Traits> template<class T, class Traits>
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define BASE_SCOPED_NATIVE_LIBRARY_H_ #define BASE_SCOPED_NATIVE_LIBRARY_H_
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h"
#include "base/native_library.h" #include "base/native_library.h"
#include "base/scoped_generic.h" #include "base/scoped_generic.h"
...@@ -33,8 +32,6 @@ class BASE_EXPORT ScopedNativeLibrary ...@@ -33,8 +32,6 @@ class BASE_EXPORT ScopedNativeLibrary
// Initializes with a NULL library. // Initializes with a NULL library.
ScopedNativeLibrary(); ScopedNativeLibrary();
~ScopedNativeLibrary() override;
// Takes ownership of the given library handle. // Takes ownership of the given library handle.
explicit ScopedNativeLibrary(NativeLibrary library); explicit ScopedNativeLibrary(NativeLibrary library);
...@@ -49,14 +46,17 @@ class BASE_EXPORT ScopedNativeLibrary ...@@ -49,14 +46,17 @@ class BASE_EXPORT ScopedNativeLibrary
ScopedNativeLibrary& operator=(ScopedNativeLibrary&& scoped_library) = ScopedNativeLibrary& operator=(ScopedNativeLibrary&& scoped_library) =
default; default;
ScopedNativeLibrary(const ScopedNativeLibrary&) = delete;
ScopedNativeLibrary& operator=(const ScopedNativeLibrary&) = delete;
~ScopedNativeLibrary() override;
void* GetFunctionPointer(const char* function_name) const; void* GetFunctionPointer(const char* function_name) const;
const NativeLibraryLoadError* GetError() const; const NativeLibraryLoadError* GetError() const;
private: private:
NativeLibraryLoadError error_; NativeLibraryLoadError error_;
DISALLOW_COPY_AND_ASSIGN(ScopedNativeLibrary);
}; };
} // namespace base } // namespace base
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <vector> #include <vector>
#include "base/check.h" #include "base/check.h"
#include "base/macros.h"
#include "base/stl_util.h" #include "base/stl_util.h"
// ScopedObserver is used to keep track of the set of sources an object has // ScopedObserver is used to keep track of the set of sources an object has
...@@ -43,7 +42,8 @@ template <class Source, ...@@ -43,7 +42,8 @@ template <class Source,
class ScopedObserver { class ScopedObserver {
public: public:
explicit ScopedObserver(Observer* observer) : observer_(observer) {} explicit ScopedObserver(Observer* observer) : observer_(observer) {}
ScopedObserver(const ScopedObserver&) = delete;
ScopedObserver& operator=(const ScopedObserver&) = delete;
~ScopedObserver() { ~ScopedObserver() {
RemoveAll(); RemoveAll();
} }
...@@ -80,8 +80,6 @@ class ScopedObserver { ...@@ -80,8 +80,6 @@ class ScopedObserver {
Observer* observer_; Observer* observer_;
std::vector<Source*> sources_; std::vector<Source*> sources_;
DISALLOW_COPY_AND_ASSIGN(ScopedObserver);
}; };
#endif // BASE_SCOPED_OBSERVER_H_ #endif // BASE_SCOPED_OBSERVER_H_
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define BASE_SEQUENCE_CHECKER_H_ #define BASE_SEQUENCE_CHECKER_H_
#include "base/check.h" #include "base/check.h"
#include "base/compiler_specific.h"
#include "base/sequence_checker_impl.h" #include "base/sequence_checker_impl.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -100,12 +99,11 @@ class LOCKABLE SequenceCheckerDoNothing { ...@@ -100,12 +99,11 @@ class LOCKABLE SequenceCheckerDoNothing {
SequenceCheckerDoNothing(SequenceCheckerDoNothing&& other) = default; SequenceCheckerDoNothing(SequenceCheckerDoNothing&& other) = default;
SequenceCheckerDoNothing& operator=(SequenceCheckerDoNothing&& other) = SequenceCheckerDoNothing& operator=(SequenceCheckerDoNothing&& other) =
default; default;
SequenceCheckerDoNothing(const SequenceCheckerDoNothing&) = delete;
SequenceCheckerDoNothing& operator=(const SequenceCheckerDoNothing&) = delete;
bool CalledOnValidSequence() const WARN_UNUSED_RESULT { return true; } bool CalledOnValidSequence() const WARN_UNUSED_RESULT { return true; }
void DetachFromSequence() {} void DetachFromSequence() {}
private:
DISALLOW_COPY_AND_ASSIGN(SequenceCheckerDoNothing);
}; };
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "base/sequence_checker_impl.h" #include "base/sequence_checker_impl.h"
#include <utility>
#include "base/check.h" #include "base/check.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/sequence_token.h" #include "base/sequence_token.h"
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include <memory> #include <memory>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/thread_annotations.h" #include "base/thread_annotations.h"
...@@ -26,7 +24,6 @@ namespace base { ...@@ -26,7 +24,6 @@ namespace base {
class LOCKABLE BASE_EXPORT SequenceCheckerImpl { class LOCKABLE BASE_EXPORT SequenceCheckerImpl {
public: public:
SequenceCheckerImpl(); SequenceCheckerImpl();
~SequenceCheckerImpl();
// Allow move construct/assign. This must be called on |other|'s associated // Allow move construct/assign. This must be called on |other|'s associated
// sequence and assignment can only be made into a SequenceCheckerImpl which // sequence and assignment can only be made into a SequenceCheckerImpl which
...@@ -36,6 +33,9 @@ class LOCKABLE BASE_EXPORT SequenceCheckerImpl { ...@@ -36,6 +33,9 @@ class LOCKABLE BASE_EXPORT SequenceCheckerImpl {
// will be bound to the current sequence and |other| will be detached. // will be bound to the current sequence and |other| will be detached.
SequenceCheckerImpl(SequenceCheckerImpl&& other); SequenceCheckerImpl(SequenceCheckerImpl&& other);
SequenceCheckerImpl& operator=(SequenceCheckerImpl&& other); SequenceCheckerImpl& operator=(SequenceCheckerImpl&& other);
SequenceCheckerImpl(const SequenceCheckerImpl&) = delete;
SequenceCheckerImpl& operator=(const SequenceCheckerImpl&) = delete;
~SequenceCheckerImpl();
// Returns true if called in sequence with previous calls to this method and // Returns true if called in sequence with previous calls to this method and
// the constructor. // the constructor.
...@@ -54,8 +54,6 @@ class LOCKABLE BASE_EXPORT SequenceCheckerImpl { ...@@ -54,8 +54,6 @@ class LOCKABLE BASE_EXPORT SequenceCheckerImpl {
mutable Lock lock_; mutable Lock lock_;
mutable std::unique_ptr<Core> core_ GUARDED_BY(lock_); mutable std::unique_ptr<Core> core_ GUARDED_BY(lock_);
DISALLOW_COPY_AND_ASSIGN(SequenceCheckerImpl);
}; };
} // namespace base } // namespace base
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/macros.h"
#include "base/sequence_token.h" #include "base/sequence_token.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
...@@ -36,14 +36,14 @@ class RunCallbackThread : public SimpleThread { ...@@ -36,14 +36,14 @@ class RunCallbackThread : public SimpleThread {
Start(); Start();
Join(); Join();
} }
RunCallbackThread(const RunCallbackThread&) = delete;
RunCallbackThread& operator=(const RunCallbackThread&) = delete;
private: private:
// SimpleThread: // SimpleThread:
void Run() override { std::move(callback_).Run(); } void Run() override { std::move(callback_).Run(); }
OnceClosure callback_; OnceClosure callback_;
DISALLOW_COPY_AND_ASSIGN(RunCallbackThread);
}; };
void ExpectCalledOnValidSequence(SequenceCheckerImpl* sequence_checker) { void ExpectCalledOnValidSequence(SequenceCheckerImpl* sequence_checker) {
...@@ -259,12 +259,12 @@ TEST(SequenceCheckerMacroTest, Macros) { ...@@ -259,12 +259,12 @@ TEST(SequenceCheckerMacroTest, Macros) {
class SequenceCheckerOwner { class SequenceCheckerOwner {
public: public:
SequenceCheckerOwner() = default; SequenceCheckerOwner() = default;
SequenceCheckerOwner(const SequenceCheckerOwner&) = delete;
SequenceCheckerOwner& operator=(const SequenceCheckerOwner&) = delete;
~SequenceCheckerOwner() { EXPECT_TRUE(checker_.CalledOnValidSequence()); } ~SequenceCheckerOwner() { EXPECT_TRUE(checker_.CalledOnValidSequence()); }
private: private:
SequenceCheckerImpl checker_; SequenceCheckerImpl checker_;
DISALLOW_COPY_AND_ASSIGN(SequenceCheckerOwner);
}; };
// Verifies SequenceCheckerImpl::CalledOnValidSequence() returns true if called // Verifies SequenceCheckerImpl::CalledOnValidSequence() returns true if called
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define BASE_SEQUENCE_TOKEN_H_ #define BASE_SEQUENCE_TOKEN_H_
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h"
namespace base { namespace base {
...@@ -100,14 +99,17 @@ class BASE_EXPORT ScopedSetSequenceTokenForCurrentThread { ...@@ -100,14 +99,17 @@ class BASE_EXPORT ScopedSetSequenceTokenForCurrentThread {
// TaskToken::GetForCurrentThread() will return a TaskToken which is not equal // TaskToken::GetForCurrentThread() will return a TaskToken which is not equal
// to any TaskToken returned in the scope of another // to any TaskToken returned in the scope of another
// ScopedSetSequenceTokenForCurrentThread. // ScopedSetSequenceTokenForCurrentThread.
ScopedSetSequenceTokenForCurrentThread(const SequenceToken& sequence_token); explicit ScopedSetSequenceTokenForCurrentThread(
const SequenceToken& sequence_token);
ScopedSetSequenceTokenForCurrentThread(
const ScopedSetSequenceTokenForCurrentThread&) = delete;
ScopedSetSequenceTokenForCurrentThread& operator=(
const ScopedSetSequenceTokenForCurrentThread&) = delete;
~ScopedSetSequenceTokenForCurrentThread(); ~ScopedSetSequenceTokenForCurrentThread();
private: private:
const SequenceToken sequence_token_; const SequenceToken sequence_token_;
const TaskToken task_token_; const TaskToken task_token_;
DISALLOW_COPY_AND_ASSIGN(ScopedSetSequenceTokenForCurrentThread);
}; };
} // namespace base } // namespace base
......
...@@ -23,6 +23,8 @@ class FlagOnDelete { ...@@ -23,6 +23,8 @@ class FlagOnDelete {
scoped_refptr<SequencedTaskRunner> expected_deletion_sequence) scoped_refptr<SequencedTaskRunner> expected_deletion_sequence)
: deleted_(deleted), : deleted_(deleted),
expected_deletion_sequence_(std::move(expected_deletion_sequence)) {} expected_deletion_sequence_(std::move(expected_deletion_sequence)) {}
FlagOnDelete(const FlagOnDelete&) = delete;
FlagOnDelete& operator=(const FlagOnDelete&) = delete;
private: private:
friend class DeleteHelper<FlagOnDelete>; friend class DeleteHelper<FlagOnDelete>;
...@@ -38,11 +40,13 @@ class FlagOnDelete { ...@@ -38,11 +40,13 @@ class FlagOnDelete {
bool* deleted_; bool* deleted_;
const scoped_refptr<SequencedTaskRunner> expected_deletion_sequence_; const scoped_refptr<SequencedTaskRunner> expected_deletion_sequence_;
DISALLOW_COPY_AND_ASSIGN(FlagOnDelete);
}; };
class SequencedTaskRunnerTest : public testing::Test { class SequencedTaskRunnerTest : public testing::Test {
public:
SequencedTaskRunnerTest(const SequencedTaskRunnerTest&) = delete;
SequencedTaskRunnerTest& operator=(const SequencedTaskRunnerTest&) = delete;
protected: protected:
SequencedTaskRunnerTest() : foreign_thread_("foreign") {} SequencedTaskRunnerTest() : foreign_thread_("foreign") {}
...@@ -57,8 +61,6 @@ class SequencedTaskRunnerTest : public testing::Test { ...@@ -57,8 +61,6 @@ class SequencedTaskRunnerTest : public testing::Test {
private: private:
test::TaskEnvironment task_environment_; test::TaskEnvironment task_environment_;
DISALLOW_COPY_AND_ASSIGN(SequencedTaskRunnerTest);
}; };
using SequenceBoundUniquePtr = using SequenceBoundUniquePtr =
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <memory> #include <memory>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
...@@ -22,6 +21,8 @@ class BASE_EXPORT SupportsUserData { ...@@ -22,6 +21,8 @@ class BASE_EXPORT SupportsUserData {
SupportsUserData(); SupportsUserData();
SupportsUserData(SupportsUserData&&); SupportsUserData(SupportsUserData&&);
SupportsUserData& operator=(SupportsUserData&&); SupportsUserData& operator=(SupportsUserData&&);
SupportsUserData(const SupportsUserData&) = delete;
SupportsUserData& operator=(const SupportsUserData&) = delete;
// Derive from this class and add your own data members to associate extra // Derive from this class and add your own data members to associate extra
// information with this object. Alternatively, add this as a public base // information with this object. Alternatively, add this as a public base
...@@ -67,8 +68,6 @@ class BASE_EXPORT SupportsUserData { ...@@ -67,8 +68,6 @@ class BASE_EXPORT SupportsUserData {
DataMap user_data_; DataMap user_data_;
// Guards usage of |user_data_| // Guards usage of |user_data_|
SequenceChecker sequence_checker_; SequenceChecker sequence_checker_;
DISALLOW_COPY_AND_ASSIGN(SupportsUserData);
}; };
// Adapter class that releases a refcounted object when the // Adapter class that releases a refcounted object when the
...@@ -83,14 +82,14 @@ class UserDataAdapter : public SupportsUserData::Data { ...@@ -83,14 +82,14 @@ class UserDataAdapter : public SupportsUserData::Data {
} }
explicit UserDataAdapter(T* object) : object_(object) {} explicit UserDataAdapter(T* object) : object_(object) {}
UserDataAdapter(const UserDataAdapter&) = delete;
UserDataAdapter& operator=(const UserDataAdapter&) = delete;
~UserDataAdapter() override = default; ~UserDataAdapter() override = default;
T* release() { return object_.release(); } T* release() { return object_.release(); }
private: private:
scoped_refptr<T> const object_; scoped_refptr<T> const object_;
DISALLOW_COPY_AND_ASSIGN(UserDataAdapter);
}; };
} // namespace base } // namespace base
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
#include <stddef.h> #include <stddef.h>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/files/platform_file.h" #include "base/files/platform_file.h"
#include "base/macros.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -41,6 +39,8 @@ class BASE_EXPORT SyncSocket { ...@@ -41,6 +39,8 @@ class BASE_EXPORT SyncSocket {
// Creates a SyncSocket from a Handle. // Creates a SyncSocket from a Handle.
explicit SyncSocket(Handle handle); explicit SyncSocket(Handle handle);
explicit SyncSocket(ScopedHandle handle); explicit SyncSocket(ScopedHandle handle);
SyncSocket(const SyncSocket&) = delete;
SyncSocket& operator=(const SyncSocket&) = delete;
virtual ~SyncSocket(); virtual ~SyncSocket();
// Initializes and connects a pair of sockets. // Initializes and connects a pair of sockets.
...@@ -89,9 +89,6 @@ class BASE_EXPORT SyncSocket { ...@@ -89,9 +89,6 @@ class BASE_EXPORT SyncSocket {
protected: protected:
ScopedHandle handle_; ScopedHandle handle_;
private:
DISALLOW_COPY_AND_ASSIGN(SyncSocket);
}; };
// Derives from SyncSocket and adds support for shutting down the socket from // Derives from SyncSocket and adds support for shutting down the socket from
...@@ -102,6 +99,8 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket { ...@@ -102,6 +99,8 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket {
CancelableSyncSocket(); CancelableSyncSocket();
explicit CancelableSyncSocket(Handle handle); explicit CancelableSyncSocket(Handle handle);
explicit CancelableSyncSocket(ScopedHandle handle); explicit CancelableSyncSocket(ScopedHandle handle);
CancelableSyncSocket(const CancelableSyncSocket&) = delete;
CancelableSyncSocket& operator=(const CancelableSyncSocket&) = delete;
~CancelableSyncSocket() override = default; ~CancelableSyncSocket() override = default;
// Initializes a pair of cancelable sockets. See documentation for // Initializes a pair of cancelable sockets. See documentation for
...@@ -139,7 +138,6 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket { ...@@ -139,7 +138,6 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket {
WaitableEvent shutdown_event_; WaitableEvent shutdown_event_;
WaitableEvent file_operation_; WaitableEvent file_operation_;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(CancelableSyncSocket);
}; };
} // namespace base } // namespace base
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "base/sync_socket.h" #include "base/sync_socket.h"
#include "base/macros.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h" #include "base/threading/simple_thread.h"
...@@ -30,6 +29,8 @@ class HangingReceiveThread : public DelegateSimpleThread::Delegate { ...@@ -30,6 +29,8 @@ class HangingReceiveThread : public DelegateSimpleThread::Delegate {
thread_.Start(); thread_.Start();
} }
HangingReceiveThread(const HangingReceiveThread&) = delete;
HangingReceiveThread& operator=(const HangingReceiveThread&) = delete;
~HangingReceiveThread() override = default; ~HangingReceiveThread() override = default;
void Run() override { void Run() override {
...@@ -61,8 +62,6 @@ class HangingReceiveThread : public DelegateSimpleThread::Delegate { ...@@ -61,8 +62,6 @@ class HangingReceiveThread : public DelegateSimpleThread::Delegate {
bool with_timeout_; bool with_timeout_;
WaitableEvent started_event_; WaitableEvent started_event_;
WaitableEvent done_event_; WaitableEvent done_event_;
DISALLOW_COPY_AND_ASSIGN(HangingReceiveThread);
}; };
// Tests sending data between two SyncSockets. Uses ASSERT() and thus will exit // Tests sending data between two SyncSockets. Uses ASSERT() and thus will exit
......
...@@ -38,15 +38,14 @@ void BASE_EXPORT ResetEventSourceForTesting(); ...@@ -38,15 +38,14 @@ void BASE_EXPORT ResetEventSourceForTesting();
class BASE_EXPORT EventLogMessage { class BASE_EXPORT EventLogMessage {
public: public:
EventLogMessage(const char* file, int line, LogSeverity severity); EventLogMessage(const char* file, int line, LogSeverity severity);
EventLogMessage(const EventLogMessage&) = delete;
EventLogMessage& operator=(const EventLogMessage&) = delete;
~EventLogMessage(); ~EventLogMessage();
std::ostream& stream() { return log_message_.stream(); } std::ostream& stream() { return log_message_.stream(); }
private: private:
LogMessage log_message_; LogMessage log_message_;
DISALLOW_COPY_AND_ASSIGN(EventLogMessage);
}; };
} // namespace logging } // namespace logging
......
...@@ -13,6 +13,9 @@ namespace base { ...@@ -13,6 +13,9 @@ namespace base {
// A SequencedTaskRunner whose posted tasks' priorities can be updated. // A SequencedTaskRunner whose posted tasks' priorities can be updated.
class BASE_EXPORT UpdateableSequencedTaskRunner : public SequencedTaskRunner { class BASE_EXPORT UpdateableSequencedTaskRunner : public SequencedTaskRunner {
public: public:
UpdateableSequencedTaskRunner(const UpdateableSequencedTaskRunner&) = delete;
UpdateableSequencedTaskRunner& operator=(
const UpdateableSequencedTaskRunner&) = delete;
// Updates the priority for tasks posted through this TaskRunner to // Updates the priority for tasks posted through this TaskRunner to
// |priority|. // |priority|.
virtual void UpdatePriority(TaskPriority priority) = 0; virtual void UpdatePriority(TaskPriority priority) = 0;
...@@ -20,8 +23,6 @@ class BASE_EXPORT UpdateableSequencedTaskRunner : public SequencedTaskRunner { ...@@ -20,8 +23,6 @@ class BASE_EXPORT UpdateableSequencedTaskRunner : public SequencedTaskRunner {
protected: protected:
UpdateableSequencedTaskRunner() = default; UpdateableSequencedTaskRunner() = default;
~UpdateableSequencedTaskRunner() override = default; ~UpdateableSequencedTaskRunner() override = default;
DISALLOW_COPY_AND_ASSIGN(UpdateableSequencedTaskRunner);
}; };
} // namespace base } // namespace base
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "base/containers/checked_range.h" #include "base/containers/checked_range.h"
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
#include "base/containers/span.h" #include "base/containers/span.h"
#include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/value_iterators.h" #include "base/value_iterators.h"
...@@ -151,6 +150,8 @@ class BASE_EXPORT Value { ...@@ -151,6 +150,8 @@ class BASE_EXPORT Value {
explicit Value(ListStorage&& in_list) noexcept; explicit Value(ListStorage&& in_list) noexcept;
Value& operator=(Value&& that) noexcept; Value& operator=(Value&& that) noexcept;
Value(const Value&) = delete;
Value& operator=(const Value&) = delete;
~Value(); ~Value();
...@@ -571,8 +572,6 @@ class BASE_EXPORT Value { ...@@ -571,8 +572,6 @@ class BASE_EXPORT Value {
DictStorage, DictStorage,
ListStorage> ListStorage>
data_; data_;
DISALLOW_COPY_AND_ASSIGN(Value);
}; };
// DictionaryValue provides a key-value dictionary with (optional) "path" // DictionaryValue provides a key-value dictionary with (optional) "path"
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <vector> #include <vector>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
namespace logging { namespace logging {
...@@ -40,6 +39,8 @@ class BASE_EXPORT VlogInfo { ...@@ -40,6 +39,8 @@ class BASE_EXPORT VlogInfo {
VlogInfo(const std::string& v_switch, VlogInfo(const std::string& v_switch,
const std::string& vmodule_switch, const std::string& vmodule_switch,
int* min_log_level); int* min_log_level);
VlogInfo(const VlogInfo&) = delete;
VlogInfo& operator=(const VlogInfo&) = delete;
~VlogInfo(); ~VlogInfo();
// Returns the vlog level for a given file (usually taken from // Returns the vlog level for a given file (usually taken from
...@@ -55,8 +56,6 @@ class BASE_EXPORT VlogInfo { ...@@ -55,8 +56,6 @@ class BASE_EXPORT VlogInfo {
struct VmodulePattern; struct VmodulePattern;
std::vector<VmodulePattern> vmodule_levels_; std::vector<VmodulePattern> vmodule_levels_;
int* min_log_level_; int* min_log_level_;
DISALLOW_COPY_AND_ASSIGN(VlogInfo);
}; };
// Returns true if the string passed in matches the vlog pattern. The // Returns true if the string passed in matches the vlog pattern. The
......
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