Commit 6825df46 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove base/macros.h usage in base/containers.

Also fix files that failed to do IWYU and stopped building as a result.

Bug: 1010217
Change-Id: I6ab8e88728d33853ea62426046ecc1f92430cb28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2257994Reviewed-by: default avatarSophie Chang <sophiechang@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781369}
parent 8dc94aee
......@@ -10,8 +10,6 @@
#include <iterator>
#include <utility>
#include "base/macros.h"
namespace base {
namespace internal {
......@@ -24,14 +22,13 @@ class ReversedAdapter {
explicit ReversedAdapter(T& t) : t_(t) {}
ReversedAdapter(const ReversedAdapter& ra) : t_(ra.t_) {}
ReversedAdapter& operator=(const ReversedAdapter&) = delete;
Iterator begin() const { return std::rbegin(t_); }
Iterator end() const { return std::rend(t_); }
private:
T& t_;
DISALLOW_ASSIGN(ReversedAdapter);
};
} // namespace internal
......
......@@ -35,7 +35,6 @@
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/template_util.h"
#include "base/test/move_only_int.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -95,6 +94,8 @@ class Emplaceable {
other.int_ = 0;
other.double_ = 0.0;
}
Emplaceable(const Emplaceable&) = delete;
Emplaceable& operator=(const Emplaceable&) = delete;
Emplaceable& operator=(Emplaceable&& other) {
int_ = other.int_;
......@@ -115,8 +116,6 @@ class Emplaceable {
private:
int int_;
double double_;
DISALLOW_COPY_AND_ASSIGN(Emplaceable);
};
struct TemplateConstructor {
......
......@@ -16,7 +16,6 @@
#include "base/check_op.h"
#include "base/containers/flat_set.h"
#include "base/macros.h"
#include "base/notreached.h"
#include "base/sequence_checker.h"
......@@ -52,6 +51,9 @@ class IDMap final {
DETACH_FROM_SEQUENCE(sequence_checker_);
}
IDMap(const IDMap&) = delete;
IDMap& operator=(const IDMap&) = delete;
~IDMap() {
// Many IDMap's are static, and hence will be destroyed on the main
// thread. However, all the accesses may take place on another thread (or
......@@ -282,8 +284,6 @@ class IDMap final {
bool check_on_null_data_;
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(IDMap);
};
} // namespace base
......
......@@ -5,8 +5,6 @@
#ifndef BASE_CONTAINERS_LINKED_LIST_H_
#define BASE_CONTAINERS_LINKED_LIST_H_
#include "base/macros.h"
// Simple LinkedList type. (See the Q&A section to understand how this
// differs from std::list).
//
......@@ -102,6 +100,9 @@ class LinkNode {
}
}
LinkNode(const LinkNode&) = delete;
LinkNode& operator=(const LinkNode&) = delete;
// Insert |this| into the linked list, before |e|.
void InsertBefore(LinkNode<T>* e) {
this->next_ = e;
......@@ -148,8 +149,6 @@ class LinkNode {
private:
LinkNode<T>* previous_;
LinkNode<T>* next_;
DISALLOW_COPY_AND_ASSIGN(LinkNode);
};
template <typename T>
......@@ -159,6 +158,8 @@ class LinkedList {
// list (root_.next() will point back to the start of the list,
// and root_->previous() wraps around to the end of the list).
LinkedList() : root_(&root_, &root_) {}
LinkedList(const LinkedList&) = delete;
LinkedList& operator=(const LinkedList&) = delete;
// Appends |e| to the end of the linked list.
void Append(LinkNode<T>* e) {
......@@ -181,8 +182,6 @@ class LinkedList {
private:
LinkNode<T> root_;
DISALLOW_COPY_AND_ASSIGN(LinkedList);
};
} // namespace base
......
......@@ -26,7 +26,6 @@
#include <utility>
#include "base/check.h"
#include "base/macros.h"
namespace base {
namespace trace_event {
......@@ -82,6 +81,9 @@ class MRUCacheBase {
// can pass NO_AUTO_EVICT to not restrict the cache size.
explicit MRUCacheBase(size_type max_size) : max_size_(max_size) {}
MRUCacheBase(const MRUCacheBase&) = delete;
MRUCacheBase& operator=(const MRUCacheBase&) = delete;
virtual ~MRUCacheBase() = default;
size_type max_size() const { return max_size_; }
......@@ -211,8 +213,6 @@ class MRUCacheBase {
KeyIndex index_;
size_type max_size_;
DISALLOW_COPY_AND_ASSIGN(MRUCacheBase);
};
// MRUCache --------------------------------------------------------------------
......@@ -230,10 +230,9 @@ class MRUCache : public MRUCacheBase<KeyType, PayloadType, CompareType> {
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
explicit MRUCache(typename ParentType::size_type max_size)
: ParentType(max_size) {}
virtual ~MRUCache() = default;
private:
DISALLOW_COPY_AND_ASSIGN(MRUCache);
MRUCache(const MRUCache&) = delete;
MRUCache& operator=(const MRUCache&) = delete;
~MRUCache() override = default;
};
// HashingMRUCache ------------------------------------------------------------
......@@ -257,10 +256,9 @@ class HashingMRUCache
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
explicit HashingMRUCache(typename ParentType::size_type max_size)
: ParentType(max_size) {}
virtual ~HashingMRUCache() = default;
private:
DISALLOW_COPY_AND_ASSIGN(HashingMRUCache);
HashingMRUCache(const HashingMRUCache&) = delete;
HashingMRUCache& operator=(const HashingMRUCache&) = delete;
~HashingMRUCache() override = default;
};
} // namespace base
......
......@@ -8,7 +8,6 @@
#include <stddef.h>
#include "base/check.h"
#include "base/macros.h"
namespace base {
......@@ -25,6 +24,8 @@ template <typename T, size_t kSize>
class RingBuffer {
public:
RingBuffer() : current_index_(0) {}
RingBuffer(const RingBuffer&) = delete;
RingBuffer& operator=(const RingBuffer&) = delete;
size_t BufferSize() const { return kSize; }
......@@ -124,8 +125,6 @@ class RingBuffer {
T buffer_[kSize];
size_t current_index_;
DISALLOW_COPY_AND_ASSIGN(RingBuffer);
};
} // namespace base
......
......@@ -9,7 +9,6 @@
#include <vector>
#include "base/macros.h"
#include "build/build_config.h"
namespace base {
......@@ -147,6 +146,8 @@ class StackContainer {
// before doing anything else.
container_.reserve(stack_capacity);
}
StackContainer(const StackContainer&) = delete;
StackContainer& operator=(const StackContainer&) = delete;
// Getters for the actual container.
//
......@@ -175,9 +176,6 @@ class StackContainer {
typename Allocator::Source stack_data_;
Allocator allocator_;
ContainerType container_;
private:
DISALLOW_COPY_AND_ASSIGN(StackContainer);
};
// Range-based iteration support for StackContainer.
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_CONTAINERS_VECTOR_BUFFERS_H_
#define BASE_CONTAINERS_VECTOR_BUFFERS_H_
#ifndef BASE_CONTAINERS_VECTOR_BUFFER_H_
#define BASE_CONTAINERS_VECTOR_BUFFER_H_
#include <stdlib.h>
#include <string.h>
......@@ -13,7 +13,6 @@
#include "base/check_op.h"
#include "base/containers/util.h"
#include "base/macros.h"
#include "base/numerics/checked_math.h"
namespace base {
......@@ -57,6 +56,9 @@ class VectorBuffer {
other.capacity_ = 0;
}
VectorBuffer(const VectorBuffer&) = delete;
VectorBuffer& operator=(const VectorBuffer&) = delete;
~VectorBuffer() { free(buffer_); }
VectorBuffer& operator=(VectorBuffer&& other) {
......@@ -178,11 +180,9 @@ class VectorBuffer {
T* buffer_ = nullptr;
size_t capacity_ = 0;
DISALLOW_COPY_AND_ASSIGN(VectorBuffer);
};
} // namespace internal
} // namespace base
#endif // BASE_CONTAINERS_VECTOR_BUFFERS_H_
#endif // BASE_CONTAINERS_VECTOR_BUFFER_H_
......@@ -32,6 +32,9 @@ class PreviewsOptimizationGuide {
public:
explicit PreviewsOptimizationGuide(
optimization_guide::OptimizationGuideDecider* optimization_guide_decider);
PreviewsOptimizationGuide(const PreviewsOptimizationGuide&) = delete;
PreviewsOptimizationGuide& operator=(const PreviewsOptimizationGuide&) =
delete;
virtual ~PreviewsOptimizationGuide();
// Returns whether a Preview should be shown for the current conditions.
......@@ -67,8 +70,6 @@ class PreviewsOptimizationGuide {
// The optimization types registered with |optimization_guide_decider_|.
const base::flat_set<optimization_guide::proto::OptimizationType>
registered_optimization_types_;
DISALLOW_COPY_AND_ASSIGN(PreviewsOptimizationGuide);
};
} // namespace previews
......
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