| 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 85e674f654dc332ad398a52d224dd0b6a6cd0864..471b387b36c823ce6bc61b39027bfc672ff1f92b 100644
|
| --- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
|
| +++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
|
| @@ -1073,7 +1073,7 @@ void ResourceFetcher::clearPreloads(ClearPreloadsPolicy policy) {
|
| if (!m_preloads)
|
| return;
|
|
|
| - logPreloadStats();
|
| + logPreloadStats(policy);
|
|
|
| for (const auto& resource : *m_preloads) {
|
| if (policy == ClearAllPreloads || !resource->isLinkPreload()) {
|
| @@ -1435,7 +1435,7 @@ void ResourceFetcher::reloadLoFiImages() {
|
| }
|
| }
|
|
|
| -void ResourceFetcher::logPreloadStats() {
|
| +void ResourceFetcher::logPreloadStats(ClearPreloadsPolicy policy) {
|
| if (!m_preloads)
|
| return;
|
| unsigned scripts = 0;
|
| @@ -1455,6 +1455,11 @@ void ResourceFetcher::logPreloadStats() {
|
| unsigned raws = 0;
|
| unsigned rawMisses = 0;
|
| for (const auto& resource : *m_preloads) {
|
| + // Do not double count link rel preloads. These do not get cleared if the
|
| + // ClearPreloadsPolicy is only clearing speculative markup preloads.
|
| + if (resource->isLinkPreload() && policy == ClearSpeculativeMarkupPreloads) {
|
| + continue;
|
| + }
|
| int missCount =
|
| resource->getPreloadResult() == Resource::PreloadNotReferenced ? 1 : 0;
|
| switch (resource->getType()) {
|
| @@ -1494,9 +1499,6 @@ void ResourceFetcher::logPreloadStats() {
|
| NOTREACHED();
|
| }
|
| }
|
| - // TODO(csharrison): These can falsely attribute link rel="preload" requests
|
| - // as misses if they are referenced after parsing completes. Migrate this
|
| - // logic to the memory cache / individual resources to prevent this.
|
| DEFINE_STATIC_LOCAL(CustomCountHistogram, imagePreloads,
|
| ("PreloadScanner.Counts2.Image", 0, 100, 25));
|
| DEFINE_STATIC_LOCAL(CustomCountHistogram, imagePreloadMisses,
|
|
|