Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 // Events for UMA. Do not reorder or delete. Add new events at the end, but | 62 // Events for UMA. Do not reorder or delete. Add new events at the end, but |
| 63 // before SriResourceIntegrityMismatchEventCount. | 63 // before SriResourceIntegrityMismatchEventCount. |
| 64 enum SriResourceIntegrityMismatchEvent { | 64 enum SriResourceIntegrityMismatchEvent { |
| 65 CheckingForIntegrityMismatch = 0, | 65 CheckingForIntegrityMismatch = 0, |
| 66 RefetchDueToIntegrityMismatch = 1, | 66 RefetchDueToIntegrityMismatch = 1, |
| 67 SriResourceIntegrityMismatchEventCount | 67 SriResourceIntegrityMismatchEventCount |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 #define DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, name) \ | |
| 71 case Resource::name: { \ | |
| 72 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, resourceHistogram, new EnumerationHistogram("Blink.MemoryCache.RevalidationPolicy." prefix #name, Load + 1)); \ | |
| 73 resourceHistogram.count(policy); \ | |
| 74 break; \ | |
| 75 } | |
| 76 | |
| 77 #define DEFINE_RESOURCE_HISTOGRAM(prefix) \ | |
| 78 switch (factory.type()) { \ | |
| 79 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, MainResource) \ | |
| 80 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Image) \ | |
| 81 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, CSSStyleSheet) \ | |
| 82 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Script) \ | |
| 83 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Font) \ | |
| 84 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Raw) \ | |
| 85 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, SVGDocument) \ | |
| 86 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, XSLStyleSheet) \ | |
| 87 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPrefetch) \ | |
| 88 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPreload) \ | |
| 89 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, TextTrack) \ | |
| 90 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, ImportResource) \ | |
| 91 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Media) \ | |
| 92 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Manifest) \ | |
|
haraken
2016/02/03 00:37:57
Alphabetical order?
dtapuska
2016/02/03 14:43:11
Done.
| |
| 93 } | |
| 94 | |
| 70 } // namespace | 95 } // namespace |
| 71 | 96 |
| 72 static void RecordSriResourceIntegrityMismatchEvent(SriResourceIntegrityMismatch Event event) | 97 static void RecordSriResourceIntegrityMismatchEvent(SriResourceIntegrityMismatch Event event) |
| 73 { | 98 { |
| 74 Platform::current()->histogramEnumeration("sri.resource_integrity_mismatch_e vent", event, SriResourceIntegrityMismatchEventCount); | 99 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, integrityHistogram, ne w EnumerationHistogram("sri.resource_integrity_mismatch_event", SriResourceInteg rityMismatchEventCount)); |
| 100 integrityHistogram.count(event); | |
| 75 } | 101 } |
| 76 | 102 |
| 77 static ResourceLoadPriority typeToPriority(Resource::Type type) | 103 static ResourceLoadPriority typeToPriority(Resource::Type type) |
| 78 { | 104 { |
| 79 switch (type) { | 105 switch (type) { |
| 80 case Resource::MainResource: | 106 case Resource::MainResource: |
| 81 return ResourceLoadPriorityVeryHigh; | 107 return ResourceLoadPriorityVeryHigh; |
| 82 case Resource::XSLStyleSheet: | 108 case Resource::XSLStyleSheet: |
| 83 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 109 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
| 84 case Resource::CSSStyleSheet: | 110 case Resource::CSSStyleSheet: |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 if (isStaticData) | 407 if (isStaticData) |
| 382 resource = preCacheData(request, factory, substituteData); | 408 resource = preCacheData(request, factory, substituteData); |
| 383 if (!resource) | 409 if (!resource) |
| 384 resource = memoryCache()->resourceForURL(url, getCacheIdentifier()); | 410 resource = memoryCache()->resourceForURL(url, getCacheIdentifier()); |
| 385 | 411 |
| 386 // See if we can use an existing resource from the cache. If so, we need to move it to be load blocking. | 412 // See if we can use an existing resource from the cache. If so, we need to move it to be load blocking. |
| 387 moveCachedNonBlockingResourceToBlocking(resource.get(), request); | 413 moveCachedNonBlockingResourceToBlocking(resource.get(), request); |
| 388 | 414 |
| 389 const RevalidationPolicy policy = determineRevalidationPolicy(factory.type() , request, resource.get(), isStaticData); | 415 const RevalidationPolicy policy = determineRevalidationPolicy(factory.type() , request, resource.get(), isStaticData); |
| 390 | 416 |
| 391 String histogramName = "Blink.MemoryCache.RevalidationPolicy."; | 417 if (request.forPreload()) { |
| 392 if (request.forPreload()) | 418 DEFINE_RESOURCE_HISTOGRAM("Preload."); |
| 393 histogramName.append("Preload."); | 419 } else { |
| 394 histogramName.append(Resource::resourceTypeName(factory.type())); | 420 DEFINE_RESOURCE_HISTOGRAM(""); |
| 395 Platform::current()->histogramEnumeration(histogramName.utf8().data(), polic y, Load + 1); | 421 } |
| 396 | 422 |
| 397 switch (policy) { | 423 switch (policy) { |
| 398 case Reload: | 424 case Reload: |
| 399 memoryCache()->remove(resource.get()); | 425 memoryCache()->remove(resource.get()); |
| 400 // Fall through | 426 // Fall through |
| 401 case Load: | 427 case Load: |
| 402 resource = createResourceForLoading(request, request.charset(), factory) ; | 428 resource = createResourceForLoading(request, request.charset(), factory) ; |
| 403 break; | 429 break; |
| 404 case Revalidate: | 430 case Revalidate: |
| 405 initializeRevalidation(request, resource.get()); | 431 initializeRevalidation(request, resource.get()); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1170 visitor->trace(m_loaders); | 1196 visitor->trace(m_loaders); |
| 1171 visitor->trace(m_nonBlockingLoaders); | 1197 visitor->trace(m_nonBlockingLoaders); |
| 1172 #if ENABLE(OILPAN) | 1198 #if ENABLE(OILPAN) |
| 1173 visitor->trace(m_documentResources); | 1199 visitor->trace(m_documentResources); |
| 1174 visitor->trace(m_preloads); | 1200 visitor->trace(m_preloads); |
| 1175 visitor->trace(m_resourceTimingInfoMap); | 1201 visitor->trace(m_resourceTimingInfoMap); |
| 1176 #endif | 1202 #endif |
| 1177 } | 1203 } |
| 1178 | 1204 |
| 1179 } // namespace blink | 1205 } // namespace blink |
| OLD | NEW |