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

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

Issue 1771473002: [MemoryCache] Exclude data URLs and SubstituteData from MemoryCache UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reflect comment 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 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 6df47ed01b2daa6e7d645ff106df600d0166a9b1..af5bed4d33ebaaf89d53d56ef7ea29345376a071 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -385,6 +385,26 @@ void ResourceFetcher::moveCachedNonBlockingResourceToBlocking(Resource* resource
}
}
+void ResourceFetcher::updateMemoryCacheStats(Resource* resource, RevalidationPolicy policy, const FetchRequest& request, const ResourceFactory& factory, bool isStaticData) const
+{
+ if (isStaticData)
+ return;
+
+ if (request.forPreload()) {
+ DEFINE_RESOURCE_HISTOGRAM("Preload.");
+ } else {
+ DEFINE_RESOURCE_HISTOGRAM("");
+ }
+
+ // Aims to count Resource only referenced from MemoryCache (i.e. what
+ // would be dead if MemoryCache holds weak references to Resource).
+ // Currently we check references to Resource from ResourceClient and
+ // |m_preloads| only, because they are major sources of references.
+ if (resource && !resource->hasClients() && (!m_preloads || !m_preloads->contains(resource))) {
+ DEFINE_RESOURCE_HISTOGRAM("Dead.");
+ }
+}
+
PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::requestResource(FetchRequest& request, const ResourceFactory& factory, const SubstituteData& substituteData)
{
ASSERT(request.options().synchronousPolicy == RequestAsynchronously || factory.type() == Resource::Raw || factory.type() == Resource::XSLStyleSheet);
@@ -434,18 +454,7 @@ PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::requestResource(FetchRequest&
const RevalidationPolicy policy = determineRevalidationPolicy(factory.type(), request, resource.get(), isStaticData);
- if (request.forPreload()) {
- DEFINE_RESOURCE_HISTOGRAM("Preload.");
- } else {
- DEFINE_RESOURCE_HISTOGRAM("");
- }
- // Aims to count Resource only referenced from MemoryCache (i.e. what
- // would be dead if MemoryCache holds weak references to Resource).
- // Currently we check references to Resource from ResourceClient and
- // |m_preloads| only, because they are major sources of references.
- if (resource && !resource->hasClients() && (!m_preloads || !m_preloads->contains(resource)) && !isStaticData) {
- DEFINE_RESOURCE_HISTOGRAM("Dead.");
- }
+ updateMemoryCacheStats(resource.get(), policy, request, factory, isStaticData);
switch (policy) {
case Reload:
« 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