[go: nahoru, domu]

base: Add out-of-line copy ctors for complex classes.

This patch adds out of line copy constructors for classes that our
clang-plugin considers heavy. This is an effort to enable copy
constructor checks by default.

BUG=436357
R=dcheng@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/1730873002

Cr-Commit-Position: refs/heads/master@{#377443}
diff --git a/base/test/gtest_util.cc b/base/test/gtest_util.cc
index b9ab4a3a..8ad54364 100644
--- a/base/test/gtest_util.cc
+++ b/base/test/gtest_util.cc
@@ -16,6 +16,8 @@
 TestIdentifier::TestIdentifier() {
 }
 
+TestIdentifier::TestIdentifier(const TestIdentifier& other) = default;
+
 std::string FormatFullTestName(const std::string& test_case_name,
                                const std::string& test_name) {
   return test_case_name + "." + test_name;
diff --git a/base/test/gtest_util.h b/base/test/gtest_util.h
index c0e088f4..f353d83 100644
--- a/base/test/gtest_util.h
+++ b/base/test/gtest_util.h
@@ -17,6 +17,7 @@
 
 struct TestIdentifier {
   TestIdentifier();
+  TestIdentifier(const TestIdentifier& other);
 
   std::string test_case_name;
   std::string test_name;
diff --git a/base/test/launcher/test_results_tracker.cc b/base/test/launcher/test_results_tracker.cc
index b6516ec..813e8e4 100644
--- a/base/test/launcher/test_results_tracker.cc
+++ b/base/test/launcher/test_results_tracker.cc
@@ -358,12 +358,18 @@
 TestResultsTracker::AggregateTestResult::AggregateTestResult() {
 }
 
+TestResultsTracker::AggregateTestResult::AggregateTestResult(
+    const AggregateTestResult& other) = default;
+
 TestResultsTracker::AggregateTestResult::~AggregateTestResult() {
 }
 
 TestResultsTracker::PerIterationData::PerIterationData() {
 }
 
+TestResultsTracker::PerIterationData::PerIterationData(
+    const PerIterationData& other) = default;
+
 TestResultsTracker::PerIterationData::~PerIterationData() {
 }
 
diff --git a/base/test/launcher/test_results_tracker.h b/base/test/launcher/test_results_tracker.h
index 163d75e..8910f73 100644
--- a/base/test/launcher/test_results_tracker.h
+++ b/base/test/launcher/test_results_tracker.h
@@ -85,6 +85,7 @@
 
   struct AggregateTestResult {
     AggregateTestResult();
+    AggregateTestResult(const AggregateTestResult& other);
     ~AggregateTestResult();
 
     std::vector<TestResult> test_results;
@@ -92,6 +93,7 @@
 
   struct PerIterationData {
     PerIterationData();
+    PerIterationData(const PerIterationData& other);
     ~PerIterationData();
 
     // Aggregate test results grouped by full test name.
diff --git a/base/test/test_pending_task.cc b/base/test/test_pending_task.cc
index 3f2c79df..7347e45 100644
--- a/base/test/test_pending_task.cc
+++ b/base/test/test_pending_task.cc
@@ -22,6 +22,8 @@
       delay(delay),
       nestability(nestability) {}
 
+TestPendingTask::TestPendingTask(const TestPendingTask& other) = default;
+
 TimeTicks TestPendingTask::GetTimeToRun() const {
   return post_time + delay;
 }
diff --git a/base/test/test_pending_task.h b/base/test/test_pending_task.h
index 829baa6..df5eadec 100644
--- a/base/test/test_pending_task.h
+++ b/base/test/test_pending_task.h
@@ -21,6 +21,7 @@
   enum TestNestability { NESTABLE, NON_NESTABLE };
 
   TestPendingTask();
+  TestPendingTask(const TestPendingTask& other);
   TestPendingTask(const tracked_objects::Location& location,
                   const Closure& task,
                   TimeTicks post_time,
diff --git a/base/test/trace_event_analyzer.cc b/base/test/trace_event_analyzer.cc
index 2046355..fc775f2 100644
--- a/base/test/trace_event_analyzer.cc
+++ b/base/test/trace_event_analyzer.cc
@@ -26,6 +26,8 @@
       other_event(NULL) {
 }
 
+TraceEvent::TraceEvent(const TraceEvent& other) = default;
+
 TraceEvent::~TraceEvent() {
 }
 
diff --git a/base/test/trace_event_analyzer.h b/base/test/trace_event_analyzer.h
index f67445ace..253dbb4 100644
--- a/base/test/trace_event_analyzer.h
+++ b/base/test/trace_event_analyzer.h
@@ -111,6 +111,7 @@
   };
 
   TraceEvent();
+  TraceEvent(const TraceEvent& other);
   ~TraceEvent();
 
   bool SetFromJSON(const base::Value* event_value) WARN_UNUSED_RESULT;
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index c5a71bb6..1d2ae64 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -52,6 +52,8 @@
       priority(ThreadPriority::NORMAL) {
 }
 
+Thread::Options::Options(const Options& other) = default;
+
 Thread::Options::~Options() {
 }
 
diff --git a/base/threading/thread.h b/base/threading/thread.h
index da985da..ec19722 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -45,6 +45,7 @@
 
     Options();
     Options(MessageLoop::Type type, size_t size);
+    Options(const Options& other);
     ~Options();
 
     // Specifies the type of message loop that will be allocated on the thread.
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index 543e436b..d24cedf 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -968,6 +968,9 @@
 #endif
 }
 
+ProcessDataSnapshot::ProcessDataSnapshot(const ProcessDataSnapshot& other) =
+    default;
+
 ProcessDataSnapshot::~ProcessDataSnapshot() {
 }
 
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 4553c0a..168b17db 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -808,6 +808,7 @@
 struct BASE_EXPORT ProcessDataSnapshot {
  public:
   ProcessDataSnapshot();
+  ProcessDataSnapshot(const ProcessDataSnapshot& other);
   ~ProcessDataSnapshot();
 
   PhasedProcessDataSnapshotMap phased_snapshots;
diff --git a/base/values.cc b/base/values.cc
index ab3c38a..5a789e9 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -837,6 +837,8 @@
     : target_(target),
       it_(target.dictionary_.begin()) {}
 
+DictionaryValue::Iterator::Iterator(const Iterator& other) = default;
+
 DictionaryValue::Iterator::~Iterator() {}
 
 DictionaryValue* DictionaryValue::DeepCopy() const {
diff --git a/base/values.h b/base/values.h
index 07e5b6c..141ea93 100644
--- a/base/values.h
+++ b/base/values.h
@@ -360,6 +360,7 @@
   class BASE_EXPORT Iterator {
    public:
     explicit Iterator(const DictionaryValue& target);
+    Iterator(const Iterator& other);
     ~Iterator();
 
     bool IsAtEnd() const { return it_ == target_.dictionary_.end(); }
diff --git a/base/version.cc b/base/version.cc
index 19b9922..02213fb 100644
--- a/base/version.cc
+++ b/base/version.cc
@@ -80,6 +80,8 @@
 Version::Version() {
 }
 
+Version::Version(const Version& other) = default;
+
 Version::~Version() {
 }
 
diff --git a/base/version.h b/base/version.h
index 30cb735..25b570a 100644
--- a/base/version.h
+++ b/base/version.h
@@ -23,6 +23,8 @@
   // Version object is assign to it.
   Version();
 
+  Version(const Version& other);
+
   ~Version();
 
   // Initializes from a decimal dotted version number, like "0.1.1".