[Zucchini] Replace DISALLOW_* macros with =delete versions.

This CL replaces
* 30 instances of DISALLOW_COPY_AND_ASSIGN(Foo),
* 1 instance of DISALLOW_IMPLICIT_CONSTRUCTORS(Foo),
in Zucchini with:
  Foo() = delete;  // DISALLOW_IMPLICIT_CONSTRUCTORS only.
  Foo(const Foo&) = delete;
  const Foo& operator=(const Foo&) = delete;

All base/macros.h includes are removed.

Bug: 1010217
Change-Id: I13b3d5ed04f04e5c0b209d59e70ac018c5f4938c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3093198
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#911751}
NOKEYCHECK=True
GitOrigin-RevId: ba0e1f56993c535faa59e2ca02c371bae2ebbb20
diff --git a/abs32_utils.h b/abs32_utils.h
index f13f562..07503b5 100644
--- a/abs32_utils.h
+++ b/abs32_utils.h
@@ -10,7 +10,6 @@
 
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/address_translator.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/image_utils.h"
@@ -94,6 +93,8 @@
  public:
   Abs32ReaderWin32(Abs32RvaExtractorWin32&& abs32_rva_extractor,
                    const AddressTranslator& translator);
+  Abs32ReaderWin32(const Abs32ReaderWin32&) = delete;
+  const Abs32ReaderWin32& operator=(const Abs32ReaderWin32&) = delete;
   ~Abs32ReaderWin32() override;
 
   // ReferenceReader:
@@ -102,8 +103,6 @@
  private:
   Abs32RvaExtractorWin32 abs32_rva_extractor_;
   AddressTranslator::RvaToOffsetCache target_rva_to_offset_;
-
-  DISALLOW_COPY_AND_ASSIGN(Abs32ReaderWin32);
 };
 
 // A writer for Win32 abs32 references. |addr| determines the bitness of the
@@ -113,6 +112,8 @@
   Abs32WriterWin32(MutableBufferView image,
                    AbsoluteAddress&& addr,
                    const AddressTranslator& translator);
+  Abs32WriterWin32(const Abs32WriterWin32&) = delete;
+  const Abs32WriterWin32& operator=(const Abs32WriterWin32&) = delete;
   ~Abs32WriterWin32() override;
 
   // ReferenceWriter:
@@ -122,8 +123,6 @@
   MutableBufferView image_;
   AbsoluteAddress addr_;
   AddressTranslator::OffsetToRvaCache target_offset_to_rva_;
-
-  DISALLOW_COPY_AND_ASSIGN(Abs32WriterWin32);
 };
 
 // Given a list of abs32 |locations|, removes all elements whose targets cannot
diff --git a/binary_data_histogram.h b/binary_data_histogram.h
index 3950ab7..201f90a 100644
--- a/binary_data_histogram.h
+++ b/binary_data_histogram.h
@@ -11,7 +11,6 @@
 #include <memory>
 #include <string>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 
 namespace zucchini {
@@ -24,6 +23,8 @@
 class OutlierDetector {
  public:
   OutlierDetector();
+  OutlierDetector(const OutlierDetector&) = delete;
+  const OutlierDetector& operator=(const OutlierDetector&) = delete;
   ~OutlierDetector();
 
   // Incorporates |sample| into mean and standard deviation.
@@ -47,8 +48,6 @@
   double sum_of_squares_ = 0;
   double mean_ = 0;
   double standard_deviation_ = 0;
-
-  DISALLOW_COPY_AND_ASSIGN(OutlierDetector);
 };
 
 // A class to compute similarity score between binary data. The heuristic here
@@ -58,6 +57,8 @@
 class BinaryDataHistogram {
  public:
   BinaryDataHistogram();
+  BinaryDataHistogram(const BinaryDataHistogram&) = delete;
+  const BinaryDataHistogram& operator=(const BinaryDataHistogram&) = delete;
   ~BinaryDataHistogram();
 
   // Attempts to compute the histogram, returns true iff successful.
@@ -82,8 +83,6 @@
   // are stored as signed values to simplify computing the distance between two
   // histograms.
   std::unique_ptr<int32_t[]> histogram_;
-
-  DISALLOW_COPY_AND_ASSIGN(BinaryDataHistogram);
 };
 
 }  // namespace zucchini
