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

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

Issue 1864403003: Trace LayoutObject src attributes and parent frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 int32_t widget_routing_id, 895 int32_t widget_routing_id,
896 bool hidden, 896 bool hidden,
897 const blink::WebScreenInfo& screen_info, 897 const blink::WebScreenInfo& screen_info,
898 CompositorDependencies* compositor_deps, 898 CompositorDependencies* compositor_deps,
899 blink::WebFrame* opener) { 899 blink::WebFrame* opener) {
900 // A main frame RenderFrame must have a RenderWidget. 900 // A main frame RenderFrame must have a RenderWidget.
901 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id); 901 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id);
902 902
903 RenderFrameImpl* render_frame = 903 RenderFrameImpl* render_frame =
904 RenderFrameImpl::Create(render_view, routing_id); 904 RenderFrameImpl::Create(render_view, routing_id);
905 render_frame->InitializeBlameContext(nullptr);
906 WebLocalFrame* web_frame = WebLocalFrame::create( 905 WebLocalFrame* web_frame = WebLocalFrame::create(
907 blink::WebTreeScopeType::Document, render_frame, opener); 906 blink::WebTreeScopeType::Document, render_frame, opener);
908 render_frame->BindToWebFrame(web_frame); 907 render_frame->BindToWebFrame(web_frame);
908 render_frame->InitializeBlameContext(nullptr);
909 render_view->webview()->setMainFrame(web_frame); 909 render_view->webview()->setMainFrame(web_frame);
910 render_frame->render_widget_ = RenderWidget::CreateForFrame( 910 render_frame->render_widget_ = RenderWidget::CreateForFrame(
911 widget_routing_id, hidden, screen_info, compositor_deps, web_frame); 911 widget_routing_id, hidden, screen_info, compositor_deps, web_frame);
912 // TODO(kenrb): Observing shouldn't be necessary when we sort out 912 // TODO(kenrb): Observing shouldn't be necessary when we sort out
913 // WasShown and WasHidden, separating page-level visibility from 913 // WasShown and WasHidden, separating page-level visibility from
914 // frame-level visibility. 914 // frame-level visibility.
915 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684 915 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684
916 DCHECK_EQ(render_view->GetWidget(), render_frame->render_widget_) 916 DCHECK_EQ(render_view->GetWidget(), render_frame->render_widget_)
917 << "Main frame is no longer reusing the RenderView as its widget! " 917 << "Main frame is no longer reusing the RenderView as its widget! "
918 << "Does the RenderFrame need to register itself with the RenderWidget?"; 918 << "Does the RenderFrame need to register itself with the RenderWidget?";
919 return render_frame; 919 return render_frame;
920 } 920 }
921 921
922 // static 922 // static
923 void RenderFrameImpl::CreateFrame( 923 void RenderFrameImpl::CreateFrame(
924 int routing_id, 924 int routing_id,
925 int proxy_routing_id, 925 int proxy_routing_id,
926 int opener_routing_id, 926 int opener_routing_id,
927 int parent_routing_id, 927 int parent_routing_id,
928 int previous_sibling_routing_id, 928 int previous_sibling_routing_id,
929 const FrameReplicationState& replicated_state, 929 const FrameReplicationState& replicated_state,
930 CompositorDependencies* compositor_deps, 930 CompositorDependencies* compositor_deps,
931 const FrameMsg_NewFrame_WidgetParams& widget_params, 931 const FrameMsg_NewFrame_WidgetParams& widget_params,
932 const blink::WebFrameOwnerProperties& frame_owner_properties) { 932 const blink::WebFrameOwnerProperties& frame_owner_properties) {
933 blink::WebLocalFrame* web_frame; 933 blink::WebLocalFrame* web_frame;
934 RenderFrameImpl* render_frame; 934 RenderFrameImpl* render_frame;
935 RenderFrameImpl* parent_frame = nullptr;
935 if (proxy_routing_id == MSG_ROUTING_NONE) { 936 if (proxy_routing_id == MSG_ROUTING_NONE) {
936 RenderFrameProxy* parent_proxy = 937 RenderFrameProxy* parent_proxy =
937 RenderFrameProxy::FromRoutingID(parent_routing_id); 938 RenderFrameProxy::FromRoutingID(parent_routing_id);
938 // If the browser is sending a valid parent routing id, it should already 939 // If the browser is sending a valid parent routing id, it should already
939 // be created and registered. 940 // be created and registered.
940 CHECK(parent_proxy); 941 CHECK(parent_proxy);
941 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame(); 942 blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame();
942 943
943 blink::WebFrame* previous_sibling_web_frame = nullptr; 944 blink::WebFrame* previous_sibling_web_frame = nullptr;
944 RenderFrameProxy* previous_sibling_proxy = 945 RenderFrameProxy* previous_sibling_proxy =
945 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); 946 RenderFrameProxy::FromRoutingID(previous_sibling_routing_id);
946 if (previous_sibling_proxy) 947 if (previous_sibling_proxy)
947 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 948 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
948 949
949 // Create the RenderFrame and WebLocalFrame, linking the two. 950 // Create the RenderFrame and WebLocalFrame, linking the two.
950 render_frame = 951 render_frame =
951 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 952 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
952 render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id)); 953 parent_frame = FromRoutingID(parent_routing_id);
953 web_frame = parent_web_frame->createLocalChild( 954 web_frame = parent_web_frame->createLocalChild(
954 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 955 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
955 WebString::fromUTF8(replicated_state.unique_name), 956 WebString::fromUTF8(replicated_state.unique_name),
956 replicated_state.sandbox_flags, render_frame, 957 replicated_state.sandbox_flags, render_frame,
957 previous_sibling_web_frame, frame_owner_properties, 958 previous_sibling_web_frame, frame_owner_properties,
958 ResolveOpener(opener_routing_id, nullptr)); 959 ResolveOpener(opener_routing_id, nullptr));
959 960
960 // The RenderFrame is created and inserted into the frame tree in the above 961 // The RenderFrame is created and inserted into the frame tree in the above
961 // call to createLocalChild. 962 // call to createLocalChild.
962 render_frame->in_frame_tree_ = true; 963 render_frame->in_frame_tree_ = true;
963 } else { 964 } else {
964 RenderFrameProxy* proxy = 965 RenderFrameProxy* proxy =
965 RenderFrameProxy::FromRoutingID(proxy_routing_id); 966 RenderFrameProxy::FromRoutingID(proxy_routing_id);
966 // The remote frame could've been detached while the remote-to-local 967 // The remote frame could've been detached while the remote-to-local
967 // navigation was being initiated in the browser process. Drop the 968 // navigation was being initiated in the browser process. Drop the
968 // navigation and don't create the frame in that case. See 969 // navigation and don't create the frame in that case. See
969 // https://crbug.com/526304. 970 // https://crbug.com/526304.
970 if (!proxy) 971 if (!proxy)
971 return; 972 return;
972 973
973 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 974 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
974 render_frame->InitializeBlameContext(nullptr);
975 render_frame->proxy_routing_id_ = proxy_routing_id; 975 render_frame->proxy_routing_id_ = proxy_routing_id;
976 web_frame = blink::WebLocalFrame::createProvisional( 976 web_frame = blink::WebLocalFrame::createProvisional(
977 render_frame, proxy->web_frame(), replicated_state.sandbox_flags, 977 render_frame, proxy->web_frame(), replicated_state.sandbox_flags,
978 frame_owner_properties); 978 frame_owner_properties);
979 } 979 }
980 render_frame->BindToWebFrame(web_frame); 980 render_frame->BindToWebFrame(web_frame);
981 render_frame->InitializeBlameContext(parent_frame);
981 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent()); 982 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent());
982 983
983 if (widget_params.routing_id != MSG_ROUTING_NONE) { 984 if (widget_params.routing_id != MSG_ROUTING_NONE) {
984 CHECK(!web_frame->parent() || 985 CHECK(!web_frame->parent() ||
985 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 986 SiteIsolationPolicy::AreCrossProcessFramesPossible());
986 render_frame->render_widget_ = RenderWidget::CreateForFrame( 987 render_frame->render_widget_ = RenderWidget::CreateForFrame(
987 widget_params.routing_id, widget_params.hidden, 988 widget_params.routing_id, widget_params.hidden,
988 render_frame->render_view_->screen_info(), compositor_deps, web_frame); 989 render_frame->render_view_->screen_info(), compositor_deps, web_frame);
989 // TODO(avi): The main frame re-uses the RenderViewImpl as its widget, so 990 // TODO(avi): The main frame re-uses the RenderViewImpl as its widget, so
990 // avoid double-registering the frame as an observer. 991 // avoid double-registering the frame as an observer.
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 2725
2725 // Tracing analysis uses this to find main frames when this value is 2726 // Tracing analysis uses this to find main frames when this value is
2726 // MSG_ROUTING_NONE, and build the frame tree otherwise. 2727 // MSG_ROUTING_NONE, and build the frame tree otherwise.
2727 TRACE_EVENT2("navigation", "RenderFrameImpl::createChildFrame", 2728 TRACE_EVENT2("navigation", "RenderFrameImpl::createChildFrame",
2728 "id", routing_id_, 2729 "id", routing_id_,
2729 "child", child_routing_id); 2730 "child", child_routing_id);
2730 2731
2731 // Create the RenderFrame and WebLocalFrame, linking the two. 2732 // Create the RenderFrame and WebLocalFrame, linking the two.
2732 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( 2733 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create(
2733 render_view_.get(), child_routing_id); 2734 render_view_.get(), child_routing_id);
2734 child_render_frame->InitializeBlameContext(this);
2735 blink::WebLocalFrame* web_frame = 2735 blink::WebLocalFrame* web_frame =
2736 WebLocalFrame::create(scope, child_render_frame); 2736 WebLocalFrame::create(scope, child_render_frame);
2737 child_render_frame->BindToWebFrame(web_frame); 2737 child_render_frame->BindToWebFrame(web_frame);
2738 child_render_frame->InitializeBlameContext(this);
2738 2739
2739 // Add the frame to the frame tree and initialize it. 2740 // Add the frame to the frame tree and initialize it.
2740 parent->appendChild(web_frame); 2741 parent->appendChild(web_frame);
2741 child_render_frame->in_frame_tree_ = true; 2742 child_render_frame->in_frame_tree_ = true;
2742 child_render_frame->Initialize(); 2743 child_render_frame->Initialize();
2743 2744
2744 return web_frame; 2745 return web_frame;
2745 } 2746 }
2746 2747
2747 void RenderFrameImpl::didChangeOpener(blink::WebFrame* opener) { 2748 void RenderFrameImpl::didChangeOpener(blink::WebFrame* opener) {
(...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after
6191 // event target. Potentially a Pepper plugin will receive the event. 6192 // event target. Potentially a Pepper plugin will receive the event.
6192 // In order to tell whether a plugin gets the last mouse event and which it 6193 // In order to tell whether a plugin gets the last mouse event and which it
6193 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6194 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6194 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6195 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6195 // |pepper_last_mouse_event_target_|. 6196 // |pepper_last_mouse_event_target_|.
6196 pepper_last_mouse_event_target_ = nullptr; 6197 pepper_last_mouse_event_target_ = nullptr;
6197 #endif 6198 #endif
6198 } 6199 }
6199 6200
6200 } // namespace content 6201 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698