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

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

Issue 2484823002: Stop double counting link rel preload preloads for metrics tracking (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698