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

Unified Diff: content/renderer/render_view_impl.cc

Issue 404613005: Start using RenderFrameProxyHost objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bug fix + ncarter review comments addressed Created 6 years, 5 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_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 23e0b1d8215d38dbc9e9431d9eb3a1f6a2d07520..b47576e5ef9c5ca2543eed1598428e4b23114fcd 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -761,13 +761,6 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get());
main_render_frame_->SetWebFrame(web_frame);
- if (params->proxy_routing_id != MSG_ROUTING_NONE) {
- CHECK(params->swapped_out);
- RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
- main_render_frame_.get(), params->proxy_routing_id);
- main_render_frame_->set_render_frame_proxy(proxy);
- }
-
webwidget_ = WebView::create(this);
webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_));
@@ -827,7 +820,21 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
webview()->settings()->setAllowConnectingInsecureWebSocket(
command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin));
- webview()->setMainFrame(main_render_frame_->GetWebFrame());
+ RenderFrameProxy* proxy = NULL;
+ if (params->proxy_routing_id != MSG_ROUTING_NONE) {
+ CHECK(params->swapped_out);
+ proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
+ main_render_frame_.get(), params->proxy_routing_id);
+ main_render_frame_->set_render_frame_proxy(proxy);
+ }
+
+ // In --site-per-process, just use the WebRemoteFrame as the main frame.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) &&
+ proxy) {
+ webview()->setMainFrame(proxy->web_frame());
+ } else {
+ webview()->setMainFrame(main_render_frame_->GetWebFrame());
+ }
main_render_frame_->Initialize();
if (switches::IsTouchDragDropEnabled())
@@ -881,7 +888,7 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
// If we are initially swapped out, navigate to kSwappedOutURL.
// This ensures we are in a unique origin that others cannot script.
- if (is_swapped_out_)
+ if (is_swapped_out_ && webview()->mainFrame()->isWebLocalFrame())
NavigateToSwappedOutURL(webview()->mainFrame());
}
@@ -1335,7 +1342,7 @@ bool RenderViewImpl::HasIMETextFocus() {
bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
- if (main_frame)
+ if (main_frame && main_frame->isWebLocalFrame())
GetContentClient()->SetActiveURL(main_frame->document().url());
ObserverListBase<RenderViewObserver>::Iterator it(observers_);
@@ -2272,6 +2279,7 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
// Carry over the user agent override flag, if it exists.
if (content_initiated && webview() && webview()->mainFrame() &&
+ webview()->mainFrame()->isWebLocalFrame() &&
webview()->mainFrame()->dataSource()) {
DocumentState* old_document_state =
DocumentState::FromDataSource(webview()->mainFrame()->dataSource());
@@ -2307,9 +2315,9 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
const WebURLRequest& original_request = ds->originalRequest();
const GURL referrer(
original_request.httpHeaderField(WebString::fromUTF8("Referer")));
- if (!referrer.is_empty() &&
- DocumentState::FromDataSource(
- old_frame->dataSource())->was_prefetcher()) {
+ if (!referrer.is_empty() && old_frame->isWebLocalFrame() &&
+ DocumentState::FromDataSource(old_frame->dataSource())
+ ->was_prefetcher()) {
for (; old_frame; old_frame = old_frame->traverseNext(false)) {
WebDataSource* old_frame_ds = old_frame->dataSource();
if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) {
@@ -2650,7 +2658,8 @@ blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() {
return NULL;
WebFrame* main_frame = webview()->mainFrame();
- if (main_frame->document().isPluginDocument())
+ if (main_frame->isWebLocalFrame() &&
+ main_frame->document().isPluginDocument())
return webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
#if defined(ENABLE_PLUGINS)
@@ -3171,7 +3180,8 @@ void RenderViewImpl::OnSetRendererPrefs(
// If the zoom level for this page matches the old zoom default, and this
// is not a plugin, update the zoom level to match the new default.
- if (webview() && !webview()->mainFrame()->document().isPluginDocument() &&
+ if (webview() && webview()->mainFrame()->isWebLocalFrame() &&
+ !webview()->mainFrame()->document().isPluginDocument() &&
!ZoomValuesEqual(old_zoom_level,
renderer_preferences_.default_zoom_level) &&
ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) {
@@ -3283,7 +3293,8 @@ void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) {
CHECK(is_swapped_out_ || rf->is_swapped_out());
GURL swappedOutURL(kSwappedOutURL);
WebURLRequest request(swappedOutURL);
- frame->loadRequest(request);
+ if (frame->isWebLocalFrame())
+ frame->loadRequest(request);
}
void RenderViewImpl::OnClosePage() {
@@ -3386,6 +3397,11 @@ void RenderViewImpl::DidFlushPaint() {
return;
WebFrame* main_frame = webview()->mainFrame();
+ for (WebFrame* frame = main_frame; frame;
+ frame = frame->traverseNext(false)) {
+ if (frame->isWebLocalFrame())
+ main_frame = frame;
+ }
// If we have a provisional frame we are between the start and commit stages
// of loading and we don't want to save stats.
@@ -3414,7 +3430,14 @@ void RenderViewImpl::DidFlushPaint() {
}
gfx::Vector2d RenderViewImpl::GetScrollOffset() {
- WebSize scroll_offset = webview()->mainFrame()->scrollOffset();
+ WebFrame* main_frame = webview()->mainFrame();
+ for (WebFrame* frame = main_frame; frame;
Charlie Reis 2014/07/24 22:36:32 This loop doesn't make sense to me. Wouldn't it e
kenrb 2014/07/25 23:42:06 Changed to find the first localFrame in the tree.
+ frame = frame->traverseNext(false)) {
+ if (frame->isWebLocalFrame())
+ main_frame = frame;
+ }
+
+ WebSize scroll_offset = main_frame->scrollOffset();
return gfx::Vector2d(scroll_offset.width, scroll_offset.height);
}
@@ -3599,7 +3622,7 @@ void RenderViewImpl::OnWasShown(bool needs_repainting) {
GURL RenderViewImpl::GetURLForGraphicsContext3D() {
DCHECK(webview());
- if (webview()->mainFrame())
+ if (webview()->mainFrame()->isWebLocalFrame())
return GURL(webview()->mainFrame()->document().url());
else
return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D");
« content/renderer/render_thread_impl.cc ('K') | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698