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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1635873003: Replicating WebFrame::uniqueName across renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dump-render-tree3
Patch Set: Added FrameTreeHelpers::createLocalChild. Created 4 years, 10 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
OLDNEW
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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 RenderFrameProxy* previous_sibling_proxy = 864 RenderFrameProxy* previous_sibling_proxy =
865 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 865 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
866 if (previous_sibling_proxy) 866 if (previous_sibling_proxy)
867 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 867 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
868 868
869 // Create the RenderFrame and WebLocalFrame, linking the two. 869 // Create the RenderFrame and WebLocalFrame, linking the two.
870 render_frame = 870 render_frame =
871 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 871 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
872 web_frame = parent_web_frame->createLocalChild( 872 web_frame = parent_web_frame->createLocalChild(
873 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 873 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
874 WebString::fromUTF8(replicated_state.unique_name),
874 replicated_state.sandbox_flags, render_frame, 875 replicated_state.sandbox_flags, render_frame,
875 previous_sibling_web_frame, frame_owner_properties); 876 previous_sibling_web_frame, frame_owner_properties);
876 877
877 // The RenderFrame is created and inserted into the frame tree in the above 878 // The RenderFrame is created and inserted into the frame tree in the above
878 // call to createLocalChild. 879 // call to createLocalChild.
879 render_frame->in_frame_tree_ = true; 880 render_frame->in_frame_tree_ = true;
880 } else { 881 } else {
881 RenderFrameProxy* proxy = 882 RenderFrameProxy* proxy =
882 RenderFrameProxy::FromRoutingID(proxy_routing_id); 883 RenderFrameProxy::FromRoutingID(proxy_routing_id);
883 // The remote frame could've been detached while the remote-to-local 884 // The remote frame could've been detached while the remote-to-local
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 if (!navigation_state->request_committed()) { 2634 if (!navigation_state->request_committed()) {
2634 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); 2635 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
2635 } 2636 }
2636 } 2637 }
2637 } 2638 }
2638 2639
2639 blink::WebFrame* RenderFrameImpl::createChildFrame( 2640 blink::WebFrame* RenderFrameImpl::createChildFrame(
2640 blink::WebLocalFrame* parent, 2641 blink::WebLocalFrame* parent,
2641 blink::WebTreeScopeType scope, 2642 blink::WebTreeScopeType scope,
2642 const blink::WebString& name, 2643 const blink::WebString& name,
2644 const blink::WebString& unique_name,
2643 blink::WebSandboxFlags sandbox_flags, 2645 blink::WebSandboxFlags sandbox_flags,
2644 const blink::WebFrameOwnerProperties& frameOwnerProperties) { 2646 const blink::WebFrameOwnerProperties& frame_owner_properties) {
2645 // Synchronously notify the browser of a child frame creation to get the 2647 // Synchronously notify the browser of a child frame creation to get the
2646 // routing_id for the RenderFrame. 2648 // routing_id for the RenderFrame.
2647 int child_routing_id = MSG_ROUTING_NONE; 2649 int child_routing_id = MSG_ROUTING_NONE;
2648 Send(new FrameHostMsg_CreateChildFrame( 2650 FrameHostMsg_CreateChildFrame_Params params;
2649 routing_id_, scope, base::UTF16ToUTF8(base::StringPiece16(name)), 2651 params.parent_routing_id = routing_id_;
2650 sandbox_flags, frameOwnerProperties, &child_routing_id)); 2652 params.scope = scope;
2653 params.frame_name = base::UTF16ToUTF8(base::StringPiece16(name));
2654 params.frame_unique_name =
2655 base::UTF16ToUTF8(base::StringPiece16(unique_name));
2656 params.sandbox_flags = sandbox_flags;
2657 params.frame_owner_properties = frame_owner_properties;
2658 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id));
2651 2659
2652 // Allocation of routing id failed, so we can't create a child frame. This can 2660 // Allocation of routing id failed, so we can't create a child frame. This can
2653 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 2661 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
2654 // out state or synchronous IPC message above has failed. 2662 // out state or synchronous IPC message above has failed.
2655 if (child_routing_id == MSG_ROUTING_NONE) { 2663 if (child_routing_id == MSG_ROUTING_NONE) {
2656 NOTREACHED() << "Failed to allocate routing id for child frame."; 2664 NOTREACHED() << "Failed to allocate routing id for child frame.";
2657 return nullptr; 2665 return nullptr;
2658 } 2666 }
2659 2667
2660 // This method is always called by local frames, never remote frames. 2668 // This method is always called by local frames, never remote frames.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 } 2761 }
2754 2762
2755 void RenderFrameImpl::willClose(blink::WebFrame* frame) { 2763 void RenderFrameImpl::willClose(blink::WebFrame* frame) {
2756 DCHECK_EQ(frame_, frame); 2764 DCHECK_EQ(frame_, frame);
2757 2765
2758 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose()); 2766 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose());
2759 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2767 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2760 FrameWillClose(frame)); 2768 FrameWillClose(frame));
2761 } 2769 }
2762 2770
2763 void RenderFrameImpl::didChangeName(const blink::WebString& name) { 2771 void RenderFrameImpl::didChangeName(const blink::WebString& name,
2772 const blink::WebString& unique_name) {
2764 // TODO(alexmos): According to https://crbug.com/169110, sending window.name 2773 // TODO(alexmos): According to https://crbug.com/169110, sending window.name
2765 // updates may have performance implications for benchmarks like SunSpider. 2774 // updates may have performance implications for benchmarks like SunSpider.
2766 // For now, send these updates only for --site-per-process, which needs to 2775 // For now, send these updates only for --site-per-process, which needs to
2767 // replicate frame names to frame proxies, and when 2776 // replicate frame names to frame proxies, and when
2768 // |report_frame_name_changes| is set (used by <webview>). If needed, this 2777 // |report_frame_name_changes| is set (used by <webview>). If needed, this
2769 // can be optimized further by only sending the update if there are any 2778 // can be optimized further by only sending the update if there are any
2770 // remote frames in the frame tree, or delaying and batching up IPCs if 2779 // remote frames in the frame tree, or delaying and batching up IPCs if
2771 // updates are happening too frequently. 2780 // updates are happening too frequently.
2772 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() || 2781 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() ||
2773 render_view_->renderer_preferences_.report_frame_name_changes) { 2782 render_view_->renderer_preferences_.report_frame_name_changes) {
2774 Send(new FrameHostMsg_DidChangeName( 2783 Send(new FrameHostMsg_DidChangeName(
2775 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); 2784 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)),
2785 base::UTF16ToUTF8(base::StringPiece16(unique_name))));
2776 } 2786 }
2777 } 2787 }
2778 2788
2779 void RenderFrameImpl::didEnforceStrictMixedContentChecking() { 2789 void RenderFrameImpl::didEnforceStrictMixedContentChecking() {
2780 Send(new FrameHostMsg_EnforceStrictMixedContentChecking(routing_id_)); 2790 Send(new FrameHostMsg_EnforceStrictMixedContentChecking(routing_id_));
2781 } 2791 }
2782 2792
2783 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, 2793 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
2784 blink::WebSandboxFlags flags) { 2794 blink::WebSandboxFlags flags) {
2785 Send(new FrameHostMsg_DidChangeSandboxFlags( 2795 Send(new FrameHostMsg_DidChangeSandboxFlags(
(...skipping 3324 matching lines...) Expand 10 before | Expand all | Expand 10 after
6110 int match_count, 6120 int match_count,
6111 int ordinal, 6121 int ordinal,
6112 const WebRect& selection_rect, 6122 const WebRect& selection_rect,
6113 bool final_status_update) { 6123 bool final_status_update) {
6114 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6124 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6115 selection_rect, ordinal, 6125 selection_rect, ordinal,
6116 final_status_update)); 6126 final_status_update));
6117 } 6127 }
6118 6128
6119 } // namespace content 6129 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698