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

Unified Diff: src/counters.cc

Issue 2918703002: Localize counter class member functions. (Closed)
Patch Set: Remove need for mutex to initialize counters. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« src/counters.h ('K') | « src/counters.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.cc
diff --git a/src/counters.cc b/src/counters.cc
index c98078658f5fde39478b32619f3360e23e392bd0..cab893c1f5a6362991b5efb01d86e34d6797b771 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -26,15 +26,18 @@ void StatsTable::SetCounterFunction(CounterLookupCallback f) {
counters_->ResetCounters();
}
+void StatsTable::SetCreateHistogramFunction(CreateHistogramCallback f) {
Mircea Trofin 2017/06/05 15:57:49 It's a bit surprising setting the callback (which
kschimpf 2017/06/05 17:38:52 Ok. However, the current name matches the "include
+ create_histogram_function_ = f;
+ counters_->ResetHistograms();
+}
+
int* StatsCounterBase::FindLocationInStatsTable() const {
return counters_->stats_table()->FindLocation(name_);
}
StatsCounterThreadSafe::StatsCounterThreadSafe(Counters* counters,
const char* name)
- : StatsCounterBase(counters, name) {
- GetPtr();
-}
+ : StatsCounterBase(counters, name) {}
void StatsCounterThreadSafe::Set(int Value) {
if (ptr_) {
@@ -72,7 +75,6 @@ void StatsCounterThreadSafe::Decrement(int value) {
}
int* StatsCounterThreadSafe::GetPtr() {
- base::LockGuard<base::Mutex> Guard(&mutex_);
ptr_ = FindLocationInStatsTable();
return ptr_;
}
@@ -316,29 +318,6 @@ void Counters::ResetHistograms() {
#undef HM
}
-void Counters::InitializeHistograms() {
-#define HR(name, caption, min, max, num_buckets) name##_.Enabled();
- HISTOGRAM_RANGE_LIST(HR)
-#undef HR
-
-#define HT(name, caption, max, res) name##_.Enabled();
- HISTOGRAM_TIMER_LIST(HT)
-#undef HT
-
-#define AHT(name, caption) name##_.Enabled();
- AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
-#undef AHT
-
-#define HP(name, caption) name##_.Enabled();
- HISTOGRAM_PERCENTAGE_LIST(HP)
-#undef HP
-
-#define HM(name, caption) name##_.Enabled();
- HISTOGRAM_LEGACY_MEMORY_LIST(HM)
- HISTOGRAM_MEMORY_LIST(HM)
-#undef HM
-}
-
class RuntimeCallStatEntries {
public:
void Print(std::ostream& os) {
« src/counters.h ('K') | « src/counters.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698