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

Side by Side 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: Moved away from hardcoded strings and no static cast needed for tests. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 2739
2740 // Update the URL display. 2740 // Update the URL display.
2741 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); 2741 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
2742 } 2742 }
2743 2743
2744 void WebContentsImpl::DidChangeLoadProgress(double progress) { 2744 void WebContentsImpl::DidChangeLoadProgress(double progress) {
2745 if (delegate_) 2745 if (delegate_)
2746 delegate_->LoadProgressChanged(this, progress); 2746 delegate_->LoadProgressChanged(this, progress);
2747 } 2747 }
2748 2748
2749 void WebContentsImpl::DidUpdateFrameTree(RenderViewHost* rvh) {
2750 render_manager_.DidUpdateFrameTree(rvh);
2751 }
2752
2749 void WebContentsImpl::DocumentAvailableInMainFrame( 2753 void WebContentsImpl::DocumentAvailableInMainFrame(
2750 RenderViewHost* render_view_host) { 2754 RenderViewHost* render_view_host) {
2751 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2755 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2752 DocumentAvailableInMainFrame()); 2756 DocumentAvailableInMainFrame());
2753 } 2757 }
2754 2758
2755 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame( 2759 void WebContentsImpl::DocumentOnLoadCompletedInMainFrame(
2756 RenderViewHost* render_view_host, 2760 RenderViewHost* render_view_host,
2757 int32 page_id) { 2761 int32 page_id) {
2758 content::NotificationService::current()->Notify( 2762 content::NotificationService::current()->Notify(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 2836
2833 void WebContentsImpl::RouteMessageEvent( 2837 void WebContentsImpl::RouteMessageEvent(
2834 RenderViewHost* rvh, 2838 RenderViewHost* rvh,
2835 const ViewMsg_PostMessage_Params& params) { 2839 const ViewMsg_PostMessage_Params& params) {
2836 // Only deliver the message to the active RenderViewHost if the request 2840 // Only deliver the message to the active RenderViewHost if the request
2837 // came from a RenderViewHost in the same BrowsingInstance. 2841 // came from a RenderViewHost in the same BrowsingInstance.
2838 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) 2842 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()))
2839 return; 2843 return;
2840 2844
2841 ViewMsg_PostMessage_Params new_params(params); 2845 ViewMsg_PostMessage_Params new_params(params);
2846 RenderViewHost* active_rvh = GetRenderViewHost();
2847
2848 if (active_rvh->GetProcess()->GetID() != params.target_process_id) {
2849 LOG(ERROR) << "Possibly race condition trying to deliver to " <<
2850 params.target_process_id << ", which doesn't match " <<
2851 active_rvh->GetProcess()->GetID();
awong 2012/08/21 19:27:28 This log isn't going to be seen by anyone. If we n
Charlie Reis 2012/08/22 22:08:34 Yeah, I had a similar comment in patch set 10.
2852 return;
2853 }
2854 DCHECK(params.target_frame_id != 0);
awong 2012/08/21 19:27:28 If it is 0, what happens below?
nasko 2012/08/21 22:24:13 0 is an invalid frame ID, so the call won't succee
2842 2855
2843 // If there is a source_routing_id, translate it to the routing ID for 2856 // If there is a source_routing_id, translate it to the routing ID for
2844 // the equivalent swapped out RVH in the target process. If we need 2857 // the equivalent swapped out RVH in the target process. If we need
2845 // to create a swapped out RVH for the source tab, we create its opener 2858 // to create a swapped out RVH for the source tab, we create its opener
2846 // chain as well, since those will also be accessible to the target page. 2859 // chain as well, since those will also be accessible to the target page.
2847 if (new_params.source_routing_id != MSG_ROUTING_NONE) { 2860 if (new_params.source_routing_id != MSG_ROUTING_NONE) {
2848 // Try to look up the WebContents for the source page. 2861 // Try to look up the WebContents for the source page.
2849 WebContentsImpl* source_contents = NULL; 2862 WebContentsImpl* source_contents = NULL;
2850 RenderViewHostImpl* source_rvh = RenderViewHostImpl::FromID( 2863 RenderViewHostImpl* source_rvh = RenderViewHostImpl::FromID(
2851 rvh->GetProcess()->GetID(), params.source_routing_id); 2864 rvh->GetProcess()->GetID(), params.source_routing_id);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 old_browser_plugin_host()->embedder_render_process_host(); 3224 old_browser_plugin_host()->embedder_render_process_host();
3212 *embedder_container_id = old_browser_plugin_host()->instance_id(); 3225 *embedder_container_id = old_browser_plugin_host()->instance_id();
3213 int embedder_process_id = 3226 int embedder_process_id =
3214 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; 3227 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
3215 if (embedder_process_id != -1) { 3228 if (embedder_process_id != -1) {
3216 *embedder_channel_name = 3229 *embedder_channel_name =
3217 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), 3230 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(),
3218 embedder_process_id); 3231 embedder_process_id);
3219 } 3232 }
3220 } 3233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698