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

Unified Diff: content/renderer/render_view_impl.cc

Issue 241223002: Start using RenderFrameProxyHost objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar fixes. Created 6 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
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 10e4427ef5d565c8d7b761dafb239572dfde729f..8dc505cd288efde5c729a2620e52ae4779162f1b 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -667,6 +667,10 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created)
opener_id_ = params->opener_id;
+ LOG(ERROR) << "RV[" << this << "]::Initialize:"
+ << " routing_id:" << routing_id_
+ << ", frame_routing_id:" << params->main_frame_routing_id;
+
// Ensure we start with a valid next_page_id_ from the browser.
DCHECK_GE(next_page_id_, 0);
@@ -677,14 +681,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::CreateFrameProxy(params->proxy_routing_id,
- params->main_frame_routing_id);
- main_render_frame_->set_render_frame_proxy(proxy);
- }
-
webwidget_ = WebView::create(this);
webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_));
@@ -744,7 +740,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::CreateProxyForFrame(
+ params->proxy_routing_id, params->main_frame_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->GetWebFrame());
+ } else {
+ webview()->setMainFrame(main_render_frame_->GetWebFrame());
+ }
main_render_frame_->Initialize();
if (switches::IsTouchDragDropEnabled())
@@ -806,7 +816,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());
}
@@ -1039,7 +1049,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_);
@@ -1957,6 +1967,9 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
WebDataSource* ds) {
bool content_initiated = !pending_navigation_params_.get();
+ LOG(ERROR) << "RV[" << this << "]::didCreateDataSource:"
+ << " frame:" << frame
+ << " url:" << ds->request().url();
// Make sure any previous redirect URLs end up in our new data source.
if (pending_navigation_params_.get()) {
for (std::vector<GURL>::const_iterator i =
@@ -1975,7 +1988,12 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
}
// Carry over the user agent override flag, if it exists.
- if (content_initiated && webview() && webview()->mainFrame() &&
+ LOG(ERROR) << "RV[" << this << "]::didCreateDataSource:"
+ << " frame:" << frame
+ << " mainFrame is local: " << webview()->mainFrame()->isWebLocalFrame();
+ if (content_initiated && webview() &&
+ webview()->mainFrame() &&
+ webview()->mainFrame()->isWebLocalFrame() &&
webview()->mainFrame()->dataSource()) {
DocumentState* old_document_state =
DocumentState::FromDataSource(webview()->mainFrame()->dataSource());
@@ -2011,7 +2029,7 @@ void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
const WebURLRequest& original_request = ds->originalRequest();
const GURL referrer(
original_request.httpHeaderField(WebString::fromUTF8("Referer")));
- if (!referrer.is_empty() &&
+ if (!referrer.is_empty() && old_frame->isWebLocalFrame() &&
DocumentState::FromDataSource(
old_frame->dataSource())->was_prefetcher()) {
for (; old_frame; old_frame = old_frame->traverseNext(false)) {
@@ -2358,7 +2376,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)
@@ -2863,7 +2882,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)) {
@@ -2965,6 +2985,7 @@ void RenderViewImpl::OnSuppressDialogsUntilSwapOut() {
}
void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) {
+ LOG(ERROR) << "RV[" << this << "]::NavigateToSwappedOutURL: " << is_swapped_out_;
// We use loadRequest instead of loadHTMLString because the former commits
// synchronously. Otherwise a new navigation can interrupt the navigation
// to kSwappedOutURL. If that happens to be to the page we had been
@@ -2975,7 +2996,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() {
@@ -3077,6 +3099,10 @@ 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.
@@ -3105,7 +3131,13 @@ void RenderViewImpl::DidFlushPaint() {
}
gfx::Vector2d RenderViewImpl::GetScrollOffset() {
- WebSize scroll_offset = webview()->mainFrame()->scrollOffset();
+ WebFrame* main_frame = webview()->mainFrame();
+ for (WebFrame* frame = main_frame; frame; 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);
}
@@ -3309,7 +3341,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");
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698