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

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: Fix misplaced bracket on android 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/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 53629fb63586de8934d62311b292b33f631adb73..7fe4aa4fbfc64aef3c52e464cf280a5bb4e4d428 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -67,11 +67,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, MainResource) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Image) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, CSSStyleSheet) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Script) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Font) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Raw) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, SVGDocument) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, XSLStyleSheet) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPrefetch) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPreload) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, TextTrack) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, ImportResource) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Media) \
+ DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Manifest) \
haraken 2016/02/03 00:37:57 Alphabetical order?
dtapuska 2016/02/03 14:43:11 Done.
+ }
+
} // 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)
@@ -388,11 +414,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