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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 namespace { 61 namespace {
62 62
63 // Events for UMA. Do not reorder or delete. Add new events at the end, but 63 // Events for UMA. Do not reorder or delete. Add new events at the end, but
64 // before SriResourceIntegrityMismatchEventCount. 64 // before SriResourceIntegrityMismatchEventCount.
65 enum SriResourceIntegrityMismatchEvent { 65 enum SriResourceIntegrityMismatchEvent {
66 CheckingForIntegrityMismatch = 0, 66 CheckingForIntegrityMismatch = 0,
67 RefetchDueToIntegrityMismatch = 1, 67 RefetchDueToIntegrityMismatch = 1,
68 SriResourceIntegrityMismatchEventCount 68 SriResourceIntegrityMismatchEventCount
69 }; 69 };
70 70
71 #define DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, name) \
72 case Resource::name: { \
73 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, resourceHistogram, new EnumerationHistogram("Blink.MemoryCache.RevalidationPolicy." prefix #name, Load + 1)); \
74 resourceHistogram.count(policy); \
75 break; \
76 }
77
78 #define DEFINE_RESOURCE_HISTOGRAM(prefix) \
79 switch (factory.type()) { \
80 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, CSSStyleSheet) \
81 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Font) \
82 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Image) \
83 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, ImportResource) \
84 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPrefetch) \
85 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPreload) \
86 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, MainResource) \
87 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Manifest) \
88 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Media) \
89 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Raw) \
90 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Script) \
91 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, SVGDocument) \
92 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, TextTrack) \
93 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, XSLStyleSheet) \
94 }
95
71 } // namespace 96 } // namespace
72 97
73 static void RecordSriResourceIntegrityMismatchEvent(SriResourceIntegrityMismatch Event event) 98 static void RecordSriResourceIntegrityMismatchEvent(SriResourceIntegrityMismatch Event event)
74 { 99 {
75 Platform::current()->histogramEnumeration("sri.resource_integrity_mismatch_e vent", event, SriResourceIntegrityMismatchEventCount); 100 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, integrityHistogram, ne w EnumerationHistogram("sri.resource_integrity_mismatch_event", SriResourceInteg rityMismatchEventCount));
101 integrityHistogram.count(event);
76 } 102 }
77 103
78 static ResourceLoadPriority typeToPriority(Resource::Type type) 104 static ResourceLoadPriority typeToPriority(Resource::Type type)
79 { 105 {
80 switch (type) { 106 switch (type) {
81 case Resource::MainResource: 107 case Resource::MainResource:
82 return ResourceLoadPriorityVeryHigh; 108 return ResourceLoadPriorityVeryHigh;
83 case Resource::XSLStyleSheet: 109 case Resource::XSLStyleSheet:
84 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); 110 ASSERT(RuntimeEnabledFeatures::xsltEnabled());
85 case Resource::CSSStyleSheet: 111 case Resource::CSSStyleSheet:
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 if (isStaticData) 408 if (isStaticData)
383 resource = preCacheData(request, factory, substituteData); 409 resource = preCacheData(request, factory, substituteData);
384 if (!resource) 410 if (!resource)
385 resource = memoryCache()->resourceForURL(url, getCacheIdentifier()); 411 resource = memoryCache()->resourceForURL(url, getCacheIdentifier());
386 412
387 // See if we can use an existing resource from the cache. If so, we need to move it to be load blocking. 413 // See if we can use an existing resource from the cache. If so, we need to move it to be load blocking.
388 moveCachedNonBlockingResourceToBlocking(resource.get(), request); 414 moveCachedNonBlockingResourceToBlocking(resource.get(), request);
389 415
390 const RevalidationPolicy policy = determineRevalidationPolicy(factory.type() , request, resource.get(), isStaticData); 416 const RevalidationPolicy policy = determineRevalidationPolicy(factory.type() , request, resource.get(), isStaticData);
391 417
392 String histogramName = "Blink.MemoryCache.RevalidationPolicy."; 418 if (request.forPreload()) {
393 if (request.forPreload()) 419 DEFINE_RESOURCE_HISTOGRAM("Preload.");
394 histogramName.append("Preload."); 420 } else {
395 histogramName.append(Resource::resourceTypeName(factory.type())); 421 DEFINE_RESOURCE_HISTOGRAM("");
396 Platform::current()->histogramEnumeration(histogramName.utf8().data(), polic y, Load + 1); 422 }
397 423
398 switch (policy) { 424 switch (policy) {
399 case Reload: 425 case Reload:
400 memoryCache()->remove(resource.get()); 426 memoryCache()->remove(resource.get());
401 // Fall through 427 // Fall through
402 case Load: 428 case Load:
403 resource = createResourceForLoading(request, request.charset(), factory) ; 429 resource = createResourceForLoading(request, request.charset(), factory) ;
404 break; 430 break;
405 case Revalidate: 431 case Revalidate:
406 initializeRevalidation(request, resource.get()); 432 initializeRevalidation(request, resource.get());
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 visitor->trace(m_loaders); 1207 visitor->trace(m_loaders);
1182 visitor->trace(m_nonBlockingLoaders); 1208 visitor->trace(m_nonBlockingLoaders);
1183 #if ENABLE(OILPAN) 1209 #if ENABLE(OILPAN)
1184 visitor->trace(m_documentResources); 1210 visitor->trace(m_documentResources);
1185 visitor->trace(m_preloads); 1211 visitor->trace(m_preloads);
1186 visitor->trace(m_resourceTimingInfoMap); 1212 visitor->trace(m_resourceTimingInfoMap);
1187 #endif 1213 #endif
1188 } 1214 }
1189 1215
1190 } // namespace blink 1216 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698