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

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: use LoFiDefault in RequestNavigationParams constructor Created 5 years, 3 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 b42860a347326f73bf1a8c8600251accf5273585..028ca203c9273edd11ad813eb9541dcdbeaf7a68 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"
@@ -642,7 +641,7 @@ void RenderFrameImpl::CreateFrame(
render_frame->render_widget_->RegisterRenderFrame(render_frame);
}
- render_frame->Initialize();
+ render_frame->Initialize(LOFI_DEFAULT);
}
// static
@@ -743,6 +742,7 @@ RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
manifest_manager_(NULL),
accessibility_mode_(AccessibilityModeOff),
renderer_accessibility_(NULL),
+ lofi_state_(LOFI_DEFAULT),
weak_factory_(this) {
std::pair<RoutingIDFrameMap::iterator, bool> result =
g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
@@ -812,9 +812,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);
@@ -2012,6 +2013,10 @@ void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level,
devtools_agent_->AddMessageToConsole(level, message);
}
+bool RenderFrameImpl::LoFiOn() {
+ return lofi_state_ == LOFI_ON;
+}
+
// blink::WebFrameClient implementation ----------------------------------------
blink::WebPlugin* RenderFrameImpl::createPlugin(
@@ -2231,7 +2236,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;
}
@@ -2703,6 +2708,9 @@ void RenderFrameImpl::didCommitProvisionalLoad(
DocumentState::FromDataSource(frame->dataSource());
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
+ WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(
+ frame->dataSource()->response());
+ lofi_state_ = extra_data && extra_data->is_lofi() ? LOFI_ON : LOFI_OFF;
if (proxy_routing_id_ != MSG_ROUTING_NONE) {
RenderFrameProxy* proxy =
@@ -3357,6 +3365,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());
+ // TODO(megjablon): Set the navigation params for single image loads to
+ // LOFI_OFF and remove the dependency on ReloadBypassingCache.
+ if (request.cachePolicy() == WebURLRequest::ReloadBypassingCache)
+ extra_data->set_lofi_state(LOFI_OFF);
+ else
+ extra_data->set_lofi_state(lofi_state_);
request.setExtraData(extra_data);
// TODO(creis): Update prefetching to work with out-of-process iframes.
@@ -4483,6 +4497,8 @@ void RenderFrameImpl::NavigateInternal(
GetContentClient()->SetActiveURL(common_params.url);
+ lofi_state_ = (LoFiState) request_params.lofi_state;
nasko 2015/09/17 23:09:00 Why do we need a cast here?
megjablon 2015/09/18 23:22:11 Done.
+
// 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