diff --git a/disassembler.h b/disassembler.h
index 8fd5a3a..48ee0fb 100644
--- a/disassembler.h
+++ b/disassembler.h
@@ -11,7 +11,6 @@
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/image_utils.h"
 
@@ -54,6 +53,8 @@
     return disasm;
   }
 
+  Disassembler(const Disassembler&) = delete;
+  const Disassembler& operator=(const Disassembler&) = delete;
   virtual ~Disassembler();
 
   // Returns the type of executable handled by the Disassembler.
@@ -85,8 +86,6 @@
   // The number of iterations to run for equivalence map generation. This should
   // roughly be the max length of reference indirection chains.
   int num_equivalence_iterations_;
-
-  DISALLOW_COPY_AND_ASSIGN(Disassembler);
 };
 
 // A ReferenceGroup is associated with a specific |type| and has convenience
diff --git a/disassembler_dex.cc b/disassembler_dex.cc
index a835fb2..5b25c50 100644
--- a/disassembler_dex.cc
+++ b/disassembler_dex.cc
@@ -630,6 +630,9 @@
     if (cur_it_ != item_offsets.begin() && *(cur_it_ - 1) + rel_location_ >= lo)
       --cur_it_;
   }
+  CachedItemListReferenceReader(const CachedItemListReferenceReader&) = delete;
+  const CachedItemListReferenceReader& operator=(
+      const CachedItemListReferenceReader&) = delete;
 
   // ReferenceReader:
   absl::optional<Reference> GetNext() override {
@@ -659,8 +662,6 @@
   const std::vector<offset_t>::const_iterator end_it_;
   const Mapper mapper_;
   std::vector<offset_t>::const_iterator cur_it_;
-
-  DISALLOW_COPY_AND_ASSIGN(CachedItemListReferenceReader);
 };
 
 // Reads an INT index at |location| in |image| and translates the index to the
diff --git a/disassembler_dex.h b/disassembler_dex.h
index ecc4be6..2038a3c 100644
--- a/disassembler_dex.h
+++ b/disassembler_dex.h
@@ -12,7 +12,6 @@
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/disassembler.h"
 #include "components/zucchini/image_utils.h"
 #include "components/zucchini/type_dex.h"
@@ -112,6 +111,8 @@
   };
 
   DisassemblerDex();
+  DisassemblerDex(const DisassemblerDex&) = delete;
+  const DisassemblerDex& operator=(const DisassemblerDex&) = delete;
   ~DisassemblerDex() override;
 
   // Applies quick checks to determine if |image| *may* point to the start of an
@@ -265,8 +266,6 @@
   std::vector<offset_t> annotations_directory_item_method_annotation_offsets_;
   std::vector<offset_t>
       annotations_directory_item_parameter_annotation_offsets_;
-
-  DISALLOW_COPY_AND_ASSIGN(DisassemblerDex);
 };
 
 }  // namespace zucchini
diff --git a/disassembler_no_op.h b/disassembler_no_op.h
index 280e8df..ef10651 100644
--- a/disassembler_no_op.h
+++ b/disassembler_no_op.h
@@ -9,7 +9,6 @@
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/disassembler.h"
 #include "components/zucchini/image_utils.h"
@@ -20,6 +19,8 @@
 class DisassemblerNoOp : public Disassembler {
  public:
   DisassemblerNoOp();
+  DisassemblerNoOp(const DisassemblerNoOp&) = delete;
+  const DisassemblerNoOp& operator=(const DisassemblerNoOp&) = delete;
   ~DisassemblerNoOp() override;
 
   // Disassembler:
@@ -31,8 +32,6 @@
   friend Disassembler;
 
   bool Parse(ConstBufferView image) override;
-
-  DISALLOW_COPY_AND_ASSIGN(DisassemblerNoOp);
 };
 
 }  // namespace zucchini
diff --git a/disassembler_win32.h b/disassembler_win32.h
index d952014..77b65ac 100644
--- a/disassembler_win32.h
+++ b/disassembler_win32.h
@@ -14,7 +14,6 @@
 #include <utility>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/address_translator.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/disassembler.h"
