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

Unified Diff: third_party/WebKit/public/platform/Platform.h

Issue 1647883004: Support caching histograms so that a lookup isn't done in each iteration. (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
Index: third_party/WebKit/public/platform/Platform.h
diff --git a/third_party/WebKit/public/platform/Platform.h b/third_party/WebKit/public/platform/Platform.h
index 885a348626efa382279fe6fb63afd55484c1ea4e..3ea0f624a27be3faab66ef2c3b0a92790a60e931 100644
--- a/third_party/WebKit/public/platform/Platform.h
+++ b/third_party/WebKit/public/platform/Platform.h
@@ -448,13 +448,27 @@ public:
// Get a pointer to testing support interfaces. Will not be available in production builds.
virtual WebUnitTestSupport* unitTestSupport() { return nullptr; }
+ typedef void* HistogramCacheSlot;
+
// Callbacks for reporting histogram data.
// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do.
- virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { }
+ // |cacheSlot| is intended to be a thread safe pointer to an entry that
+ // the histogram code can store a lookup value in. Note that |name|
+ // MUST be the same as a previous call if providing a |cacheSlot| that
+ // was used in a previous call.
+ virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount, HistogramCacheSlot* cacheSlot = 0) {}
// Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value.
- virtual void histogramEnumeration(const char* name, int sample, int boundaryValue) { }
+ // |cacheSlot| is intended to be a thread safe pointer to an entry that
+ // the histogram code can store a lookup value in. Note that |name|
+ // MUST be the same as a previous call if providing a |cacheSlot| that
+ // was used in a previous call.
+ virtual void histogramEnumeration(const char* name, int sample, int boundaryValue, HistogramCacheSlot* cacheSlot = 0) {}
// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
- virtual void histogramSparse(const char* name, int sample) { }
+ // |cacheSlot| is intended to be a thread safe pointer to an entry that
+ // the histogram code can store a lookup value in. Note that |name|
+ // MUST be the same as a previous call if providing a |cacheSlot| that
+ // was used in a previous call.
+ virtual void histogramSparse(const char* name, int sample, HistogramCacheSlot* cacheSlot = 0) {}
// Record to a RAPPOR privacy-preserving metric, see: https://www.chromium.org/developers/design-documents/rappor.
// recordRappor records a sample string, while recordRapporURL records the domain and registry of a url.

Powered by Google App Engine
This is Rietveld 408576698