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

Side by Side 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: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (isStaticData) 427 if (isStaticData)
428 resource = resourceForStaticData(request, factory, substituteData); 428 resource = resourceForStaticData(request, factory, substituteData);
429 if (!resource) 429 if (!resource)
430 resource = memoryCache()->resourceForURL(url, getCacheIdentifier()); 430 resource = memoryCache()->resourceForURL(url, getCacheIdentifier());
431 431
432 // See if we can use an existing resource from the cache. If so, we need to move it to be load blocking. 432 // See if we can use an existing resource from the cache. If so, we need to move it to be load blocking.
433 moveCachedNonBlockingResourceToBlocking(resource.get(), request); 433 moveCachedNonBlockingResourceToBlocking(resource.get(), request);
434 434
435 const RevalidationPolicy policy = determineRevalidationPolicy(factory.type() , request, resource.get(), isStaticData); 435 const RevalidationPolicy policy = determineRevalidationPolicy(factory.type() , request, resource.get(), isStaticData);
436 436
437 if (request.forPreload()) { 437 if (!isStaticData) {
Nate Chapin 2016/03/04 23:44:00 Maybe put the contents of this if() statement in a
hiroshige 2016/03/05 00:03:55 Done. Also removed the if() statement because it i
438 DEFINE_RESOURCE_HISTOGRAM("Preload."); 438 if (request.forPreload()) {
439 } else { 439 DEFINE_RESOURCE_HISTOGRAM("Preload.");
440 DEFINE_RESOURCE_HISTOGRAM(""); 440 } else {
441 } 441 DEFINE_RESOURCE_HISTOGRAM("");
442 // Aims to count Resource only referenced from MemoryCache (i.e. what 442 }
443 // would be dead if MemoryCache holds weak references to Resource). 443
444 // Currently we check references to Resource from ResourceClient and 444 // Aims to count Resource only referenced from MemoryCache (i.e. what
445 // |m_preloads| only, because they are major sources of references. 445 // would be dead if MemoryCache holds weak references to Resource).
446 if (resource && !resource->hasClients() && (!m_preloads || !m_preloads->cont ains(resource)) && !isStaticData) { 446 // Currently we check references to Resource from ResourceClient and
447 DEFINE_RESOURCE_HISTOGRAM("Dead."); 447 // |m_preloads| only, because they are major sources of references.
448 if (resource && !resource->hasClients() && (!m_preloads || !m_preloads-> contains(resource))) {
449 DEFINE_RESOURCE_HISTOGRAM("Dead.");
450 }
448 } 451 }
449 452
450 switch (policy) { 453 switch (policy) {
451 case Reload: 454 case Reload:
452 memoryCache()->remove(resource.get()); 455 memoryCache()->remove(resource.get());
453 // Fall through 456 // Fall through
454 case Load: 457 case Load:
455 resource = createResourceForLoading(request, request.charset(), factory) ; 458 resource = createResourceForLoading(request, request.charset(), factory) ;
456 break; 459 break;
457 case Revalidate: 460 case Revalidate:
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 visitor->trace(m_loaders); 1236 visitor->trace(m_loaders);
1234 visitor->trace(m_nonBlockingLoaders); 1237 visitor->trace(m_nonBlockingLoaders);
1235 #if ENABLE(OILPAN) 1238 #if ENABLE(OILPAN)
1236 visitor->trace(m_documentResources); 1239 visitor->trace(m_documentResources);
1237 visitor->trace(m_preloads); 1240 visitor->trace(m_preloads);
1238 visitor->trace(m_resourceTimingInfoMap); 1241 visitor->trace(m_resourceTimingInfoMap);
1239 #endif 1242 #endif
1240 } 1243 }
1241 1244
1242 } // namespace blink 1245 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698