@@ -63,6 +62,8 @@
   static bool QuickDetect(ConstBufferView image);
 
   DisassemblerWin32();
+  DisassemblerWin32(const DisassemblerWin32&) = delete;
+  const DisassemblerWin32& operator=(const DisassemblerWin32&) = delete;
   ~DisassemblerWin32() override;
 
   // Disassembler:
@@ -120,8 +121,6 @@
   bool has_parsed_relocs_ = false;
   bool has_parsed_abs32_ = false;
   bool has_parsed_rel32_ = false;
-
-  DISALLOW_COPY_AND_ASSIGN(DisassemblerWin32);
 };
 
 using DisassemblerWin32X86 = DisassemblerWin32<Win32X86Traits>;
diff --git a/disassembler_ztf.cc b/disassembler_ztf.cc
index f822d8b..dfe9045 100644
--- a/disassembler_ztf.cc
+++ b/disassembler_ztf.cc
@@ -11,7 +11,6 @@
 #include <numeric>
 
 #include "base/check_op.h"
-#include "base/macros.h"
 #include "base/numerics/checked_math.h"
 #include "base/numerics/safe_conversions.h"
 #include "components/zucchini/algorithm.h"
@@ -88,6 +87,9 @@
               ztf::kMaxDimValue);
   }
 
+  ZtfParser(const ZtfParser&) = delete;
+  const ZtfParser& operator=(const ZtfParser&) = delete;
+
   // Attempts to match an absolute reference at |offset|. If successful then
   // assigns the result to |abs_lc| and returns true. Otherwise returns false.
   // An absolute reference takes the form:
@@ -164,8 +166,6 @@
   const offset_t hi_;
   const ZtfConfig config_;
   offset_t offset_ = 0;
-
-  DISALLOW_COPY_AND_ASSIGN(ZtfParser);
 };
 
 /******** ZtfWriter ********/
@@ -180,6 +180,9 @@
         val_bound_(
             static_cast<ztf::dim_t>(std::pow(10, config_.digits_per_dim))) {}
 
+  ZtfWriter(const ZtfWriter&) = delete;
+  const ZtfWriter& operator=(const ZtfWriter&) = delete;
+
   // Write an absolute reference |abs_ref| at |offset|. Note that references
   // that would overwrite a newline are skipped as this would invalidate all
   // the other reference line numbers.
@@ -268,7 +271,6 @@
   // Bound on numeric values, as limited by |config_.digits_per_dim|.
   const ztf::dim_t val_bound_;
   offset_t offset_ = 0;
-  DISALLOW_COPY_AND_ASSIGN(ZtfWriter);
 };
 
 // Specialization of ReferenceReader for reading text references.
diff --git a/disassembler_ztf.h b/disassembler_ztf.h
index adbead5..0e73c2a 100644
--- a/disassembler_ztf.h
+++ b/disassembler_ztf.h
@@ -12,7 +12,6 @@
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/disassembler.h"
 #include "components/zucchini/image_utils.h"
 #include "components/zucchini/type_ztf.h"
@@ -81,6 +80,8 @@
 class ZtfTranslator {
  public:
   ZtfTranslator();
+  ZtfTranslator(const ZtfTranslator&) = delete;
+  const ZtfTranslator& operator=(const ZtfTranslator&) = delete;
   ~ZtfTranslator();
 
   // Initializes |line_starts_| with the contents of |image|.
@@ -117,7 +118,6 @@
   // |line_starts_| is a sorted list of each line's starting offset, along with
   // the image size as the sentinel; it looks like {0, ..., image.size}.
   std::vector<offset_t> line_starts_;
-  DISALLOW_COPY_AND_ASSIGN(ZtfTranslator);
 };
 
 // Disassembler for Zucchini Text Format (ZTF).
@@ -162,6 +162,8 @@
   };
 
   DisassemblerZtf();
+  DisassemblerZtf(const DisassemblerZtf&) = delete;
+  const DisassemblerZtf& operator=(const DisassemblerZtf&) = delete;
   ~DisassemblerZtf() override;
 
   // Applies quick checks to determine if |image| *may* point to the start of a
@@ -192,8 +194,6 @@
   bool Parse(ConstBufferView image) override;
 
   ZtfTranslator translator_;
