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

remove DISALLOW_COPY_AND_ASSIGN from base/metrics/*

A few cpp lint fixes, no functional changes.

Bug: 1010217
Change-Id: Ia08f6fe65e937d0155e3b25184d061d7bd736f76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412748Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807615}
parent 3f30a029
...@@ -18,8 +18,10 @@ namespace { ...@@ -18,8 +18,10 @@ namespace {
// Helper classes for DummyHistogram. // Helper classes for DummyHistogram.
class DummySampleCountIterator : public SampleCountIterator { class DummySampleCountIterator : public SampleCountIterator {
public: public:
DummySampleCountIterator() {} DummySampleCountIterator() = default;
~DummySampleCountIterator() override {} DummySampleCountIterator(const DummySampleCountIterator&) = delete;
DummySampleCountIterator& operator=(const DummySampleCountIterator&) = delete;
~DummySampleCountIterator() override = default;
// SampleCountIterator: // SampleCountIterator:
bool Done() const override { return true; } bool Done() const override { return true; }
...@@ -29,14 +31,13 @@ class DummySampleCountIterator : public SampleCountIterator { ...@@ -29,14 +31,13 @@ class DummySampleCountIterator : public SampleCountIterator {
HistogramBase::Count* count) const override { HistogramBase::Count* count) const override {
NOTREACHED(); NOTREACHED();
} }
private:
DISALLOW_COPY_AND_ASSIGN(DummySampleCountIterator);
}; };
class DummyHistogramSamples : public HistogramSamples { class DummyHistogramSamples : public HistogramSamples {
public: public:
explicit DummyHistogramSamples() : HistogramSamples(0, new LocalMetadata()) {} DummyHistogramSamples() : HistogramSamples(0, new LocalMetadata()) {}
DummyHistogramSamples(const DummyHistogramSamples&) = delete;
DummyHistogramSamples& operator=(const DummyHistogramSamples&) = delete;
~DummyHistogramSamples() override { ~DummyHistogramSamples() override {
delete static_cast<LocalMetadata*>(meta()); delete static_cast<LocalMetadata*>(meta());
} }
...@@ -56,9 +57,6 @@ class DummyHistogramSamples : public HistogramSamples { ...@@ -56,9 +57,6 @@ class DummyHistogramSamples : public HistogramSamples {
bool AddSubtractImpl(SampleCountIterator* iter, Operator op) override { bool AddSubtractImpl(SampleCountIterator* iter, Operator op) override {
return true; return true;
} }
private:
DISALLOW_COPY_AND_ASSIGN(DummyHistogramSamples);
}; };
} // namespace } // namespace
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/read_only_shared_memory_region.h" #include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/shared_memory_mapping.h" #include "base/memory/shared_memory_mapping.h"
...@@ -185,6 +184,9 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { ...@@ -185,6 +184,9 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
// assignment (and hence is not yet participating in the trial). // assignment (and hence is not yet participating in the trial).
static const int kNotFinalized; static const int kNotFinalized;
FieldTrial(const FieldTrial&) = delete;
FieldTrial& operator=(const FieldTrial&) = delete;
// Disables this trial, meaning it always determines the default group // Disables this trial, meaning it always determines the default group
// has been selected. May be called immediately after construction, or // has been selected. May be called immediately after construction, or
// at any time after initialization (should not be interleaved with // at any time after initialization (should not be interleaved with
...@@ -290,6 +292,7 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { ...@@ -290,6 +292,7 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
Probability total_probability, Probability total_probability,
const std::string& default_group_name, const std::string& default_group_name,
double entropy_value); double entropy_value);
virtual ~FieldTrial(); virtual ~FieldTrial();
// Return the default group name of the FieldTrial. // Return the default group name of the FieldTrial.
...@@ -380,8 +383,6 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> { ...@@ -380,8 +383,6 @@ class BASE_EXPORT FieldTrial : public RefCounted<FieldTrial> {
// When benchmarking is enabled, field trials all revert to the 'default' // When benchmarking is enabled, field trials all revert to the 'default'
// group. // group.
static bool enable_benchmarking_; static bool enable_benchmarking_;
DISALLOW_COPY_AND_ASSIGN(FieldTrial);
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -416,6 +417,8 @@ class BASE_EXPORT FieldTrialList { ...@@ -416,6 +417,8 @@ class BASE_EXPORT FieldTrialList {
// |entropy_provider|. // |entropy_provider|.
explicit FieldTrialList( explicit FieldTrialList(
std::unique_ptr<const FieldTrial::EntropyProvider> entropy_provider); std::unique_ptr<const FieldTrial::EntropyProvider> entropy_provider);
FieldTrialList(const FieldTrialList&) = delete;
FieldTrialList& operator=(const FieldTrialList&) = delete;
// Destructor Release()'s references to all registered FieldTrial instances. // Destructor Release()'s references to all registered FieldTrial instances.
~FieldTrialList(); ~FieldTrialList();
...@@ -796,8 +799,6 @@ class BASE_EXPORT FieldTrialList { ...@@ -796,8 +799,6 @@ class BASE_EXPORT FieldTrialList {
// Tracks whether CreateTrialsFromCommandLine() has been called. // Tracks whether CreateTrialsFromCommandLine() has been called.
bool create_trials_from_command_line_called_ = false; bool create_trials_from_command_line_called_ = false;
DISALLOW_COPY_AND_ASSIGN(FieldTrialList);
}; };
} // namespace base } // namespace base
......
...@@ -63,12 +63,14 @@ class TestFieldTrialObserver : public FieldTrialList::Observer { ...@@ -63,12 +63,14 @@ class TestFieldTrialObserver : public FieldTrialList::Observer {
SYNCHRONOUS, SYNCHRONOUS,
}; };
TestFieldTrialObserver(Type type) : type_(type) { explicit TestFieldTrialObserver(Type type) : type_(type) {
if (type == SYNCHRONOUS) if (type == SYNCHRONOUS)
FieldTrialList::SetSynchronousObserver(this); FieldTrialList::SetSynchronousObserver(this);
else else
FieldTrialList::AddObserver(this); FieldTrialList::AddObserver(this);
} }
TestFieldTrialObserver(const TestFieldTrialObserver&) = delete;
TestFieldTrialObserver& operator=(const TestFieldTrialObserver&) = delete;
~TestFieldTrialObserver() override { ~TestFieldTrialObserver() override {
if (type_ == SYNCHRONOUS) if (type_ == SYNCHRONOUS)
...@@ -90,8 +92,6 @@ class TestFieldTrialObserver : public FieldTrialList::Observer { ...@@ -90,8 +92,6 @@ class TestFieldTrialObserver : public FieldTrialList::Observer {
const Type type_; const Type type_;
std::string trial_name_; std::string trial_name_;
std::string group_name_; std::string group_name_;
DISALLOW_COPY_AND_ASSIGN(TestFieldTrialObserver);
}; };
std::string MockEscapeQueryParamValue(const std::string& input) { std::string MockEscapeQueryParamValue(const std::string& input) {
...@@ -103,6 +103,8 @@ std::string MockEscapeQueryParamValue(const std::string& input) { ...@@ -103,6 +103,8 @@ std::string MockEscapeQueryParamValue(const std::string& input) {
class FieldTrialTest : public ::testing::Test { class FieldTrialTest : public ::testing::Test {
public: public:
FieldTrialTest() : trial_list_(nullptr) {} FieldTrialTest() : trial_list_(nullptr) {}
FieldTrialTest(const FieldTrialTest&) = delete;
FieldTrialTest& operator=(const FieldTrialTest&) = delete;
private: private:
test::TaskEnvironment task_environment_; test::TaskEnvironment task_environment_;
...@@ -110,8 +112,6 @@ class FieldTrialTest : public ::testing::Test { ...@@ -110,8 +112,6 @@ class FieldTrialTest : public ::testing::Test {
// tests it's cleaner to start from scratch. // tests it's cleaner to start from scratch.
test::ScopedFieldTrialListResetter trial_list_resetter_; test::ScopedFieldTrialListResetter trial_list_resetter_;
FieldTrialList trial_list_; FieldTrialList trial_list_;
DISALLOW_COPY_AND_ASSIGN(FieldTrialTest);
}; };
// Test registration, and also check that destructors are called for trials. // Test registration, and also check that destructors are called for trials.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <limits>
#include <vector> #include <vector>
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
...@@ -15,15 +16,18 @@ ...@@ -15,15 +16,18 @@
namespace base { namespace base {
class HistogramBaseTest : public testing::Test { class HistogramBaseTest : public testing::Test {
protected: public:
HistogramBaseTest() { HistogramBaseTest() {
// Each test will have a clean state (no Histogram / BucketRanges // Each test will have a clean state (no Histogram / BucketRanges
// registered). // registered).
ResetStatisticsRecorder(); ResetStatisticsRecorder();
} }
HistogramBaseTest(const HistogramBaseTest&) = delete;
HistogramBaseTest& operator=(const HistogramBaseTest&) = delete;
~HistogramBaseTest() override = default; ~HistogramBaseTest() override = default;
protected:
void ResetStatisticsRecorder() { void ResetStatisticsRecorder() {
// It is necessary to fully destruct any existing StatisticsRecorder // It is necessary to fully destruct any existing StatisticsRecorder
// before creating a new one. // before creating a new one.
...@@ -33,8 +37,6 @@ class HistogramBaseTest : public testing::Test { ...@@ -33,8 +37,6 @@ class HistogramBaseTest : public testing::Test {
private: private:
std::unique_ptr<StatisticsRecorder> statistics_recorder_; std::unique_ptr<StatisticsRecorder> statistics_recorder_;
DISALLOW_COPY_AND_ASSIGN(HistogramBaseTest);
}; };
TEST_F(HistogramBaseTest, DeserializeHistogram) { TEST_F(HistogramBaseTest, DeserializeHistogram) {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <map> #include <map>
#include <string> #include <string>
#include "base/macros.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
namespace base { namespace base {
...@@ -19,6 +18,8 @@ class HistogramSamples; ...@@ -19,6 +18,8 @@ class HistogramSamples;
// handles the logistics of gathering up available histograms for recording. // handles the logistics of gathering up available histograms for recording.
class BASE_EXPORT HistogramFlattener { class BASE_EXPORT HistogramFlattener {
public: public:
HistogramFlattener(const HistogramFlattener&) = delete;
HistogramFlattener& operator=(const HistogramFlattener&) = delete;
virtual ~HistogramFlattener() = default; virtual ~HistogramFlattener() = default;
virtual void RecordDelta(const HistogramBase& histogram, virtual void RecordDelta(const HistogramBase& histogram,
...@@ -26,9 +27,6 @@ class BASE_EXPORT HistogramFlattener { ...@@ -26,9 +27,6 @@ class BASE_EXPORT HistogramFlattener {
protected: protected:
HistogramFlattener() = default; HistogramFlattener() = default;
private:
DISALLOW_COPY_AND_ASSIGN(HistogramFlattener);
}; };
} // namespace base } // namespace base
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <memory> #include <memory>
#include "base/atomicops.h" #include "base/atomicops.h"
#include "base/macros.h"
#include "base/metrics/histogram_base.h" #include "base/metrics/histogram_base.h"
namespace base { namespace base {
...@@ -129,6 +128,8 @@ class BASE_EXPORT HistogramSamples { ...@@ -129,6 +128,8 @@ class BASE_EXPORT HistogramSamples {
}; };
HistogramSamples(uint64_t id, Metadata* meta); HistogramSamples(uint64_t id, Metadata* meta);
HistogramSamples(const HistogramSamples&) = delete;
HistogramSamples& operator=(const HistogramSamples&) = delete;
virtual ~HistogramSamples(); virtual ~HistogramSamples();
virtual void Accumulate(HistogramBase::Sample value, virtual void Accumulate(HistogramBase::Sample value,
...@@ -203,8 +204,6 @@ class BASE_EXPORT HistogramSamples { ...@@ -203,8 +204,6 @@ class BASE_EXPORT HistogramSamples {
// external storage in which case HistogramSamples class cannot take ownership // external storage in which case HistogramSamples class cannot take ownership
// of Metadata*. // of Metadata*.
Metadata* meta_; Metadata* meta_;
DISALLOW_COPY_AND_ASSIGN(HistogramSamples);
}; };
class BASE_EXPORT SampleCountIterator { class BASE_EXPORT SampleCountIterator {
......
...@@ -21,16 +21,16 @@ namespace { ...@@ -21,16 +21,16 @@ namespace {
// an error if the flag is already set. // an error if the flag is already set.
class MakeActive { class MakeActive {
public: public:
MakeActive(std::atomic<bool>* is_active) : is_active_(is_active) { explicit MakeActive(std::atomic<bool>* is_active) : is_active_(is_active) {
bool was_active = is_active_->exchange(true, std::memory_order_relaxed); bool was_active = is_active_->exchange(true, std::memory_order_relaxed);
CHECK(!was_active); CHECK(!was_active);
} }
MakeActive(const MakeActive&) = delete;
MakeActive& operator=(const MakeActive&) = delete;
~MakeActive() { is_active_->store(false, std::memory_order_relaxed); } ~MakeActive() { is_active_->store(false, std::memory_order_relaxed); }
private: private:
std::atomic<bool>* is_active_; std::atomic<bool>* is_active_;
DISALLOW_COPY_AND_ASSIGN(MakeActive);
}; };
} // namespace } // namespace
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "base/atomicops.h" #include "base/atomicops.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/metrics/bucket_ranges.h" #include "base/metrics/bucket_ranges.h"
#include "base/metrics/histogram_base.h" #include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_samples.h" #include "base/metrics/histogram_samples.h"
...@@ -32,6 +31,8 @@ class BASE_EXPORT SampleVectorBase : public HistogramSamples { ...@@ -32,6 +31,8 @@ class BASE_EXPORT SampleVectorBase : public HistogramSamples {
SampleVectorBase(uint64_t id, SampleVectorBase(uint64_t id,
Metadata* meta, Metadata* meta,
const BucketRanges* bucket_ranges); const BucketRanges* bucket_ranges);
SampleVectorBase(const SampleVectorBase&) = delete;
SampleVectorBase& operator=(const SampleVectorBase&) = delete;
~SampleVectorBase() override; ~SampleVectorBase() override;
// HistogramSamples: // HistogramSamples:
...@@ -107,8 +108,6 @@ class BASE_EXPORT SampleVectorBase : public HistogramSamples { ...@@ -107,8 +108,6 @@ class BASE_EXPORT SampleVectorBase : public HistogramSamples {
// Shares the same BucketRanges with Histogram object. // Shares the same BucketRanges with Histogram object.
const BucketRanges* const bucket_ranges_; const BucketRanges* const bucket_ranges_;
DISALLOW_COPY_AND_ASSIGN(SampleVectorBase);
}; };
// A sample vector that uses local memory for the counts array. // A sample vector that uses local memory for the counts array.
...@@ -116,6 +115,8 @@ class BASE_EXPORT SampleVector : public SampleVectorBase { ...@@ -116,6 +115,8 @@ class BASE_EXPORT SampleVector : public SampleVectorBase {
public: public:
explicit SampleVector(const BucketRanges* bucket_ranges); explicit SampleVector(const BucketRanges* bucket_ranges);
SampleVector(uint64_t id, const BucketRanges* bucket_ranges); SampleVector(uint64_t id, const BucketRanges* bucket_ranges);
SampleVector(const SampleVector&) = delete;
SampleVector& operator=(const SampleVector&) = delete;
~SampleVector() override; ~SampleVector() override;
private: private:
...@@ -125,8 +126,6 @@ class BASE_EXPORT SampleVector : public SampleVectorBase { ...@@ -125,8 +126,6 @@ class BASE_EXPORT SampleVector : public SampleVectorBase {
// Simple local storage for counts. // Simple local storage for counts.
mutable std::vector<HistogramBase::AtomicCount> local_counts_; mutable std::vector<HistogramBase::AtomicCount> local_counts_;
DISALLOW_COPY_AND_ASSIGN(SampleVector);
}; };
// A sample vector that uses persistent memory for the counts array. // A sample vector that uses persistent memory for the counts array.
...@@ -136,6 +135,8 @@ class BASE_EXPORT PersistentSampleVector : public SampleVectorBase { ...@@ -136,6 +135,8 @@ class BASE_EXPORT PersistentSampleVector : public SampleVectorBase {
const BucketRanges* bucket_ranges, const BucketRanges* bucket_ranges,
Metadata* meta, Metadata* meta,
const DelayedPersistentAllocation& counts); const DelayedPersistentAllocation& counts);
PersistentSampleVector(const PersistentSampleVector&) = delete;
PersistentSampleVector& operator=(const PersistentSampleVector&) = delete;
~PersistentSampleVector() override; ~PersistentSampleVector() override;
private: private:
...@@ -145,8 +146,6 @@ class BASE_EXPORT PersistentSampleVector : public SampleVectorBase { ...@@ -145,8 +146,6 @@ class BASE_EXPORT PersistentSampleVector : public SampleVectorBase {
// Persistent storage for counts. // Persistent storage for counts.
DelayedPersistentAllocation persistent_counts_; DelayedPersistentAllocation persistent_counts_;
DISALLOW_COPY_AND_ASSIGN(PersistentSampleVector);
}; };
// An iterator for sample vectors. This could be defined privately in the .cc // An iterator for sample vectors. This could be defined privately in the .cc
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
#ifndef BASE_METRICS_SINGLE_SAMPLE_METRICS_H_ #ifndef BASE_METRICS_SINGLE_SAMPLE_METRICS_H_
#define BASE_METRICS_SINGLE_SAMPLE_METRICS_H_ #define BASE_METRICS_SINGLE_SAMPLE_METRICS_H_
#include <memory>
#include <string> #include <string>
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h"
#include "base/metrics/histogram_base.h" #include "base/metrics/histogram_base.h"
namespace base { namespace base {
...@@ -64,6 +64,10 @@ class BASE_EXPORT DefaultSingleSampleMetricsFactory ...@@ -64,6 +64,10 @@ class BASE_EXPORT DefaultSingleSampleMetricsFactory
: public SingleSampleMetricsFactory { : public SingleSampleMetricsFactory {
public: public:
DefaultSingleSampleMetricsFactory() = default; DefaultSingleSampleMetricsFactory() = default;
DefaultSingleSampleMetricsFactory(const DefaultSingleSampleMetricsFactory&) =
delete;
DefaultSingleSampleMetricsFactory& operator=(
const DefaultSingleSampleMetricsFactory&) = delete;
~DefaultSingleSampleMetricsFactory() override = default; ~DefaultSingleSampleMetricsFactory() override = default;
// SingleSampleMetricsFactory: // SingleSampleMetricsFactory:
...@@ -72,9 +76,6 @@ class BASE_EXPORT DefaultSingleSampleMetricsFactory ...@@ -72,9 +76,6 @@ class BASE_EXPORT DefaultSingleSampleMetricsFactory
HistogramBase::Sample min, HistogramBase::Sample min,
HistogramBase::Sample max, HistogramBase::Sample max,
uint32_t bucket_count) override; uint32_t bucket_count) override;
private:
DISALLOW_COPY_AND_ASSIGN(DefaultSingleSampleMetricsFactory);
}; };
class BASE_EXPORT DefaultSingleSampleMetric : public SingleSampleMetric { class BASE_EXPORT DefaultSingleSampleMetric : public SingleSampleMetric {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector>
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram_base.h" #include "base/metrics/histogram_base.h"
...@@ -29,11 +30,14 @@ namespace base { ...@@ -29,11 +30,14 @@ namespace base {
// for histogram allocation. False will allocate histograms from the process // for histogram allocation. False will allocate histograms from the process
// heap. // heap.
class SparseHistogramTest : public testing::TestWithParam<bool> { class SparseHistogramTest : public testing::TestWithParam<bool> {
public:
SparseHistogramTest() : use_persistent_histogram_allocator_(GetParam()) {}
SparseHistogramTest(const SparseHistogramTest&) = delete;
SparseHistogramTest& operator=(const SparseHistogramTest&) = delete;
protected: protected:
const int32_t kAllocatorMemorySize = 8 << 20; // 8 MiB const int32_t kAllocatorMemorySize = 8 << 20; // 8 MiB
SparseHistogramTest() : use_persistent_histogram_allocator_(GetParam()) {}
void SetUp() override { void SetUp() override {
if (use_persistent_histogram_allocator_) if (use_persistent_histogram_allocator_)
CreatePersistentMemoryAllocator(); CreatePersistentMemoryAllocator();
...@@ -91,9 +95,6 @@ class SparseHistogramTest : public testing::TestWithParam<bool> { ...@@ -91,9 +95,6 @@ class SparseHistogramTest : public testing::TestWithParam<bool> {
std::unique_ptr<StatisticsRecorder> statistics_recorder_; std::unique_ptr<StatisticsRecorder> statistics_recorder_;
PersistentMemoryAllocator* allocator_ = nullptr; PersistentMemoryAllocator* allocator_ = nullptr;
private:
DISALLOW_COPY_AND_ASSIGN(SparseHistogramTest);
}; };
// Run all HistogramTest cases with both heap and persistent memory. // Run all HistogramTest cases with both heap and persistent memory.
......
...@@ -30,14 +30,13 @@ namespace { ...@@ -30,14 +30,13 @@ namespace {
// contained (i.e., do not affect other unit tests). // contained (i.e., do not affect other unit tests).
class LogStateSaver { class LogStateSaver {
public: public:
LogStateSaver() : old_min_log_level_(logging::GetMinLogLevel()) {} LogStateSaver() = default;
LogStateSaver(const LogStateSaver&) = delete;
LogStateSaver& operator=(const LogStateSaver&) = delete;
~LogStateSaver() { logging::SetMinLogLevel(old_min_log_level_); } ~LogStateSaver() { logging::SetMinLogLevel(old_min_log_level_); }
private: private:
int old_min_log_level_; int old_min_log_level_ = logging::GetMinLogLevel();
DISALLOW_COPY_AND_ASSIGN(LogStateSaver);
}; };
// Test implementation of RecordHistogramChecker interface. // Test implementation of RecordHistogramChecker interface.
...@@ -60,6 +59,10 @@ using testing::SizeIs; ...@@ -60,6 +59,10 @@ using testing::SizeIs;
using testing::UnorderedElementsAre; using testing::UnorderedElementsAre;
class StatisticsRecorderTest : public testing::TestWithParam<bool> { class StatisticsRecorderTest : public testing::TestWithParam<bool> {
public:
StatisticsRecorderTest(const StatisticsRecorderTest&) = delete;
StatisticsRecorderTest& operator=(const StatisticsRecorderTest&) = delete;
protected: protected:
const int32_t kAllocatorMemorySize = 64 << 10; // 64 KiB const int32_t kAllocatorMemorySize = 64 << 10; // 64 KiB
...@@ -122,8 +125,6 @@ class StatisticsRecorderTest : public testing::TestWithParam<bool> { ...@@ -122,8 +125,6 @@ class StatisticsRecorderTest : public testing::TestWithParam<bool> {
private: private:
LogStateSaver log_state_saver_; LogStateSaver log_state_saver_;
DISALLOW_COPY_AND_ASSIGN(StatisticsRecorderTest);
}; };
// Run all HistogramTest cases with both heap and persistent memory. // Run all HistogramTest cases with both heap and persistent memory.
...@@ -701,6 +702,8 @@ class TestHistogramProvider : public StatisticsRecorder::HistogramProvider { ...@@ -701,6 +702,8 @@ class TestHistogramProvider : public StatisticsRecorder::HistogramProvider {
: allocator_(std::move(allocator)) { : allocator_(std::move(allocator)) {
StatisticsRecorder::RegisterHistogramProvider(weak_factory_.GetWeakPtr()); StatisticsRecorder::RegisterHistogramProvider(weak_factory_.GetWeakPtr());
} }
TestHistogramProvider(const TestHistogramProvider&) = delete;
TestHistogramProvider& operator=(const TestHistogramProvider&) = delete;
void MergeHistogramDeltas() override { void MergeHistogramDeltas() override {
PersistentHistogramAllocator::Iterator hist_iter(allocator_.get()); PersistentHistogramAllocator::Iterator hist_iter(allocator_.get());
...@@ -715,8 +718,6 @@ class TestHistogramProvider : public StatisticsRecorder::HistogramProvider { ...@@ -715,8 +718,6 @@ class TestHistogramProvider : public StatisticsRecorder::HistogramProvider {
private: private:
std::unique_ptr<PersistentHistogramAllocator> allocator_; std::unique_ptr<PersistentHistogramAllocator> allocator_;
WeakPtrFactory<TestHistogramProvider> weak_factory_{this}; WeakPtrFactory<TestHistogramProvider> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TestHistogramProvider);
}; };
TEST_P(StatisticsRecorderTest, ImportHistogramsTest) { TEST_P(StatisticsRecorderTest, ImportHistogramsTest) {
......
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