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