-
-  DISALLOW_COPY_AND_ASSIGN(DisassemblerZtf);
 };
 
 }  // namespace zucchini
diff --git a/element_detection.h b/element_detection.h
index d3dcb47..856ec27 100644
--- a/element_detection.h
+++ b/element_detection.h
@@ -10,7 +10,6 @@
 #include <memory>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/image_utils.h"
 #include "third_party/abseil-cpp/absl/types/optional.h"
@@ -41,6 +40,8 @@
 class ElementFinder {
  public:
   ElementFinder(ConstBufferView image, ElementDetector&& detector);
+  ElementFinder(const ElementFinder&) = delete;
+  const ElementFinder& operator=(const ElementFinder&) = delete;
   ~ElementFinder();
 
   // Scans for the next executable using |detector|. Returns the next element
@@ -51,8 +52,6 @@
   ConstBufferView image_;
   ElementDetector detector_;
   offset_t pos_ = 0;
-
-  DISALLOW_COPY_AND_ASSIGN(ElementFinder);
 };
 
 }  // namespace zucchini
diff --git a/encoded_view.h b/encoded_view.h
index bd88099..864d265 100644
--- a/encoded_view.h
+++ b/encoded_view.h
@@ -11,7 +11,6 @@
 #include <iterator>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/image_index.h"
 #include "components/zucchini/image_utils.h"
 
@@ -136,6 +135,8 @@
   // |image_index| is the annotated image being adapted, and is required to
   // remain valid for the lifetime of the object.
   explicit EncodedView(const ImageIndex& image_index);
+  EncodedView(const EncodedView&) = delete;
+  const EncodedView& operator=(const EncodedView&) = delete;
   ~EncodedView();
 
   // Projects |location| to a scalar value that describes the content at a
@@ -177,8 +178,6 @@
 
   const ImageIndex& image_index_;
   std::vector<PoolInfo> pool_infos_;
-
-  DISALLOW_COPY_AND_ASSIGN(EncodedView);
 };
 
 }  // namespace zucchini
diff --git a/ensemble_matcher.h b/ensemble_matcher.h
index bc89883..b188657 100644
--- a/ensemble_matcher.h
+++ b/ensemble_matcher.h
@@ -9,7 +9,6 @@
 
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/element_detection.h"
 #include "components/zucchini/image_utils.h"
@@ -29,6 +28,8 @@
 class EnsembleMatcher {
  public:
   EnsembleMatcher();
+  EnsembleMatcher(const EnsembleMatcher&) = delete;
+  const EnsembleMatcher& operator=(const EnsembleMatcher&) = delete;
   virtual ~EnsembleMatcher();
 
   // Interface to main matching feature. Returns whether match was successful.
@@ -52,9 +53,6 @@
   // Number of identical matches found in match candidates. These should be
   // excluded from |matches_|.
   size_t num_identical_ = 0;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(EnsembleMatcher);
 };
 
 }  // namespace zucchini
diff --git a/heuristic_ensemble_matcher.cc b/heuristic_ensemble_matcher.cc
index c812cb4..2f01d34 100644
--- a/heuristic_ensemble_matcher.cc
+++ b/heuristic_ensemble_matcher.cc
@@ -83,6 +83,8 @@
 class MatchingInfoOut {
  protected:
   MatchingInfoOut() = default;
+  MatchingInfoOut(const MatchingInfoOut&) = delete;
+  const MatchingInfoOut& operator=(const MatchingInfoOut&) = delete;
 
  public:
   virtual ~MatchingInfoOut() = default;
@@ -108,9 +110,6 @@
   virtual void OutputScores(const std::string& stats) {}
 
   virtual void OutputTextGrid() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MatchingInfoOut);
 };
 
 /******** MatchingInfoTerse ********/
@@ -119,14 +118,13 @@
 class MatchingInfoOutTerse : public MatchingInfoOut {
  public:
   MatchingInfoOutTerse() = default;
+  MatchingInfoOutTerse(const MatchingInfoOutTerse&) = delete;
+  const MatchingInfoOutTerse& operator=(const MatchingInfoOutTerse&) = delete;
   ~MatchingInfoOutTerse() override = default;
 
   void OutputScores(const std::string& stats) override {
     LOG(INFO) << "Best dists: " << stats;
   }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MatchingInfoOutTerse);
 };
 
 /******** MatchingInfoOutVerbose ********/
