Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: base/metrics/sparse_histogram.cc

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/metrics/histogram_base.cc ('k') | base/move_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/metrics/sparse_histogram.h" 5 #include "base/metrics/sparse_histogram.h"
6 6
7 #include <utility>
8
7 #include "base/metrics/sample_map.h" 9 #include "base/metrics/sample_map.h"
8 #include "base/metrics/statistics_recorder.h" 10 #include "base/metrics/statistics_recorder.h"
9 #include "base/pickle.h" 11 #include "base/pickle.h"
10 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
11 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
12 14
13 namespace base { 15 namespace base {
14 16
15 typedef HistogramBase::Count Count; 17 typedef HistogramBase::Count Count;
16 typedef HistogramBase::Sample Sample; 18 typedef HistogramBase::Sample Sample;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 62 }
61 63
62 FindAndRunCallback(value); 64 FindAndRunCallback(value);
63 } 65 }
64 66
65 scoped_ptr<HistogramSamples> SparseHistogram::SnapshotSamples() const { 67 scoped_ptr<HistogramSamples> SparseHistogram::SnapshotSamples() const {
66 scoped_ptr<SampleMap> snapshot(new SampleMap()); 68 scoped_ptr<SampleMap> snapshot(new SampleMap());
67 69
68 base::AutoLock auto_lock(lock_); 70 base::AutoLock auto_lock(lock_);
69 snapshot->Add(samples_); 71 snapshot->Add(samples_);
70 return snapshot.Pass(); 72 return std::move(snapshot);
71 } 73 }
72 74
73 void SparseHistogram::AddSamples(const HistogramSamples& samples) { 75 void SparseHistogram::AddSamples(const HistogramSamples& samples) {
74 base::AutoLock auto_lock(lock_); 76 base::AutoLock auto_lock(lock_);
75 samples_.Add(samples); 77 samples_.Add(samples);
76 } 78 }
77 79
78 bool SparseHistogram::AddSamplesFromPickle(PickleIterator* iter) { 80 bool SparseHistogram::AddSamplesFromPickle(PickleIterator* iter) {
79 base::AutoLock auto_lock(lock_); 81 base::AutoLock auto_lock(lock_);
80 return samples_.AddFromPickle(iter); 82 return samples_.AddFromPickle(iter);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 std::string* output) const { 180 std::string* output) const {
179 StringAppendF(output, 181 StringAppendF(output,
180 "Histogram: %s recorded %d samples", 182 "Histogram: %s recorded %d samples",
181 histogram_name().c_str(), 183 histogram_name().c_str(),
182 total_count); 184 total_count);
183 if (flags() & ~kHexRangePrintingFlag) 185 if (flags() & ~kHexRangePrintingFlag)
184 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag); 186 StringAppendF(output, " (flags = 0x%x)", flags() & ~kHexRangePrintingFlag);
185 } 187 }
186 188
187 } // namespace base 189 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.cc ('k') | base/move_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698