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

Unified Diff: content/renderer/render_view_impl.cc

Issue 101203007: Override cache policy when changing a reload to a back/forward navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch Expires to max-age. (And rebase) Created 6 years, 11 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 | « chrome/browser/crash_recovery_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 3f5319ebf74cacb12198be56ca31b4779789f52e..0faf36066e10857dc89878d83f761325abf07c14 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1361,6 +1361,8 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url));
bool is_reload = IsReload(params);
+ WebURLRequest::CachePolicy cache_policy =
+ WebURLRequest::UseProtocolCachePolicy;
// If this is a stale back/forward (due to a recent navigation the browser
// didn't know about), ignore it.
@@ -1378,6 +1380,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
// params.state. Setting is_reload to false will treat this like a back
// navigation to accomplish that.
is_reload = false;
+ cache_policy = WebURLRequest::ReloadIgnoringCacheData;
// We refresh timezone when a view is swapped in since timezone
// can get out of sync when the system timezone is updated while
@@ -1411,10 +1414,9 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
if (is_reload && frame->currentHistoryItem().isNull()) {
// We cannot reload if we do not have any history state. This happens, for
- // example, when recovering from a crash. Our workaround here is a bit of
- // a hack since it means that reload after a crashed tab does not cause an
- // end-to-end cache validation.
+ // example, when recovering from a crash.
is_reload = false;
+ cache_policy = WebURLRequest::ReloadIgnoringCacheData;
}
pending_navigation_params_.reset(new ViewMsg_Navigate_Params(params));
@@ -1442,7 +1444,7 @@ void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
// Ensure we didn't save the swapped out URL in UpdateState, since the
// browser should never be telling us to navigate to swappedout://.
CHECK(item.urlString() != WebString::fromUTF8(kSwappedOutURL));
- frame->loadHistoryItem(item);
+ frame->loadHistoryItem(item, cache_policy);
}
} else if (!params.base_url_for_data_url.is_empty()) {
// A loadData request with a specified base URL.
@@ -3461,6 +3463,11 @@ void RenderViewImpl::PopulateDocumentStateFromPending(
// can result in stale data for pages that are set to expire. We explicitly
// override that by setting the policy here so that as necessary we load
// from the network.
+ //
+ // TODO(davidben): Remove this in favor of passing a cache policy to the
+ // loadHistoryItem call in OnNavigate. That requires not overloading
+ // UseProtocolCachePolicy to mean both "normal load" and "determine cache
+ // policy based on load type, etc".
internal_data->set_cache_policy_override(
WebURLRequest::UseProtocolCachePolicy);
}
« no previous file with comments | « chrome/browser/crash_recovery_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698