@@ -137,6 +135,9 @@
 class MatchingInfoOutVerbose : public MatchingInfoOut {
  public:
   explicit MatchingInfoOutVerbose(std::ostream& out) : out_(out) {}
+  MatchingInfoOutVerbose(const MatchingInfoOutVerbose&) = delete;
+  const MatchingInfoOutVerbose& operator=(const MatchingInfoOutVerbose&) =
+      delete;
   ~MatchingInfoOutVerbose() override = default;
 
   // Outputs sizes and initializes |text_grid_|.
@@ -226,9 +227,6 @@
 
   // For each "new" element, distance of best match. -1 denotes no match.
   std::vector<double> best_dist_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(MatchingInfoOutVerbose);
 };
 
 }  // namespace
diff --git a/heuristic_ensemble_matcher.h b/heuristic_ensemble_matcher.h
index 1adb998..ec40787 100644
--- a/heuristic_ensemble_matcher.h
+++ b/heuristic_ensemble_matcher.h
@@ -7,7 +7,6 @@
 
 #include <ostream>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/ensemble_matcher.h"
 
@@ -22,6 +21,9 @@
 class HeuristicEnsembleMatcher : public EnsembleMatcher {
  public:
   explicit HeuristicEnsembleMatcher(std::ostream* out);
+  HeuristicEnsembleMatcher(const HeuristicEnsembleMatcher&) = delete;
+  const HeuristicEnsembleMatcher& operator=(const HeuristicEnsembleMatcher&) =
+      delete;
   ~HeuristicEnsembleMatcher() override;
 
   // EnsembleMatcher:
@@ -30,8 +32,6 @@
  private:
   // Optional stream to print detailed information during matching.
   std::ostream* out_ = nullptr;
-
-  DISALLOW_COPY_AND_ASSIGN(HeuristicEnsembleMatcher);
 };
 
 }  // namespace zucchini
diff --git a/image_utils.h b/image_utils.h
index d948a91..748e20b 100644
--- a/image_utils.h
+++ b/image_utils.h
@@ -11,7 +11,6 @@
 #include <string>
 
 #include "base/format_macros.h"
-#include "base/macros.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/stringprintf.h"
 #include "components/zucchini/buffer_view.h"
diff --git a/imposed_ensemble_matcher.h b/imposed_ensemble_matcher.h
index 4dfc38e..39b0df5 100644
--- a/imposed_ensemble_matcher.h
+++ b/imposed_ensemble_matcher.h
@@ -10,7 +10,6 @@
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/element_detection.h"
 #include "components/zucchini/ensemble_matcher.h"
@@ -34,6 +33,8 @@
   };
 
   ImposedMatchParser();
+  ImposedMatchParser(const ImposedMatchParser&) = delete;
+  const ImposedMatchParser& operator=(const ImposedMatchParser&) = delete;
   ~ImposedMatchParser();
 
   // Parses |imposed_matches| and writes the results to member variables.
@@ -57,8 +58,6 @@
   // unsupported image types (which will simply be ignored). Note that imposing
   // matches for known but incompatible image types would result in error.
   std::vector<ElementMatch> bad_matches_;
-
-  DISALLOW_COPY_AND_ASSIGN(ImposedMatchParser);
 };
 
 // An ensemble matcher that parses a format string that describes matches.
@@ -67,6 +66,9 @@
   // |imposed_matches| specifies imposed maches, using a format described below.
   // Validation is performed in RunMatch().
   explicit ImposedEnsembleMatcher(const std::string& imposed_matches);
+  ImposedEnsembleMatcher(const ImposedEnsembleMatcher&) = delete;
+  const ImposedEnsembleMatcher& operator=(const ImposedEnsembleMatcher&) =
+      delete;
   ~ImposedEnsembleMatcher() override;
 
   // EnsembleMatcher:
@@ -74,8 +76,6 @@
 
  private:
   const std::string imposed_matches_;
-
-  DISALLOW_COPY_AND_ASSIGN(ImposedEnsembleMatcher);
 };
 
 }  // namespace zucchini
