Chromium Code Reviews

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: Rebasing... Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 845 matching lines...)
856 RenderFrameProxy* previous_sibling_proxy = 856 RenderFrameProxy* previous_sibling_proxy =
857 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 857 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
858 if (previous_sibling_proxy) 858 if (previous_sibling_proxy)
859 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 859 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
860 860
861 // Create the RenderFrame and WebLocalFrame, linking the two. 861 // Create the RenderFrame and WebLocalFrame, linking the two.
862 render_frame = 862 render_frame =
863 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 863 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
864 web_frame = parent_web_frame->createLocalChild( 864 web_frame = parent_web_frame->createLocalChild(
865 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 865 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
866 WebString::fromUTF8(replicated_state.unique_name),
866 replicated_state.sandbox_flags, render_frame, 867 replicated_state.sandbox_flags, render_frame,
867 previous_sibling_web_frame, frame_owner_properties); 868 previous_sibling_web_frame, frame_owner_properties);
868 869
869 // The RenderFrame is created and inserted into the frame tree in the above 870 // The RenderFrame is created and inserted into the frame tree in the above
870 // call to createLocalChild. 871 // call to createLocalChild.
871 render_frame->in_frame_tree_ = true; 872 render_frame->in_frame_tree_ = true;
872 } else { 873 } else {
873 RenderFrameProxy* proxy = 874 RenderFrameProxy* proxy =
874 RenderFrameProxy::FromRoutingID(proxy_routing_id); 875 RenderFrameProxy::FromRoutingID(proxy_routing_id);
875 // The remote frame could've been detached while the remote-to-local 876 // The remote frame could've been detached while the remote-to-local
(...skipping 1736 matching lines...)
2612 if (!navigation_state->request_committed()) { 2613 if (!navigation_state->request_committed()) {
2613 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_)); 2614 Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
2614 } 2615 }
2615 } 2616 }
2616 } 2617 }
2617 2618
2618 blink::WebFrame* RenderFrameImpl::createChildFrame( 2619 blink::WebFrame* RenderFrameImpl::createChildFrame(
2619 blink::WebLocalFrame* parent, 2620 blink::WebLocalFrame* parent,
2620 blink::WebTreeScopeType scope, 2621 blink::WebTreeScopeType scope,
2621 const blink::WebString& name, 2622 const blink::WebString& name,
2623 const blink::WebString& unique_name,
2622 blink::WebSandboxFlags sandbox_flags, 2624 blink::WebSandboxFlags sandbox_flags,
2623 const blink::WebFrameOwnerProperties& frameOwnerProperties) { 2625 const blink::WebFrameOwnerProperties& frame_owner_properties) {
2624 // Synchronously notify the browser of a child frame creation to get the 2626 // Synchronously notify the browser of a child frame creation to get the
2625 // routing_id for the RenderFrame. 2627 // routing_id for the RenderFrame.
2626 int child_routing_id = MSG_ROUTING_NONE; 2628 int child_routing_id = MSG_ROUTING_NONE;
2627 Send(new FrameHostMsg_CreateChildFrame( 2629 FrameHostMsg_CreateChildFrame_Params params;
2628 routing_id_, scope, base::UTF16ToUTF8(base::StringPiece16(name)), 2630 params.parent_routing_id = routing_id_;
2629 sandbox_flags, frameOwnerProperties, &child_routing_id)); 2631 params.scope = scope;
2632 params.frame_name = base::UTF16ToUTF8(base::StringPiece16(name));
2633 params.frame_unique_name =
2634 base::UTF16ToUTF8(base::StringPiece16(unique_name));
2635 params.sandbox_flags = sandbox_flags;
2636 params.frame_owner_properties = frame_owner_properties;
2637 Send(new FrameHostMsg_CreateChildFrame(params, &child_routing_id));
2630 2638
2631 // Allocation of routing id failed, so we can't create a child frame. This can 2639 // Allocation of routing id failed, so we can't create a child frame. This can
2632 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped 2640 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped
2633 // out state or synchronous IPC message above has failed. 2641 // out state or synchronous IPC message above has failed.
2634 if (child_routing_id == MSG_ROUTING_NONE) { 2642 if (child_routing_id == MSG_ROUTING_NONE) {
2635 NOTREACHED() << "Failed to allocate routing id for child frame."; 2643 NOTREACHED() << "Failed to allocate routing id for child frame.";
2636 return nullptr; 2644 return nullptr;
2637 } 2645 }
2638 2646
2639 // This method is always called by local frames, never remote frames. 2647 // This method is always called by local frames, never remote frames.
(...skipping 92 matching lines...)
2732 } 2740 }
2733 2741
2734 void RenderFrameImpl::willClose(blink::WebFrame* frame) { 2742 void RenderFrameImpl::willClose(blink::WebFrame* frame) {
2735 DCHECK_EQ(frame_, frame); 2743 DCHECK_EQ(frame_, frame);
2736 2744
2737 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose()); 2745 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameWillClose());
2738 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2746 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2739 FrameWillClose(frame)); 2747 FrameWillClose(frame));
2740 } 2748 }
2741 2749
2742 void RenderFrameImpl::didChangeName(const blink::WebString& name) { 2750 void RenderFrameImpl::didChangeName(const blink::WebString& name,
2751 const blink::WebString& unique_name) {
2743 // TODO(alexmos): According to https://crbug.com/169110, sending window.name 2752 // TODO(alexmos): According to https://crbug.com/169110, sending window.name
2744 // updates may have performance implications for benchmarks like SunSpider. 2753 // updates may have performance implications for benchmarks like SunSpider.
2745 // For now, send these updates only for --site-per-process, which needs to 2754 // For now, send these updates only for --site-per-process, which needs to
2746 // replicate frame names to frame proxies, and when 2755 // replicate frame names to frame proxies, and when
2747 // |report_frame_name_changes| is set (used by <webview>). If needed, this 2756 // |report_frame_name_changes| is set (used by <webview>). If needed, this
2748 // can be optimized further by only sending the update if there are any 2757 // can be optimized further by only sending the update if there are any
2749 // remote frames in the frame tree, or delaying and batching up IPCs if 2758 // remote frames in the frame tree, or delaying and batching up IPCs if
2750 // updates are happening too frequently. 2759 // updates are happening too frequently.
2751 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() || 2760 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() ||
2752 render_view_->renderer_preferences_.report_frame_name_changes) { 2761 render_view_->renderer_preferences_.report_frame_name_changes) {
2753 Send(new FrameHostMsg_DidChangeName( 2762 Send(new FrameHostMsg_DidChangeName(
2754 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); 2763 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)),
2764 base::UTF16ToUTF8(base::StringPiece16(unique_name))));
2755 } 2765 }
2756 } 2766 }
2757 2767
2758 void RenderFrameImpl::didEnforceStrictMixedContentChecking() { 2768 void RenderFrameImpl::didEnforceStrictMixedContentChecking() {
2759 Send(new FrameHostMsg_EnforceStrictMixedContentChecking(routing_id_)); 2769 Send(new FrameHostMsg_EnforceStrictMixedContentChecking(routing_id_));
2760 } 2770 }
2761 2771
2762 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, 2772 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame,
2763 blink::WebSandboxFlags flags) { 2773 blink::WebSandboxFlags flags) {
2764 Send(new FrameHostMsg_DidChangeSandboxFlags( 2774 Send(new FrameHostMsg_DidChangeSandboxFlags(
(...skipping 3321 matching lines...)
6086 int match_count, 6096 int match_count,
6087 int ordinal, 6097 int ordinal,
6088 const WebRect& selection_rect, 6098 const WebRect& selection_rect,
6089 bool final_status_update) { 6099 bool final_status_update) {
6090 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6100 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6091 selection_rect, ordinal, 6101 selection_rect, ordinal,
6092 final_status_update)); 6102 final_status_update));
6093 } 6103 }
6094 6104
6095 } // namespace content 6105 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine