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

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

Issue 2767413002: FrameFetchContext should respect BypassingCache for main resources (Closed)
Patch Set: merge master Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // Does not propagate cache policy for subresources after the load event. 282 // Does not propagate cache policy for subresources after the load event.
283 // TODO(toyoshim): We should be able to remove following parents' policy check 283 // TODO(toyoshim): We should be able to remove following parents' policy check
284 // if each frame has a relevant FrameLoadType for reload and history 284 // if each frame has a relevant FrameLoadType for reload and history
285 // navigations. 285 // navigations.
286 if (resourceType == ResourceType::kIsNotMainResource && 286 if (resourceType == ResourceType::kIsNotMainResource &&
287 toLocalFrame(frame)->document()->loadEventFinished()) { 287 toLocalFrame(frame)->document()->loadEventFinished()) {
288 return WebCachePolicy::UseProtocolCachePolicy; 288 return WebCachePolicy::UseProtocolCachePolicy;
289 } 289 }
290 290
291 // Respects BypassingCache rather than parent's policy. 291 // Respects BypassingCache rather than parent's policy.
292 // TODO(toyoshim): Adopt BypassingCache even for MainResource.
293 FrameLoadType loadType = 292 FrameLoadType loadType =
294 toLocalFrame(frame)->loader().documentLoader()->loadType(); 293 toLocalFrame(frame)->loader().documentLoader()->loadType();
295 if (resourceType == ResourceType::kIsNotMainResource && 294 if (loadType == FrameLoadTypeReloadBypassingCache)
296 loadType == FrameLoadTypeReloadBypassingCache) {
297 return WebCachePolicy::BypassingCache; 295 return WebCachePolicy::BypassingCache;
298 }
299 296
300 // Respects parent's policy if it has a special one. 297 // Respects parent's policy if it has a special one.
301 WebCachePolicy parentPolicy = 298 WebCachePolicy parentPolicy =
302 determineFrameWebCachePolicy(frame->tree().parent(), resourceType); 299 determineFrameWebCachePolicy(frame->tree().parent(), resourceType);
303 if (parentPolicy != WebCachePolicy::UseProtocolCachePolicy) 300 if (parentPolicy != WebCachePolicy::UseProtocolCachePolicy)
304 return parentPolicy; 301 return parentPolicy;
305 302
306 // Otherwise, follows FrameLoadType. Use kIsNotPost, kIsNotConditional, and 303 // Otherwise, follows FrameLoadType. Use kIsNotPost, kIsNotConditional, and
307 // kIsNotMainResource to obtain a representative policy for the frame. 304 // kIsNotMainResource to obtain a representative policy for the frame.
308 return determineWebCachePolicy(RequestMethod::kIsNotPost, 305 return determineWebCachePolicy(RequestMethod::kIsNotPost,
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 response); 1069 response);
1073 } 1070 }
1074 1071
1075 DEFINE_TRACE(FrameFetchContext) { 1072 DEFINE_TRACE(FrameFetchContext) {
1076 visitor->trace(m_document); 1073 visitor->trace(m_document);
1077 visitor->trace(m_documentLoader); 1074 visitor->trace(m_documentLoader);
1078 FetchContext::trace(visitor); 1075 FetchContext::trace(visitor);
1079 } 1076 }
1080 1077
1081 } // namespace blink 1078 } // namespace blink
OLDNEW
« 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