diff --git a/io_utils.h b/io_utils.h
index 56f7075..63eeec8 100644
--- a/io_utils.h
+++ b/io_utils.h
@@ -13,8 +13,6 @@
 #include <sstream>
 #include <string>
 
-#include "base/macros.h"
-
 namespace zucchini {
 
 // An std::ostream wrapper that that limits number of std::endl lines to output,
@@ -44,12 +42,12 @@
 
  public:
   LimitedOutputStream(std::ostream& os, int limit);
+  LimitedOutputStream(const LimitedOutputStream&) = delete;
+  const LimitedOutputStream& operator=(const LimitedOutputStream&) = delete;
   bool full() const { return buf_.full(); }
 
  private:
   StreamBuf buf_;
-
-  DISALLOW_COPY_AND_ASSIGN(LimitedOutputStream);
 };
 
 // A class to render hexadecimal numbers for std::ostream with 0-padding. This
@@ -88,14 +86,14 @@
 class PrefixSep {
  public:
   explicit PrefixSep(const std::string& sep_str) : sep_str_(sep_str) {}
+  PrefixSep(const PrefixSep&) = delete;
+  const PrefixSep& operator=(const PrefixSep&) = delete;
 
   friend std::ostream& operator<<(std::ostream& ostr, PrefixSep& obj);
 
  private:
   std::string sep_str_;
   bool first_ = true;
-
-  DISALLOW_COPY_AND_ASSIGN(PrefixSep);
 };
 
 // An input manipulator that dictates the expected next character in
@@ -103,6 +101,8 @@
 class EatChar {
  public:
   explicit EatChar(char ch) : ch_(ch) {}
+  EatChar(const EatChar&) = delete;
+  const EatChar& operator=(const EatChar&) = delete;
 
   friend inline std::istream& operator>>(std::istream& istr,
                                          const EatChar& obj) {
@@ -113,8 +113,6 @@
 
  private:
   char ch_;
-
-  DISALLOW_COPY_AND_ASSIGN(EatChar);
 };
 
 // An input manipulator that reads an unsigned integer from |std::istream|,
diff --git a/mapped_file.h b/mapped_file.h
index e8cd590..f15e09a 100644
--- a/mapped_file.h
+++ b/mapped_file.h
@@ -13,7 +13,6 @@
 #include "base/files/file.h"
 #include "base/files/file_path.h"
 #include "base/files/memory_mapped_file.h"
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 
 namespace zucchini {
@@ -24,6 +23,8 @@
   // Maps |file| to memory for reading. Also validates |file|. Errors are
   // available via HasError() and error().
   explicit MappedFileReader(base::File file);
+  MappedFileReader(const MappedFileReader&) = delete;
+  const MappedFileReader& operator=(const MappedFileReader&) = delete;
 
   const uint8_t* data() const { return buffer_.data(); }
   size_t length() const { return buffer_.length(); }
@@ -35,8 +36,6 @@
  private:
   std::string error_;
   base::MemoryMappedFile buffer_;
-
-  DISALLOW_COPY_AND_ASSIGN(MappedFileReader);
 };
 
 // A file writer wrapper. The target file is deleted on destruction unless
@@ -49,6 +48,8 @@
   MappedFileWriter(const base::FilePath& file_path,
                    base::File file,
                    size_t length);
+  MappedFileWriter(const MappedFileWriter&) = delete;
+  const MappedFileWriter& operator=(const MappedFileWriter&) = delete;
   ~MappedFileWriter();
 
   uint8_t* data() { return buffer_.data(); }
@@ -74,8 +75,6 @@
   base::File file_handle_;
   base::MemoryMappedFile buffer_;
   OnCloseDeleteBehavior delete_behavior_;
-
-  DISALLOW_COPY_AND_ASSIGN(MappedFileWriter);
 };
 
 }  // namespace zucchini
diff --git a/patch_writer.h b/patch_writer.h
index 3d42173..26b7baf 100644
--- a/patch_writer.h
+++ b/patch_writer.h
@@ -13,7 +13,6 @@
 #include <vector>
 
 #include "base/check.h"
-#include "base/macros.h"
 #include "components/zucchini/buffer_sink.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/image_utils.h"
