Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: Source/core/loader/FrameFetchContext.cpp

Issue 1213913003: Don't revalidate all resources for FrameLoadTypeSame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix oilpan + assert failures Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return ReturnCacheDataElseLoad; 155 return ReturnCacheDataElseLoad;
156 return UseProtocolCachePolicy; 156 return UseProtocolCachePolicy;
157 } 157 }
158 158
159 ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const R esourceRequest& request, Resource::Type type) const 159 ResourceRequestCachePolicy FrameFetchContext::resourceRequestCachePolicy(const R esourceRequest& request, Resource::Type type) const
160 { 160 {
161 if (type == Resource::MainResource) { 161 if (type == Resource::MainResource) {
162 FrameLoadType frameLoadType = frame()->loader().loadType(); 162 FrameLoadType frameLoadType = frame()->loader().loadType();
163 if (request.httpMethod() == "POST" && frameLoadType == FrameLoadTypeBack Forward) 163 if (request.httpMethod() == "POST" && frameLoadType == FrameLoadTypeBack Forward)
164 return ReturnCacheDataDontLoad; 164 return ReturnCacheDataDontLoad;
165 if (!frame()->host()->overrideEncoding().isEmpty() || frameLoadType == F rameLoadTypeBackForward) 165 if (!frame()->host()->overrideEncoding().isEmpty())
166 return ReturnCacheDataElseLoad; 166 return ReturnCacheDataElseLoad;
167 if (frameLoadType == FrameLoadTypeReloadFromOrigin) 167 if (frameLoadType == FrameLoadTypeSame || request.isConditional() || req uest.httpMethod() == "POST")
168 return ReloadBypassingCache;
169 if (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTy peSame || request.isConditional() || request.httpMethod() == "POST")
170 return ReloadIgnoringCacheData; 168 return ReloadIgnoringCacheData;
171 Frame* parent = frame()->tree().parent(); 169
172 if (parent && parent->isLocalFrame()) 170 for (Frame* f = frame(); f; f = f->tree().parent()) {
173 return toLocalFrame(parent)->document()->fetcher()->context().resour ceRequestCachePolicy(request, type); 171 if (!f->isLocalFrame())
172 continue;
173 frameLoadType = toLocalFrame(f)->loader().loadType();
174 if (frameLoadType == FrameLoadTypeBackForward)
175 return ReturnCacheDataElseLoad;
176 if (frameLoadType == FrameLoadTypeReloadFromOrigin)
177 return ReloadBypassingCache;
178 if (frameLoadType == FrameLoadTypeReload)
179 return ReloadIgnoringCacheData;
180 }
174 return UseProtocolCachePolicy; 181 return UseProtocolCachePolicy;
175 } 182 }
176 183
177 if (request.isConditional()) 184 if (request.isConditional())
178 return ReloadIgnoringCacheData; 185 return ReloadIgnoringCacheData;
179 186
180 if (m_documentLoader && m_document && !m_document->loadEventFinished()) { 187 if (m_documentLoader && m_document && !m_document->loadEventFinished()) {
181 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission. 188 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission.
182 // This policy should not be inherited by subresources. 189 // This policy should not be inherited by subresources.
183 ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->r equest().cachePolicy(); 190 ResourceRequestCachePolicy mainResourceCachePolicy = m_documentLoader->r equest().cachePolicy();
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } 669 }
663 670
664 DEFINE_TRACE(FrameFetchContext) 671 DEFINE_TRACE(FrameFetchContext)
665 { 672 {
666 visitor->trace(m_document); 673 visitor->trace(m_document);
667 visitor->trace(m_documentLoader); 674 visitor->trace(m_documentLoader);
668 FetchContext::trace(visitor); 675 FetchContext::trace(visitor);
669 } 676 }
670 677
671 } // namespace blink 678 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698