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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1199313006: Disable support for swapped out RenderFrame(Host) on desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2113dc9edc6a936d431e7b477241772597d80a1c..a931d8a432975c211eed2283a2de309853cd4127 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -542,6 +542,17 @@ void RenderFrameImpl::CreateFrame(
const FrameReplicationState& replicated_state,
CompositorDependencies* compositor_deps,
const FrameMsg_NewFrame_WidgetParams& widget_params) {
+ // TODO(nasko): For now, this message is only sent for subframes, as the
+ // top level frame is created when the RenderView is created through the
+ // ViewMsg_New IPC.
+// CHECK_NE(MSG_ROUTING_NONE, parent_routing_id);
+
+ LOG(ERROR) << "RF::CreateFrame:"
+ << " routing_id:" << routing_id
+ << " parent:" << parent_routing_id
+ << " proxy:" << proxy_routing_id
+ << " sibling:" << previous_sibling_routing_id;
+
blink::WebLocalFrame* web_frame;
RenderFrameImpl* render_frame;
if (proxy_routing_id == MSG_ROUTING_NONE) {
@@ -569,6 +580,9 @@ void RenderFrameImpl::CreateFrame(
RenderFrameProxy* proxy =
RenderFrameProxy::FromRoutingID(proxy_routing_id);
CHECK(proxy);
+ LOG(ERROR) << "RF::CreateFrame:"
+ << " parent_routing_id:" << parent_routing_id
+ << " proxy->web_frame->parent():" << proxy->web_frame()->parent();
render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
web_frame =
blink::WebLocalFrame::create(replicated_state.scope, render_frame);
@@ -657,6 +671,9 @@ RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id)
accessibility_mode_(AccessibilityModeOff),
renderer_accessibility_(NULL),
weak_factory_(this) {
+ LOG(ERROR) << "RF[" << this << "]::RF:"
+ << " routing_id:" << routing_id_;
+
std::pair<RoutingIDFrameMap::iterator, bool> result =
g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
CHECK(result.second) << "Inserting a duplicate item.";
@@ -688,18 +705,6 @@ RenderFrameImpl::~RenderFrameImpl() {
#endif
if (!is_subframe_) {
- // When not using --site-per-process, RenderFrameProxy is "owned" by
- // RenderFrameImpl in the case it is the main frame. Ensure it is deleted
- // along with this object.
- if (render_frame_proxy_ &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
- // The following method calls back into this object and clears
- // |render_frame_proxy_|.
- render_frame_proxy_->frameDetached(
- blink::WebRemoteFrameClient::DetachType::Remove);
- }
-
// Ensure the RenderView doesn't point to this object, once it is destroyed.
// TODO(nasko): Add a check that the |main_render_frame_| of |render_view_|
// is |this|, once the object is no longer leaked.
@@ -710,6 +715,7 @@ RenderFrameImpl::~RenderFrameImpl() {
render_view_->UnregisterRenderFrame(this);
g_routing_id_frame_map.Get().erase(routing_id_);
RenderThread::Get()->RemoveRoute(routing_id_);
+ LOG(ERROR) << "RF[" << this << "]::~RF";
}
void RenderFrameImpl::SetWebFrame(blink::WebLocalFrame* web_frame) {
@@ -725,6 +731,10 @@ void RenderFrameImpl::SetWebFrame(blink::WebLocalFrame* web_frame) {
void RenderFrameImpl::Initialize() {
is_subframe_ = !!frame_->parent();
is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame();
+ LOG(ERROR) << "RF[" << this << "]::Init:"
+ << " is_subframe_:" << is_subframe_
+ << " is_local_root_:" << is_local_root_
+ << " rv:" << render_view_.get();
#if defined(ENABLE_PLUGINS)
new PepperBrowserConnection(this);
@@ -1109,11 +1119,24 @@ void RenderFrameImpl::OnSwapOut(
int proxy_routing_id,
bool is_loading,
const FrameReplicationState& replicated_frame_state) {
+ LOG(ERROR) << "RF[" << this << "]::OnSwapOut:"
+ << " proxy:" << proxy_routing_id
+ << " is loading:" << is_loading;
+
TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
RenderFrameProxy* proxy = NULL;
bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSitePerProcess);
bool is_main_frame = !frame_->parent();
+ bool swapped_out_forbidden = true;
+
+ // Chrome no longer supports swapped out RenderFrameImpl.
+ // TODO(nasko): Remove this check and the associated boolean variable once
+ // the removal work has had enough time to verify it works.
+ CHECK(!is_swapped_out_);
+
+ // This codepath should only be hit for subframes when in --site-per-process.
+ CHECK_IMPLIES(!is_main_frame, is_site_per_process);
// Only run unload if we're not swapped out yet, but send the ack either way.
if (!is_swapped_out_) {
@@ -1155,7 +1178,7 @@ void RenderFrameImpl::OnSwapOut(
// TODO(creis): Should we be stopping all frames here and using
// StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this
// frame?
- if (!is_site_per_process)
+ if (!swapped_out_forbidden)
OnStop();
// Transfer settings such as initial drawing parameters to the remote frame,
@@ -1167,7 +1190,7 @@ void RenderFrameImpl::OnSwapOut(
// run a second time, thanks to a check in FrameLoader::stopLoading.
// TODO(creis): Need to add a better way to do this that avoids running the
// beforeunload handler. For now, we just run it a second time silently.
- if (!is_site_per_process)
+ if (!swapped_out_forbidden)
NavigateToSwappedOutURL();
// Let WebKit know that this view is hidden so it can drop resources and
@@ -1191,7 +1214,7 @@ void RenderFrameImpl::OnSwapOut(
// Now that all of the cleanup is complete and the browser side is notified,
// start using the RenderFrameProxy, if one is created.
if (proxy) {
- if (is_site_per_process || !is_main_frame) {
+ if (swapped_out_forbidden) {
frame_->swap(proxy->web_frame());
if (is_loading)
@@ -1207,7 +1230,7 @@ void RenderFrameImpl::OnSwapOut(
// in proxy->web_frame(), the RemoteFrame will not exist for main frames.
// When we do an unconditional swap for all frames, we can remove
// !is_main_frame below.
- if (is_site_per_process && proxy)
+ if (swapped_out_forbidden && proxy)
proxy->SetReplicatedState(replicated_frame_state);
// Safe to exit if no one else is using the process.
@@ -1375,6 +1398,10 @@ void RenderFrameImpl::OnJavaScriptExecuteRequestForTests(
TRACE_EVENT_INSTANT0("test_tracing", "OnJavaScriptExecuteRequestForTests",
TRACE_EVENT_SCOPE_THREAD);
+ LOG(ERROR) << "RF[" << this << "]::OnJSExecForTests: "
+ << " id:" << id
+ << " script:|" << jscript << "|";
+
// A bunch of tests expect to run code in the context of a user gesture, which
// can grant additional privileges (e.g. the ability to create popups).
scoped_ptr<blink::WebScopedUserGesture> gesture(
@@ -1547,6 +1574,7 @@ void RenderFrameImpl::OnSnapshotAccessibilityTree(int callback_id) {
}
void RenderFrameImpl::OnDisownOpener() {
+ LOG(ERROR) << "RF[" << this << "]::OnDisownOpener";
// TODO(creis): We should only see this for main frames for now. To support
// disowning the opener on subframes, we will need to move WebContentsImpl's
// opener_ to FrameTreeNode.
@@ -2122,13 +2150,19 @@ blink::WebFrame* RenderFrameImpl::createChildFrame(
}
void RenderFrameImpl::didDisownOpener(blink::WebLocalFrame* frame) {
+ LOG(ERROR) << "RF[" << this << "]::didDisownOpener";
+
DCHECK(!frame_ || frame_ == frame);
// We only need to notify the browser if the active, top-level frame clears
// its opener. We can ignore cases where a swapped out frame clears its
// opener after hearing about it from the browser, and the browser does not
// (yet) care about subframe openers.
- if (is_swapped_out_ || frame->parent())
+ if (is_swapped_out_ || frame->parent()) {
+ LOG(ERROR) << "RF[" << this << "]::didDisownOpener:"
+ << " swapped_out:" << is_swapped_out_
+ << " parent:" << frame->parent();
return;
+ }
// Notify WebContents and all its swapped out RenderViews.
Send(new FrameHostMsg_DidDisownOpener(routing_id_));
@@ -2486,6 +2520,9 @@ void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame,
is_swapped_out_) <<
"Heard swappedout:// when not swapped out.";
+ LOG(ERROR) << "RF[" << this << "]::didStartProvLoad:"
+ << " url:" << ds->request().url();
+
// Update the request time if WebKit has better knowledge of it.
if (document_state->request_time().is_null() &&
triggering_event_time != 0.0) {
@@ -2590,6 +2627,10 @@ void RenderFrameImpl::didCommitProvisionalLoad(
NavigationStateImpl* navigation_state =
static_cast<NavigationStateImpl*>(document_state->navigation_state());
+ LOG(ERROR) << "RF[" << this << "]::didCommitProvLoad:"
+ << " url:" << GetLoadingUrl()
+ << " proxy_routing_id_:" << proxy_routing_id_;
+
if (proxy_routing_id_ != MSG_ROUTING_NONE) {
RenderFrameProxy* proxy =
RenderFrameProxy::FromRoutingID(proxy_routing_id_);
@@ -2603,8 +2644,11 @@ void RenderFrameImpl::didCommitProvisionalLoad(
if (!is_subframe_) {
CHECK(!render_view_->main_render_frame_);
render_view_->main_render_frame_ = this;
- if (render_view_->is_swapped_out())
+ LOG(ERROR) << "RF[" << this << "]::didCommitProvLoad:"
+ << " main frame, rv swapped_out:" << render_view_->is_swapped_out();
+ if (render_view_->is_swapped_out()) {
render_view_->SetSwappedOut(false);
+ }
}
}
@@ -4450,7 +4494,7 @@ void RenderFrameImpl::NavigateInternal(
// process.
DCHECK(!frame_->parent());
render_view_->history_controller()->GoToEntry(
- entry.Pass(), navigation_params.Pass(), cache_policy);
+ frame_, entry.Pass(), navigation_params.Pass(), cache_policy);
} else {
// In --site-per-process, the browser process sends a single
// WebHistoryItem destined for this frame.

Powered by Google App Engine
This is Rietveld 408576698