| 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 } | 721 } |
| 722 | 722 |
| 723 // During the initial load, avoid loading the same resource multiple times f
or a single document, | 723 // During the initial load, avoid loading the same resource multiple times f
or a single document, |
| 724 // even if the cache policies would tell us to. | 724 // even if the cache policies would tell us to. |
| 725 // We also group loads of the same resource together. | 725 // We also group loads of the same resource together. |
| 726 // Raw resources are exempted, as XHRs fall into this category and may have
user-set Cache-Control: | 726 // Raw resources are exempted, as XHRs fall into this category and may have
user-set Cache-Control: |
| 727 // headers or other factors that require separate requests. | 727 // headers or other factors that require separate requests. |
| 728 if (type != Resource::Raw) { | 728 if (type != Resource::Raw) { |
| 729 if (!context().isLoadComplete() && m_validatedURLs.contains(existingReso
urce->url())) | 729 if (!context().isLoadComplete() && m_validatedURLs.contains(existingReso
urce->url())) |
| 730 return Use; | 730 return Use; |
| 731 // TODO(japhet): existingResource->isLoading() and existingResource->loa
der() are not identical, | 731 if (existingResource->isLoading()) |
| 732 // which is lame. | |
| 733 // Being in the loading state and having a ResourceLoader* are subtly di
ffent cases, either of which | |
| 734 // should indicate reuse. A resource can have isLoading() return true wi
thout a ResourceLoader* if | |
| 735 // it is a font that defers actually loading until the font is required.
On the other hand, | |
| 736 // a Resource can have a non-null ResourceLoader* but have isLoading() r
eturn false in a narrow window | |
| 737 // during completion, because we set loading to false before notifying R
esourceClients, but don't | |
| 738 // clear the ResourceLoader pointer until the stack unwinds. If, inside
the ResourceClient callbacks, | |
| 739 // an event fires synchronously and an event handler re-requests the res
ource, we can reach this point | |
| 740 // while not loading but having a ResourceLoader. | |
| 741 if (existingResource->isLoading() || existingResource->loader()) | |
| 742 return Use; | 732 return Use; |
| 743 } | 733 } |
| 744 | 734 |
| 745 // CachePolicyReload always reloads | 735 // CachePolicyReload always reloads |
| 746 if (cachePolicy == CachePolicyReload) { | 736 if (cachePolicy == CachePolicyReload) { |
| 747 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r
eloading due to CachePolicyReload."); | 737 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r
eloading due to CachePolicyReload."); |
| 748 return Reload; | 738 return Reload; |
| 749 } | 739 } |
| 750 | 740 |
| 751 // We'll try to reload the resource if it failed last time. | 741 // We'll try to reload the resource if it failed last time. |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 visitor->trace(m_context); | 1164 visitor->trace(m_context); |
| 1175 visitor->trace(m_archive); | 1165 visitor->trace(m_archive); |
| 1176 visitor->trace(m_loaders); | 1166 visitor->trace(m_loaders); |
| 1177 visitor->trace(m_nonBlockingLoaders); | 1167 visitor->trace(m_nonBlockingLoaders); |
| 1178 visitor->trace(m_documentResources); | 1168 visitor->trace(m_documentResources); |
| 1179 visitor->trace(m_preloads); | 1169 visitor->trace(m_preloads); |
| 1180 visitor->trace(m_resourceTimingInfoMap); | 1170 visitor->trace(m_resourceTimingInfoMap); |
| 1181 } | 1171 } |
| 1182 | 1172 |
| 1183 } // namespace blink | 1173 } // namespace blink |
| OLD | NEW |