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

Unified Diff: content/child/blink_platform_impl.cc

Issue 1631143003: CL for perf tryjob on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | third_party/WebKit/Source/core/layout/HitTestCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 7d1cb401618b34d3d34bad8be278cc70b15b23fe..12642be096f358eb8c64b2cbc93237ece088afec 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -586,29 +586,53 @@ void BlinkPlatformImpl::decrementStatsCounter(const char* name) {
void BlinkPlatformImpl::incrementStatsCounter(const char* name) {
}
-void BlinkPlatformImpl::histogramCustomCounts(
- const char* name, int sample, int min, int max, int bucket_count) {
+void BlinkPlatformImpl::histogramCustomCounts(const char* name,
+ int sample,
+ int min,
+ int max,
+ int bucket_count,
+ HistogramCacheSlot* cache_slot) {
// Copied from histogram macro, but without the static variable caching
// the histogram because name is dynamic.
- base::HistogramBase* counter =
- base::Histogram::FactoryGet(name, min, max, bucket_count,
- base::HistogramBase::kUmaTargetedHistogramFlag);
+ base::HistogramBase* counter = 0;
+ if (cache_slot)
+ counter = reinterpret_cast<base::HistogramBase*>(*cache_slot);
+
+ if (!counter) {
+ counter = base::Histogram::FactoryGet(
+ name, min, max, bucket_count,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+ }
DCHECK_EQ(name, counter->histogram_name());
counter->Add(sample);
+ if (cache_slot)
+ *cache_slot = counter;
}
-void BlinkPlatformImpl::histogramEnumeration(
- const char* name, int sample, int boundary_value) {
+void BlinkPlatformImpl::histogramEnumeration(const char* name,
+ int sample,
+ int boundary_value,
+ HistogramCacheSlot* cache_slot) {
// Copied from histogram macro, but without the static variable caching
// the histogram because name is dynamic.
- base::HistogramBase* counter =
- base::LinearHistogram::FactoryGet(name, 1, boundary_value,
- boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag);
+ base::HistogramBase* counter = 0;
+ if (cache_slot)
+ counter = reinterpret_cast<base::HistogramBase*>(*cache_slot);
+
+ if (!counter) {
+ counter = base::LinearHistogram::FactoryGet(
+ name, 1, boundary_value, boundary_value + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+ }
DCHECK_EQ(name, counter->histogram_name());
counter->Add(sample);
+ if (cache_slot)
+ *cache_slot = counter;
}
-void BlinkPlatformImpl::histogramSparse(const char* name, int sample) {
+void BlinkPlatformImpl::histogramSparse(const char* name,
+ int sample,
+ HistogramCacheSlot* cache_slot) {
// For sparse histograms, we can use the macro, as it does not incorporate a
// static.
UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample);
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | third_party/WebKit/Source/core/layout/HitTestCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698