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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 // reference to the image is parsed (which would be at a lower priority) . | 504 // reference to the image is parsed (which would be at a lower priority) . |
| 505 if (priority > resource->resourceRequest().priority()) | 505 if (priority > resource->resourceRequest().priority()) |
| 506 resource->didChangePriority(priority, 0); | 506 resource->didChangePriority(priority, 0); |
| 507 } | 507 } |
| 508 | 508 |
| 509 // If only the fragment identifiers differ, it is the same resource. | 509 // If only the fragment identifiers differ, it is the same resource. |
| 510 ASSERT(equalIgnoringFragmentIdentifier(resource->url(), url)); | 510 ASSERT(equalIgnoringFragmentIdentifier(resource->url(), url)); |
| 511 requestLoadStarted(resource, request, policy == Use ? ResourceLoadingFromCac he : ResourceLoadingFromNetwork, isStaticData); | 511 requestLoadStarted(resource, request, policy == Use ? ResourceLoadingFromCac he : ResourceLoadingFromNetwork, isStaticData); |
| 512 m_documentResources.set(urlWithoutFragment, resource); | 512 m_documentResources.set(urlWithoutFragment, resource); |
| 513 | 513 |
| 514 // Returns with an existing resource if the resource does not need to start | |
| 515 // loading immediately. | |
| 516 // If revalidation policy was determined as |Revalidate|, the resource was | |
| 517 // already initialized for the revalidation here, but won't start loading. | |
| 514 if (!resourceNeedsLoad(resource, request, policy)) | 518 if (!resourceNeedsLoad(resource, request, policy)) |
| 515 return resource; | 519 return resource; |
| 516 | 520 |
| 517 if (!context().shouldLoadNewResource(factory.type())) { | 521 if (!context().shouldLoadNewResource(factory.type())) { |
| 518 if (memoryCache()->contains(resource)) | 522 if (memoryCache()->contains(resource)) |
| 519 memoryCache()->remove(resource); | 523 memoryCache()->remove(resource); |
| 520 return nullptr; | 524 return nullptr; |
| 521 } | 525 } |
| 522 | 526 |
| 523 resource->load(this); | 527 resource->load(this); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 if (!existingResource->canReuseRedirectChain()) { | 792 if (!existingResource->canReuseRedirectChain()) { |
| 789 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to an uncacheable redirect"); | 793 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to an uncacheable redirect"); |
| 790 return Reload; | 794 return Reload; |
| 791 } | 795 } |
| 792 | 796 |
| 793 // Check if the cache headers requires us to revalidate (cache expiration fo r example). | 797 // Check if the cache headers requires us to revalidate (cache expiration fo r example). |
| 794 if (cachePolicy == CachePolicyRevalidate || existingResource->mustRevalidate DueToCacheHeaders() | 798 if (cachePolicy == CachePolicyRevalidate || existingResource->mustRevalidate DueToCacheHeaders() |
| 795 || request.cacheControlContainsNoCache()) { | 799 || request.cacheControlContainsNoCache()) { |
| 796 // See if the resource has usable ETag or Last-modified headers. | 800 // See if the resource has usable ETag or Last-modified headers. |
| 797 // If the page is controlled by the ServiceWorker, we choose the Reload policy because the revalidation headers should not be exposed to the ServiceWork er.(crbug.com/429570) | 801 // If the page is controlled by the ServiceWorker, we choose the Reload policy because the revalidation headers should not be exposed to the ServiceWork er.(crbug.com/429570) |
| 798 if (existingResource->canUseCacheValidator() && !context().isControlledB yServiceWorker()) | 802 if (existingResource->canUseCacheValidator() && !context().isControlledB yServiceWorker()) { |
| 803 // If the resource is already a cache validator but not started yet, | |
| 804 // the |Use| policy should be applied to subsequent requests. | |
| 805 if (existingResource->isCacheValidator()) { | |
| 806 DCHECK(existingResource->stillNeedsLoad()); | |
|
Takashi Toyoshima
2016/06/06 13:14:19
existingResource->canUseCacheValidator() ensures t
| |
| 807 return Use; | |
| 808 } | |
| 799 return Revalidate; | 809 return Revalidate; |
| 810 } | |
| 800 | 811 |
| 801 // No, must reload. | 812 // No, must reload. |
| 802 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to missing cache validators."); | 813 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to missing cache validators."); |
| 803 return Reload; | 814 return Reload; |
| 804 } | 815 } |
| 805 | 816 |
| 806 return Use; | 817 return Use; |
| 807 } | 818 } |
| 808 | 819 |
| 809 void ResourceFetcher::setAutoLoadImages(bool enable) | 820 void ResourceFetcher::setAutoLoadImages(bool enable) |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1248 visitor->trace(m_context); | 1259 visitor->trace(m_context); |
| 1249 visitor->trace(m_archive); | 1260 visitor->trace(m_archive); |
| 1250 visitor->trace(m_loaders); | 1261 visitor->trace(m_loaders); |
| 1251 visitor->trace(m_nonBlockingLoaders); | 1262 visitor->trace(m_nonBlockingLoaders); |
| 1252 visitor->trace(m_documentResources); | 1263 visitor->trace(m_documentResources); |
| 1253 visitor->trace(m_preloads); | 1264 visitor->trace(m_preloads); |
| 1254 visitor->trace(m_resourceTimingInfoMap); | 1265 visitor->trace(m_resourceTimingInfoMap); |
| 1255 } | 1266 } |
| 1256 | 1267 |
| 1257 } // namespace blink | 1268 } // namespace blink |
| OLD | NEW |