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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2771803002: FrameFetchContext should not always respect conditional requests (Closed)
Patch Set: tests Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 6d117db8fe981bf5b26411c1fcd3c4e6bfcf0b7a..0430747038150136f6bc1ad14ddad86bd9770df1 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -221,6 +221,11 @@ enum class RequestMethod { kIsPost, kIsNotPost };
enum class RequestType { kIsConditional, kIsNotConditional };
enum class ResourceType { kIsMainResource, kIsNotMainResource };
+// Determines WebCachePolicy for a main resource, or WebCachePolicy that is
+// corresponding to FrameLoadType.
+// TODO(toyoshim): Probably, we should split FrameLoadType to WebCachePolicy
+// conversion logic into a separate function once other TODOs in this function
+// are resolved.
WebCachePolicy determineWebCachePolicy(RequestMethod method,
RequestType requestType,
ResourceType resourceType,
@@ -270,8 +275,11 @@ WebCachePolicy determineWebCachePolicy(RequestMethod method,
return WebCachePolicy::UseProtocolCachePolicy;
}
-// TODO(toyoshim): Remove |resourceType|. See comments in
-// resourceRequestCachePolicy().
+// Determines WebCachePolicy for |frame|. This WebCachePolicy should be a base
+// policy to consider one of each resource belonging to the frame, and should
+// not count resource specific conditions in.
+// TODO(toyoshim): Remove |resourceType| to realize the design described above.
+// See also comments in resourceRequestCachePolicy().
WebCachePolicy determineFrameWebCachePolicy(Frame* frame,
ResourceType resourceType) {
if (!frame)
@@ -414,13 +422,16 @@ WebCachePolicy FrameFetchContext::resourceRequestCachePolicy(
shouldDisallowFetchForMainFrameScript(request, defer, *m_document))
return WebCachePolicy::ReturnCacheDataDontLoad;
- // TODO(toyoshim): We should check isConditional() and use ValidatingCacheData
- // only when |cachePolicy| below is UseProtocolCachePolicy.
- if (request.isConditional())
- return WebCachePolicy::ValidatingCacheData;
+ const WebCachePolicy cachePolicy =
+ determineFrameWebCachePolicy(frame(), ResourceType::kIsNotMainResource);
- return determineFrameWebCachePolicy(frame(),
- ResourceType::kIsNotMainResource);
+ // TODO(toyoshim): Revisit to consider if this clause can be merged to
+ // determineWebCachePolicy or determineFrameWebCachePolicy.
+ if (cachePolicy == WebCachePolicy::UseProtocolCachePolicy &&
+ request.isConditional()) {
+ return WebCachePolicy::ValidatingCacheData;
+ }
+ return cachePolicy;
}
// The |m_documentLoader| is null in the FrameFetchContext of an imported
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698