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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « base/metrics/statistics_recorder.cc ('k') | base/metrics/stats_table.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/stats_counters.h" 5 #include "base/metrics/stats_counters.h"
6 6
7 namespace base { 7 namespace base {
8 8
9 StatsCounter::StatsCounter(const std::string& name) 9 StatsCounter::StatsCounter(const std::string& name)
10 : counter_id_(-1) { 10 : counter_id_(-1) {
(...skipping 27 matching lines...) Expand all
38 38
39 int* StatsCounter::GetPtr() { 39 int* StatsCounter::GetPtr() {
40 StatsTable* table = StatsTable::current(); 40 StatsTable* table = StatsTable::current();
41 if (!table) 41 if (!table)
42 return NULL; 42 return NULL;
43 43
44 // If counter_id_ is -1, then we haven't looked it up yet. 44 // If counter_id_ is -1, then we haven't looked it up yet.
45 if (counter_id_ == -1) { 45 if (counter_id_ == -1) {
46 counter_id_ = table->FindCounter(name_); 46 counter_id_ = table->FindCounter(name_);
47 if (table->GetSlot() == 0) { 47 if (table->GetSlot() == 0) {
48 if (!table->RegisterThread("")) { 48 if (!table->RegisterThread(std::string())) {
49 // There is no room for this thread. This thread 49 // There is no room for this thread. This thread
50 // cannot use counters. 50 // cannot use counters.
51 counter_id_ = 0; 51 counter_id_ = 0;
52 return NULL; 52 return NULL;
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 // If counter_id_ is > 0, then we have a valid counter. 57 // If counter_id_ is > 0, then we have a valid counter.
58 if (counter_id_ > 0) 58 if (counter_id_ > 0)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void StatsRate::Add(int value) { 118 void StatsRate::Add(int value) {
119 counter_.Increment(); 119 counter_.Increment();
120 StatsCounterTimer::Add(value); 120 StatsCounterTimer::Add(value);
121 if (value > largest_add_.value()) 121 if (value > largest_add_.value())
122 largest_add_.Set(value); 122 largest_add_.Set(value);
123 } 123 }
124 124
125 } // namespace base 125 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/statistics_recorder.cc ('k') | base/metrics/stats_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698