@@ -237,6 +236,8 @@
  public:
   explicit EnsemblePatchWriter(const PatchHeader& header);
   EnsemblePatchWriter(ConstBufferView old_image, ConstBufferView new_image);
+  EnsemblePatchWriter(const EnsemblePatchWriter&) = delete;
+  const EnsemblePatchWriter& operator=(const EnsemblePatchWriter&) = delete;
   ~EnsemblePatchWriter();
 
   // Reserves space for |count| patch elements.
@@ -264,8 +265,6 @@
   PatchHeader header_;
   std::vector<PatchElementWriter> elements_;
   offset_t current_dst_offset_ = 0;
-
-  DISALLOW_COPY_AND_ASSIGN(EnsemblePatchWriter);
 };
 
 }  // namespace zucchini
diff --git a/reference_set.cc b/reference_set.cc
index 14d4e54..82a9951 100644
--- a/reference_set.cc
+++ b/reference_set.cc
@@ -8,7 +8,6 @@
 #include <iterator>
 
 #include "base/check_op.h"
-#include "base/macros.h"
 #include "components/zucchini/target_pool.h"
 
 namespace zucchini {
diff --git a/suffix_array.h b/suffix_array.h
index cf9af7d..75b3a38 100644
--- a/suffix_array.h
+++ b/suffix_array.h
@@ -11,7 +11,6 @@
 #include <vector>
 
 #include "base/check.h"
-#include "base/macros.h"
 
 namespace zucchini {
 
@@ -425,8 +424,9 @@
                   suffix_array);
     }
 
-   private:
-    DISALLOW_IMPLICIT_CONSTRUCTORS(Implementation);
+    Implementation() = delete;
+    Implementation(const Implementation&) = delete;
+    const Implementation& operator=(const Implementation&) = delete;
   };
 };
 
diff --git a/targets_affinity.h b/targets_affinity.h
index 3a154e7..dff1741 100644
--- a/targets_affinity.h
+++ b/targets_affinity.h
@@ -10,7 +10,6 @@
 
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/image_utils.h"
 
 namespace zucchini {
@@ -22,6 +21,8 @@
 class TargetsAffinity {
  public:
   TargetsAffinity();
+  TargetsAffinity(const TargetsAffinity&) = delete;
+  const TargetsAffinity& operator=(const TargetsAffinity&) = delete;
   ~TargetsAffinity();
 
   // Infers affinity between |old_targets| and |new_targets| using similarities
@@ -65,8 +66,6 @@
   // lookup, given |old_key| or |new_key|.
   std::vector<Association> forward_association_;
   std::vector<Association> backward_association_;
-
-  DISALLOW_COPY_AND_ASSIGN(TargetsAffinity);
 };
 
 }  // namespace zucchini
diff --git a/test_disassembler.h b/test_disassembler.h
index 427ed91..e434fc4 100644
--- a/test_disassembler.h
+++ b/test_disassembler.h
@@ -9,7 +9,6 @@
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/disassembler.h"
 #include "components/zucchini/image_utils.h"
@@ -28,6 +27,8 @@
                    const std::vector<Reference>& refs2,
                    const ReferenceTypeTraits& traits3,
                    const std::vector<Reference>& refs3);
+  TestDisassembler(const TestDisassembler&) = delete;
+  const TestDisassembler& operator=(const TestDisassembler&) = delete;
   ~TestDisassembler() override;
 
   // Disassembler:
@@ -69,8 +70,6 @@
 
   ReferenceTypeTraits traits_[3];
   std::vector<Reference> refs_[3];
-
-  DISALLOW_COPY_AND_ASSIGN(TestDisassembler);
 };
 
 }  // namespace zucchini
diff --git a/zucchini_commands.cc b/zucchini_commands.cc
index 106b256..93929bd 100644
--- a/zucchini_commands.cc
+++ b/zucchini_commands.cc
@@ -16,7 +16,6 @@
 #include "base/files/file_path.h"
 #include "base/files/memory_mapped_file.h"
 #include "base/logging.h"
-#include "base/macros.h"
 #include "components/zucchini/buffer_view.h"
 #include "components/zucchini/crc32.h"
 #include "components/zucchini/io_utils.h"