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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1310743003: Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 5 years, 4 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
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 5be0bf2e4f47483a3154bbdc72d65b5e824ba7de..617d219ac59c40696da975cd672183c19a47f6b7 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -40,7 +40,6 @@
#include "content/common/frame_messages.h"
#include "content/common/frame_replication_state.h"
#include "content/common/input_messages.h"
-#include "content/common/navigation_params.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/swapped_out_messages.h"
@@ -752,9 +751,10 @@ void RenderFrameImpl::SetWebFrame(blink::WebLocalFrame* web_frame) {
frame_ = web_frame;
}
-void RenderFrameImpl::Initialize() {
+void RenderFrameImpl::Initialize(LoFiState lofi_state) {
is_subframe_ = !!frame_->parent();
is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame();
+ lofi_state_ = lofi_state;
#if defined(ENABLE_PLUGINS)
new PepperBrowserConnection(this);
@@ -2178,7 +2178,7 @@ blink::WebFrame* RenderFrameImpl::createChildFrame(
// Add the frame to the frame tree and initialize it.
parent->appendChild(web_frame);
- child_render_frame->Initialize();
+ child_render_frame->Initialize(lofi_state_);
return web_frame;
}
@@ -2257,7 +2257,7 @@ void RenderFrameImpl::willClose(blink::WebFrame* frame) {
FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose());
FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
- FrameWillClose(frame));
+ FrameWillClose(frame, lofi_state_ == LOFI_ON));
}
void RenderFrameImpl::didChangeName(blink::WebLocalFrame* frame,
@@ -2648,6 +2648,10 @@ void RenderFrameImpl::didCommitProvisionalLoad(
DocumentState::FromDataSource(frame->dataSource());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
+ WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(
+ frame->dataSource()->response());
+ if (extra_data)
+ lofi_state_ = extra_data->is_lofi() ? LOFI_ON : LOFI_OFF;
bengr 2015/08/25 00:00:02 What is lofi_state_ if !extra_data? Maybe do: lof
megjablon 2015/08/25 20:29:47 Done.
if (proxy_routing_id_ != MSG_ROUTING_NONE) {
RenderFrameProxy* proxy =
@@ -3302,7 +3306,12 @@ void RenderFrameImpl::willSendRequest(
navigation_state->start_params().transferred_request_request_id);
extra_data->set_service_worker_provider_id(provider_id);
extra_data->set_stream_override(stream_override.Pass());
+ if (request.cachePolicy() == WebURLRequest::ReloadBypassingCache)
+ extra_data->set_lofi_state(LOFI_OFF);
+ else
+ extra_data->set_lofi_state(lofi_state_);
request.setExtraData(extra_data);
+ LOG(WARNING) << "willSendRequest " << request.url() << ": " << lofi_state_;
// TODO(creis): Update prefetching to work with out-of-process iframes.
WebFrame* top_frame = frame->top();
@@ -3388,6 +3397,8 @@ void RenderFrameImpl::didReceiveResponse(
InternalDocumentStateData* internal_data =
InternalDocumentStateData::FromDocumentState(document_state);
internal_data->set_http_status_code(http_status_code);
+
+
bengr 2015/08/25 00:00:02 Remove these blank lines.
}
void RenderFrameImpl::didLoadResourceFromMemoryCache(
@@ -4437,6 +4448,9 @@ void RenderFrameImpl::NavigateInternal(
GetContentClient()->SetActiveURL(common_params.url);
+ LOG(WARNING) << common_params.url << ": " << request_params.lofi_state;
bengr 2015/08/25 00:00:02 Remove the warning.
megjablon 2015/08/25 20:29:47 Done.
+ lofi_state_ = (LoFiState) request_params.lofi_state;
+
// If this frame isn't in the same process as the main frame, it may naively
// assume that this is the first navigation in the iframe, but this may not
// actually be the case. Inform the frame's state machine if this frame has

Powered by Google App Engine
This is Rietveld 408576698