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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Rebase two new histograms were added today Created 4 years, 10 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/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 7b5848858ecaedac0d9cc41100baead74598dd3d..a55cb447a5b1b691cfc5ebd51df897ed20ea5f10 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -68,11 +68,37 @@ enum SriResourceIntegrityMismatchEvent {
SriResourceIntegrityMismatchEventCount
};
+#define DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, name) \
+ case Resource::name: { \
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, resourceHistogram, new EnumerationHistogram("Blink.MemoryCache.RevalidationPolicy." prefix #name, Load + 1)); \
+ resourceHistogram.count(policy); \
+ break; \
+ }
+
+#define DEFINE_RESOURCE_HISTOGRAM(prefix) \
+ switch (factory.type()) { \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, CSSStyleSheet) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Font) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Image) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, ImportResource) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPrefetch) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPreload) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, MainResource) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Manifest) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Media) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Raw) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Script) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, SVGDocument) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, TextTrack) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, XSLStyleSheet) \
+ }
+
} // namespace
static void RecordSriResourceIntegrityMismatchEvent(SriResourceIntegrityMismatchEvent event)
{
- Platform::current()->histogramEnumeration("sri.resource_integrity_mismatch_event", event, SriResourceIntegrityMismatchEventCount);
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, integrityHistogram, new EnumerationHistogram("sri.resource_integrity_mismatch_event", SriResourceIntegrityMismatchEventCount));
+ integrityHistogram.count(event);
}
static ResourceLoadPriority typeToPriority(Resource::Type type)
@@ -389,11 +415,11 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(FetchRequest& request, co
const RevalidationPolicy policy = determineRevalidationPolicy(factory.type(), request, resource.get(), isStaticData);
- String histogramName = "Blink.MemoryCache.RevalidationPolicy.";
- if (request.forPreload())
- histogramName.append("Preload.");
- histogramName.append(Resource::resourceTypeName(factory.type()));
- Platform::current()->histogramEnumeration(histogramName.utf8().data(), policy, Load + 1);
+ if (request.forPreload()) {
+ DEFINE_RESOURCE_HISTOGRAM("Preload.");
+ } else {
+ DEFINE_RESOURCE_HISTOGRAM("");
+ }
switch (policy) {
case Reload:

Powered by Google App Engine
This is Rietveld 408576698