| 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);
|
|
|