Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 CachePolicy parentCachePolicy = toLocalFrame(parentFrame)->document()->f etcher()->context().getCachePolicy(); | 211 CachePolicy parentCachePolicy = toLocalFrame(parentFrame)->document()->f etcher()->context().getCachePolicy(); |
| 212 if (parentCachePolicy != CachePolicyVerify) | 212 if (parentCachePolicy != CachePolicyVerify) |
| 213 return parentCachePolicy; | 213 return parentCachePolicy; |
| 214 } | 214 } |
| 215 | 215 |
| 216 if (loadType == FrameLoadTypeReload) | 216 if (loadType == FrameLoadTypeReload) |
| 217 return CachePolicyRevalidate; | 217 return CachePolicyRevalidate; |
| 218 | 218 |
| 219 if (m_documentLoader && m_documentLoader->request().getCachePolicy() == WebC achePolicy::ReturnCacheDataElseLoad) | 219 if (m_documentLoader && m_documentLoader->request().getCachePolicy() == WebC achePolicy::ReturnCacheDataElseLoad) |
| 220 return CachePolicyHistoryBuffer; | 220 return CachePolicyHistoryBuffer; |
| 221 | |
| 222 // Returns CachePolicyVerify for other cases, mainly FrameLoadTypeStandard | |
| 223 // and FrameLoadTypeReloadMainResource. See public/web/WebFrameLoadType.h | |
| 224 // to know how these load types work. | |
| 221 return CachePolicyVerify; | 225 return CachePolicyVerify; |
| 222 } | 226 } |
| 223 | 227 |
| 224 static WebCachePolicy memoryCachePolicyToResourceRequestCachePolicy(const CacheP olicy policy) | 228 static WebCachePolicy memoryCachePolicyToResourceRequestCachePolicy(const CacheP olicy policy) |
| 225 { | 229 { |
| 226 if (policy == CachePolicyVerify) | 230 if (policy == CachePolicyVerify) |
| 227 return WebCachePolicy::UseProtocolCachePolicy; | 231 return WebCachePolicy::UseProtocolCachePolicy; |
| 228 if (policy == CachePolicyRevalidate) | 232 if (policy == CachePolicyRevalidate) |
| 229 return WebCachePolicy::ValidatingCacheData; | 233 return WebCachePolicy::ValidatingCacheData; |
| 230 if (policy == CachePolicyReload) | 234 if (policy == CachePolicyReload) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 250 if (!f->isLocalFrame()) | 254 if (!f->isLocalFrame()) |
| 251 continue; | 255 continue; |
| 252 frameLoadType = toLocalFrame(f)->loader().loadType(); | 256 frameLoadType = toLocalFrame(f)->loader().loadType(); |
| 253 if (frameLoadType == FrameLoadTypeBackForward) | 257 if (frameLoadType == FrameLoadTypeBackForward) |
| 254 return WebCachePolicy::ReturnCacheDataElseLoad; | 258 return WebCachePolicy::ReturnCacheDataElseLoad; |
| 255 if (frameLoadType == FrameLoadTypeReloadBypassingCache) | 259 if (frameLoadType == FrameLoadTypeReloadBypassingCache) |
| 256 return WebCachePolicy::BypassingCache; | 260 return WebCachePolicy::BypassingCache; |
| 257 if (frameLoadType == FrameLoadTypeReload) | 261 if (frameLoadType == FrameLoadTypeReload) |
| 258 return WebCachePolicy::ValidatingCacheData; | 262 return WebCachePolicy::ValidatingCacheData; |
| 259 } | 263 } |
| 264 // Returns UseProtocolCachePolicy for other cases, mainly | |
| 265 // FrameLoadTypeStandard and FrameLoadTypeReloadMainResource. | |
|
hiroshige
2016/07/28 03:38:45
Is it referring to |frameLoadType| assigned at Lin
Takashi Toyoshima
2016/07/29 13:24:49
Ah, right.
This is confusing. Can I stop reusing t
| |
| 266 // See public/web/WebFrameLoadType.h to know how these load types work. | |
| 260 return WebCachePolicy::UseProtocolCachePolicy; | 267 return WebCachePolicy::UseProtocolCachePolicy; |
| 261 } | 268 } |
| 262 | 269 |
| 263 // For users on slow connections, we want to avoid blocking the parser in | 270 // For users on slow connections, we want to avoid blocking the parser in |
| 264 // the main frame on script loads inserted via document.write, since it can | 271 // the main frame on script loads inserted via document.write, since it can |
| 265 // add significant delays before page content is displayed on the screen. | 272 // add significant delays before page content is displayed on the screen. |
| 266 if (type == Resource::Script && isMainFrame() && m_document && shouldDisallo wFetchForMainFrameScript(request, defer, *m_document)) | 273 if (type == Resource::Script && isMainFrame() && m_document && shouldDisallo wFetchForMainFrameScript(request, defer, *m_document)) |
| 267 return WebCachePolicy::ReturnCacheDataDontLoad; | 274 return WebCachePolicy::ReturnCacheDataDontLoad; |
| 268 | 275 |
| 269 if (request.isConditional()) | 276 if (request.isConditional()) |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 812 } | 819 } |
| 813 | 820 |
| 814 DEFINE_TRACE(FrameFetchContext) | 821 DEFINE_TRACE(FrameFetchContext) |
| 815 { | 822 { |
| 816 visitor->trace(m_document); | 823 visitor->trace(m_document); |
| 817 visitor->trace(m_documentLoader); | 824 visitor->trace(m_documentLoader); |
| 818 FetchContext::trace(visitor); | 825 FetchContext::trace(visitor); |
| 819 } | 826 } |
| 820 | 827 |
| 821 } // namespace blink | 828 } // namespace blink |
| OLD | NEW |