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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 438393004: Revert of Start using RenderFrameProxyHost objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index b66d2701da33c67c9d0461eee25f180381ed358e..732b914d631de55a19c54de6a3ac371453b881aa 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -78,7 +78,6 @@
#include "content/renderer/notification_provider.h"
#include "content/renderer/npapi/plugin_channel_host.h"
#include "content/renderer/push_messaging_dispatcher.h"
-#include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_process.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h"
@@ -377,34 +376,10 @@
}
// static
-void RenderFrameImpl::CreateFrame(int routing_id, int parent_routing_id) {
- // 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);
-
- RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(parent_routing_id);
-
- // If the browser is sending a valid parent routing id, it should already be
- // created and registered.
- CHECK(proxy);
- blink::WebRemoteFrame* parent_web_frame = proxy->web_frame();
-
- // Create the RenderFrame and WebLocalFrame, linking the two.
- RenderFrameImpl* render_frame =
- RenderFrameImpl::Create(proxy->render_view(), routing_id);
- blink::WebLocalFrame* web_frame =
- parent_web_frame->createLocalChild("", render_frame);
- render_frame->SetWebFrame(web_frame);
- render_frame->Initialize();
-}
-
-// static
RenderFrame* RenderFrame::FromWebFrame(blink::WebFrame* web_frame) {
return RenderFrameImpl::FromWebFrame(web_frame);
}
-// static
RenderFrameImpl* RenderFrameImpl::FromWebFrame(blink::WebFrame* web_frame) {
FrameMap::iterator iter = g_frame_map.Get().find(web_frame);
if (iter != g_frame_map.Get().end())
@@ -702,13 +677,11 @@
delete message;
return false;
}
- if (frame_->parent() == NULL &&
- (is_swapped_out_ || render_view_->is_swapped_out())) {
+ if (is_swapped_out_ || render_view_->is_swapped_out()) {
if (!SwappedOutMessages::CanSendWhileSwappedOut(message)) {
delete message;
return false;
}
-
// In most cases, send IPCs through the proxy when swapped out. In some
// calls the associated RenderViewImpl routing id is used to send
// messages, so don't use the proxy.
@@ -720,13 +693,7 @@
}
bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
- // TODO(kenrb): document() should not be null, but as a transitional step
- // we have RenderFrameProxy 'wrapping' a RenderFrameImpl, passing messages
- // to this method. This happens for a top-level remote frame, where a
- // document-less RenderFrame is replaced by a RenderFrameProxy but kept
- // around and is still able to receive messages.
- if (!frame_->document().isNull())
- GetContentClient()->SetActiveURL(frame_->document().url());
+ GetContentClient()->SetActiveURL(frame_->document().url());
ObserverListBase<RenderFrameObserver>::Iterator it(observers_);
RenderFrameObserver* observer;
@@ -797,8 +764,7 @@
return;
// Swap this renderer back in if necessary.
- if (render_view_->is_swapped_out_ &&
- GetWebFrame() == render_view_->webview()->mainFrame()) {
+ if (render_view_->is_swapped_out_) {
// We marked the view as hidden when swapping the view out, so be sure to
// reset the visibility state before navigating to the new URL.
render_view_->webview()->setVisibilityState(
@@ -991,8 +957,6 @@
void RenderFrameImpl::OnSwapOut(int proxy_routing_id) {
RenderFrameProxy* proxy = NULL;
- bool is_site_per_process =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess);
// Only run unload if we're not swapped out yet, but send the ack either way.
if (!is_swapped_out_ || !render_view_->is_swapped_out_) {
@@ -1015,7 +979,6 @@
frame_->dispatchUnloadEvent();
// Swap out and stop sending any IPC messages that are not ACKs.
- // TODO(nasko): Do we need RenderFrameImpl::is_swapped_out_ anymore?
if (!frame_->parent())
render_view_->SetSwappedOut(true);
is_swapped_out_ = true;
@@ -1040,8 +1003,7 @@
// 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 || frame_->parent() == NULL)
- render_view_->NavigateToSwappedOutURL(frame_);
+ render_view_->NavigateToSwappedOutURL(frame_);
// Let WebKit know that this view is hidden so it can drop resources and
// stop compositing.
@@ -1061,17 +1023,8 @@
// 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 (frame_->parent()) {
- frame_->swap(proxy->web_frame());
- if (is_site_per_process) {
- // TODO(nasko): delete the frame here, since we've replaced it with a
- // proxy.
- }
- } else {
- set_render_frame_proxy(proxy);
- }
- }
+ if (proxy)
+ set_render_frame_proxy(proxy);
}
void RenderFrameImpl::OnContextMenuClosed(
@@ -1876,7 +1829,7 @@
FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad());
Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
- routing_id_, ds->request().url(), is_transition_navigation));
+ routing_id_, ds->request().url(), is_transition_navigation));
}
void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
@@ -2456,21 +2409,13 @@
if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) {
request.setFirstPartyForCookies(request.url());
} else {
- // TODO(nasko): When the top-level frame is remote, there is no document.
- // This is broken and should be fixed to propagate the first party.
- WebFrame* top = frame->top();
- if (top->isWebLocalFrame()) {
- request.setFirstPartyForCookies(
- frame->top()->document().firstPartyForCookies());
- }
+ request.setFirstPartyForCookies(
+ frame->top()->document().firstPartyForCookies());
}
}
WebFrame* top_frame = frame->top();
- // TODO(nasko): Hack around asking about top-frame data source. This means
- // for out-of-process iframes we are treating the current frame as the
- // top-level frame, which is wrong.
- if (!top_frame || top_frame->isWebRemoteFrame())
+ if (!top_frame)
top_frame = frame;
WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
WebDataSource* top_data_source = top_frame->dataSource();
@@ -2564,16 +2509,8 @@
provider_id = provider->provider_id();
}
- WebFrame* parent = frame->parent();
- int parent_routing_id = MSG_ROUTING_NONE;
- if (!parent) {
- parent_routing_id = -1;
- } else if (parent->isWebLocalFrame()) {
- parent_routing_id = FromWebFrame(parent)->GetRoutingID();
- } else {
- parent_routing_id = RenderFrameProxy::FromWebFrame(parent)->routing_id();
- }
-
+ int parent_routing_id = frame->parent() ?
+ FromWebFrame(frame->parent())->GetRoutingID() : -1;
RequestExtraData* extra_data = new RequestExtraData();
extra_data->set_visibility_state(render_view_->visibilityState());
extra_data->set_custom_user_agent(custom_user_agent);
@@ -3287,37 +3224,29 @@
Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame,
info.urlRequest));
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
-
- bool is_subframe = !!info.frame->parent();
-
- if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe) {
- // There's no reason to ignore navigations on subframes, since the swap out
- // logic no longer applies.
- } else {
- if (is_swapped_out_ || render_view_->is_swapped_out()) {
- if (info.urlRequest.url() != GURL(kSwappedOutURL)) {
- // Targeted links may try to navigate a swapped out frame. Allow the
- // browser process to navigate the tab instead. Note that it is also
- // possible for non-targeted navigations (from this view) to arrive
- // here just after we are swapped out. It's ok to send them to the
- // browser, as long as they're for the top level frame.
- // TODO(creis): Ensure this supports targeted form submissions when
- // fixing http://crbug.com/101395.
- if (info.frame->parent() == NULL) {
- OpenURL(info.frame, info.urlRequest.url(), referrer,
- info.defaultPolicy);
- return blink::WebNavigationPolicyIgnore; // Suppress the load here.
- }
-
- // We should otherwise ignore in-process iframe navigations, if they
- // arrive just after we are swapped out.
- return blink::WebNavigationPolicyIgnore;
+
+ if (is_swapped_out_ || render_view_->is_swapped_out()) {
+ if (info.urlRequest.url() != GURL(kSwappedOutURL)) {
+ // Targeted links may try to navigate a swapped out frame. Allow the
+ // browser process to navigate the tab instead. Note that it is also
+ // possible for non-targeted navigations (from this view) to arrive
+ // here just after we are swapped out. It's ok to send them to the
+ // browser, as long as they're for the top level frame.
+ // TODO(creis): Ensure this supports targeted form submissions when
+ // fixing http://crbug.com/101395.
+ if (info.frame->parent() == NULL) {
+ OpenURL(info.frame, info.urlRequest.url(), referrer,
+ info.defaultPolicy);
+ return blink::WebNavigationPolicyIgnore; // Suppress the load here.
}
- // Allow kSwappedOutURL to complete.
- return info.defaultPolicy;
- }
+ // We should otherwise ignore in-process iframe navigations, if they
+ // arrive just after we are swapped out.
+ return blink::WebNavigationPolicyIgnore;
+ }
+
+ // Allow kSwappedOutURL to complete.
+ return info.defaultPolicy;
}
// Webkit is asking whether to navigate to a new URL.
@@ -3335,6 +3264,7 @@
// all top-level navigations to the browser to let it swap processes when
// crossing site boundaries. This is currently expected to break some script
// calls and navigations, such as form submissions.
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
bool force_swap_due_to_flag =
command_line.HasSwitch(switches::kEnableStrictSiteIsolation) ||
command_line.HasSwitch(switches::kSitePerProcess);
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698