OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 void RenderFrameHostManager::Init(SiteInstance* site_instance, | 256 void RenderFrameHostManager::Init(SiteInstance* site_instance, |
257 int32 view_routing_id, | 257 int32 view_routing_id, |
258 int32 frame_routing_id, | 258 int32 frame_routing_id, |
259 int32 widget_routing_id) { | 259 int32 widget_routing_id) { |
260 DCHECK(site_instance); | 260 DCHECK(site_instance); |
261 // TODO(avi): While RenderViewHostImpl is-a RenderWidgetHostImpl, this must | 261 // TODO(avi): While RenderViewHostImpl is-a RenderWidgetHostImpl, this must |
262 // hold true to avoid having two RenderWidgetHosts for the top-level frame. | 262 // hold true to avoid having two RenderWidgetHosts for the top-level frame. |
263 // https://crbug.com/545684 | 263 // https://crbug.com/545684 |
264 DCHECK_IMPLIES(frame_tree_node_->IsMainFrame(), | 264 DCHECK(!frame_tree_node_->IsMainFrame() || |
265 view_routing_id == widget_routing_id); | 265 view_routing_id == widget_routing_id); |
266 int flags = delegate_->IsHidden() ? CREATE_RF_HIDDEN : 0; | 266 int flags = delegate_->IsHidden() ? CREATE_RF_HIDDEN : 0; |
267 SetRenderFrameHost(CreateRenderFrameHost(site_instance, view_routing_id, | 267 SetRenderFrameHost(CreateRenderFrameHost(site_instance, view_routing_id, |
268 frame_routing_id, widget_routing_id, | 268 frame_routing_id, widget_routing_id, |
269 flags)); | 269 flags)); |
270 | 270 |
271 // Notify the delegate of the creation of the current RenderFrameHost. | 271 // Notify the delegate of the creation of the current RenderFrameHost. |
272 // Do this only for subframes, as the main frame case is taken care of by | 272 // Do this only for subframes, as the main frame case is taken care of by |
273 // WebContentsImpl::Init. | 273 // WebContentsImpl::Init. |
274 if (!frame_tree_node_->IsMainFrame()) { | 274 if (!frame_tree_node_->IsMainFrame()) { |
275 delegate_->NotifySwappedFromRenderManager( | 275 delegate_->NotifySwappedFromRenderManager( |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 // Make sure any dynamic changes to this frame's sandbox flags that were made | 664 // Make sure any dynamic changes to this frame's sandbox flags that were made |
665 // prior to navigation take effect. | 665 // prior to navigation take effect. |
666 CommitPendingSandboxFlags(); | 666 CommitPendingSandboxFlags(); |
667 } | 667 } |
668 | 668 |
669 void RenderFrameHostManager::CommitPendingIfNecessary( | 669 void RenderFrameHostManager::CommitPendingIfNecessary( |
670 RenderFrameHostImpl* render_frame_host, | 670 RenderFrameHostImpl* render_frame_host, |
671 bool was_caused_by_user_gesture) { | 671 bool was_caused_by_user_gesture) { |
672 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { | 672 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { |
673 DCHECK_IMPLIES(should_reuse_web_ui_, web_ui_); | 673 DCHECK(!should_reuse_web_ui_ || web_ui_); |
674 | 674 |
675 // We should only hear this from our current renderer. | 675 // We should only hear this from our current renderer. |
676 DCHECK_EQ(render_frame_host_, render_frame_host); | 676 DCHECK_EQ(render_frame_host_, render_frame_host); |
677 | 677 |
678 // Even when there is no pending RVH, there may be a pending Web UI. | 678 // Even when there is no pending RVH, there may be a pending Web UI. |
679 if (pending_web_ui() || speculative_web_ui_) | 679 if (pending_web_ui() || speculative_web_ui_) |
680 CommitPending(); | 680 CommitPending(); |
681 return; | 681 return; |
682 } | 682 } |
683 | 683 |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( | 1772 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( |
1773 SiteInstance* instance, | 1773 SiteInstance* instance, |
1774 WebUIImpl* web_ui, | 1774 WebUIImpl* web_ui, |
1775 int flags, | 1775 int flags, |
1776 int* view_routing_id_ptr) { | 1776 int* view_routing_id_ptr) { |
1777 bool swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); | 1777 bool swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); |
1778 bool swapped_out_forbidden = | 1778 bool swapped_out_forbidden = |
1779 SiteIsolationPolicy::IsSwappedOutStateForbidden(); | 1779 SiteIsolationPolicy::IsSwappedOutStateForbidden(); |
1780 | 1780 |
1781 CHECK(instance); | 1781 CHECK(instance); |
1782 CHECK_IMPLIES(swapped_out_forbidden, !swapped_out); | 1782 CHECK(!swapped_out_forbidden || !swapped_out); |
1783 CHECK_IMPLIES(!SiteIsolationPolicy::AreCrossProcessFramesPossible(), | 1783 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible() || |
1784 frame_tree_node_->IsMainFrame()); | 1784 frame_tree_node_->IsMainFrame()); |
1785 | 1785 |
1786 // Swapped out views should always be hidden. | 1786 // Swapped out views should always be hidden. |
1787 DCHECK_IMPLIES(swapped_out, (flags & CREATE_RF_HIDDEN)); | 1787 DCHECK(!swapped_out || (flags & CREATE_RF_HIDDEN)); |
1788 | 1788 |
1789 scoped_ptr<RenderFrameHostImpl> new_render_frame_host; | 1789 scoped_ptr<RenderFrameHostImpl> new_render_frame_host; |
1790 bool success = true; | 1790 bool success = true; |
1791 if (view_routing_id_ptr) | 1791 if (view_routing_id_ptr) |
1792 *view_routing_id_ptr = MSG_ROUTING_NONE; | 1792 *view_routing_id_ptr = MSG_ROUTING_NONE; |
1793 | 1793 |
1794 // We are creating a pending, speculative or swapped out RFH here. We should | 1794 // We are creating a pending, speculative or swapped out RFH here. We should |
1795 // never create it in the same SiteInstance as our current RFH. | 1795 // never create it in the same SiteInstance as our current RFH. |
1796 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); | 1796 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); |
1797 | 1797 |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2669 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2670 if (!frame_tree_node_->opener()) | 2670 if (!frame_tree_node_->opener()) |
2671 return MSG_ROUTING_NONE; | 2671 return MSG_ROUTING_NONE; |
2672 | 2672 |
2673 return frame_tree_node_->opener() | 2673 return frame_tree_node_->opener() |
2674 ->render_manager() | 2674 ->render_manager() |
2675 ->GetRoutingIdForSiteInstance(instance); | 2675 ->GetRoutingIdForSiteInstance(instance); |
2676 } | 2676 } |
2677 | 2677 |
2678 } // namespace content | 2678 } // namespace content |
OLD | NEW |