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

Side by Side Diff: base/metrics/histogram_base.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.cc ('k') | base/metrics/sparse_histogram.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/histogram_base.h" 5 #include "base/metrics/histogram_base.h"
6 6
7 #include <climits> 7 #include <climits>
8 #include <utility>
8 9
9 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/metrics/histogram_samples.h" 14 #include "base/metrics/histogram_samples.h"
14 #include "base/metrics/sparse_histogram.h" 15 #include "base/metrics/sparse_histogram.h"
15 #include "base/metrics/statistics_recorder.h" 16 #include "base/metrics/statistics_recorder.h"
16 #include "base/pickle.h" 17 #include "base/pickle.h"
17 #include "base/process/process_handle.h" 18 #include "base/process/process_handle.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 GetCountAndBucketData(&count, &sum, buckets.get()); 108 GetCountAndBucketData(&count, &sum, buckets.get());
108 scoped_ptr<DictionaryValue> parameters(new DictionaryValue()); 109 scoped_ptr<DictionaryValue> parameters(new DictionaryValue());
109 GetParameters(parameters.get()); 110 GetParameters(parameters.get());
110 111
111 JSONStringValueSerializer serializer(output); 112 JSONStringValueSerializer serializer(output);
112 DictionaryValue root; 113 DictionaryValue root;
113 root.SetString("name", histogram_name()); 114 root.SetString("name", histogram_name());
114 root.SetInteger("count", count); 115 root.SetInteger("count", count);
115 root.SetDouble("sum", static_cast<double>(sum)); 116 root.SetDouble("sum", static_cast<double>(sum));
116 root.SetInteger("flags", flags()); 117 root.SetInteger("flags", flags());
117 root.Set("params", parameters.Pass()); 118 root.Set("params", std::move(parameters));
118 root.Set("buckets", buckets.Pass()); 119 root.Set("buckets", std::move(buckets));
119 root.SetInteger("pid", GetCurrentProcId()); 120 root.SetInteger("pid", GetCurrentProcId());
120 serializer.Serialize(root); 121 serializer.Serialize(root);
121 } 122 }
122 123
123 void HistogramBase::FindAndRunCallback(HistogramBase::Sample sample) const { 124 void HistogramBase::FindAndRunCallback(HistogramBase::Sample sample) const {
124 if ((flags() & kCallbackExists) == 0) 125 if ((flags() & kCallbackExists) == 0)
125 return; 126 return;
126 127
127 StatisticsRecorder::OnSampleCallback cb = 128 StatisticsRecorder::OnSampleCallback cb =
128 StatisticsRecorder::FindCallback(histogram_name()); 129 StatisticsRecorder::FindCallback(histogram_name());
(...skipping 26 matching lines...) Expand all
155 return result; 156 return result;
156 } 157 }
157 158
158 void HistogramBase::WriteAsciiBucketValue(Count current, 159 void HistogramBase::WriteAsciiBucketValue(Count current,
159 double scaled_sum, 160 double scaled_sum,
160 std::string* output) const { 161 std::string* output) const {
161 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); 162 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
162 } 163 }
163 164
164 } // namespace base 165 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698