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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |