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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 // Always use preloads. | 895 // Always use preloads. |
896 if (existingResource->isPreloaded()) | 896 if (existingResource->isPreloaded()) |
897 return Use; | 897 return Use; |
898 | 898 |
899 // CachePolicyHistoryBuffer uses the cache no matter what. | 899 // CachePolicyHistoryBuffer uses the cache no matter what. |
900 CachePolicy cachePolicy = context().cachePolicy(document()); | 900 CachePolicy cachePolicy = context().cachePolicy(document()); |
901 if (cachePolicy == CachePolicyHistoryBuffer) | 901 if (cachePolicy == CachePolicyHistoryBuffer) |
902 return Use; | 902 return Use; |
903 | 903 |
904 // Don't reuse resources with Cache-control: no-store. | 904 // Don't reuse resources with Cache-control: no-store. |
905 if (existingResource->response().cacheControlContainsNoStore()) { | 905 if (existingResource->hasCacheControlNoStoreHeader()) { |
906 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to Cache-control: no-store."); | 906 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to Cache-control: no-store."); |
907 return Reload; | 907 return Reload; |
908 } | 908 } |
909 | 909 |
910 // If fetching a resource with a different 'CORS enabled' flag, reload. | 910 // If fetching a resource with a different 'CORS enabled' flag, reload. |
911 if (type != Resource::MainResource && options.corsEnabled != existingResourc e->options().corsEnabled) | 911 if (type != Resource::MainResource && options.corsEnabled != existingResourc e->options().corsEnabled) |
912 return Reload; | 912 return Reload; |
913 | 913 |
914 // If credentials were sent with the previous request and won't be | 914 // If credentials were sent with the previous request and won't be |
915 // with this one, or vice versa, re-fetch the resource. | 915 // with this one, or vice versa, re-fetch the resource. |
(...skipping 27 matching lines...) Expand all Loading... | |
943 if (existingResource->isLoading()) | 943 if (existingResource->isLoading()) |
944 return Use; | 944 return Use; |
945 | 945 |
946 // If any of the redirects in the chain to loading the resource were not cac heable, we cannot reuse our cached resource. | 946 // If any of the redirects in the chain to loading the resource were not cac heable, we cannot reuse our cached resource. |
947 if (!existingResource->canReuseRedirectChain()) { | 947 if (!existingResource->canReuseRedirectChain()) { |
948 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to an uncacheable redirect"); | 948 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to an uncacheable redirect"); |
949 return Reload; | 949 return Reload; |
950 } | 950 } |
951 | 951 |
952 // Check if the cache headers requires us to revalidate (cache expiration fo r example). | 952 // Check if the cache headers requires us to revalidate (cache expiration fo r example). |
953 if (cachePolicy == CachePolicyRevalidate || existingResource->mustRevalidate DueToCacheHeaders()) { | 953 if (cachePolicy == CachePolicyRevalidate || existingResource->mustRevalidate DueToCacheHeaders()) { |
yhirano
2014/04/09 04:08:37
I think cacheControlContainsNoCache() should be ch
| |
954 // See if the resource has usable ETag or Last-modified headers. | 954 // See if the resource has usable ETag or Last-modified headers. |
955 if (existingResource->canUseCacheValidator()) | 955 if (existingResource->canUseCacheValidator()) |
956 return Revalidate; | 956 return Revalidate; |
957 | 957 |
958 // No, must reload. | 958 // No, must reload. |
959 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to missing cache validators."); | 959 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to missing cache validators."); |
960 return Reload; | 960 return Reload; |
961 } | 961 } |
962 | 962 |
963 return Use; | 963 return Use; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1400 case Revalidate: | 1400 case Revalidate: |
1401 ++m_revalidateCount; | 1401 ++m_revalidateCount; |
1402 return; | 1402 return; |
1403 case Use: | 1403 case Use: |
1404 ++m_useCount; | 1404 ++m_useCount; |
1405 return; | 1405 return; |
1406 } | 1406 } |
1407 } | 1407 } |
1408 | 1408 |
1409 } | 1409 } |
OLD | NEW |