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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10827078: Support frame tree propagation between renderers in the same browsing instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another round of fixes based on Charlie's review. Created 8 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
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 30d1190aa74d390e60804e765823eb62f95404a1..a96d1b14073c3397fd86793b544732b0405409b2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2766,6 +2766,10 @@ void WebContentsImpl::DidChangeLoadProgress(double progress) {
delegate_->LoadProgressChanged(this, progress);
}
+void WebContentsImpl::DidUpdateFrameTree(RenderViewHost* rvh) {
+ render_manager_.DidUpdateFrameTree(rvh);
+}
+
void WebContentsImpl::DocumentAvailableInMainFrame(
RenderViewHost* render_view_host) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
@@ -2860,6 +2864,12 @@ void WebContentsImpl::RouteMessageEvent(
ViewMsg_PostMessage_Params new_params(params);
+ // If the renderer has changed while the post message is being routed,
+ // drop the message, as it will not be delivered to the right target.
+ if (GetRenderViewHost()->GetProcess()->GetID() != params.target_process_id)
+ return;
+ DCHECK(params.target_frame_id != 0);
+
// If there is a source_routing_id, translate it to the routing ID for
// the equivalent swapped out RVH in the target process. If we need
// to create a swapped out RVH for the source tab, we create its opener
@@ -3107,6 +3117,16 @@ int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) {
if (opener_)
opener_route_id = opener_->CreateOpenerRenderViews(instance);
+ // If any of the renderers for this WebContents has the same SiteInstance,
+ // use it.
+ if (render_manager_.current_host()->GetSiteInstance() == instance)
+ return render_manager_.current_host()->GetRoutingID();
+
+ RenderViewHostImpl* rvh = render_manager_.GetSwappedOutRenderViewHost(
+ instance);
+ if (rvh)
+ return rvh->GetRoutingID();
+
// Create a swapped out RenderView in the given SiteInstance if none exists,
// setting its opener to the given route_id. Return the new view's route_id.
return render_manager_.CreateRenderView(instance, opener_route_id, true);

Powered by Google App Engine
This is Rietveld 408576698