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

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

Issue 1830883002: Add blink::ServiceRegistry and expose it from LocalFrame and Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 bool hidden, 827 bool hidden,
828 const blink::WebScreenInfo& screen_info, 828 const blink::WebScreenInfo& screen_info,
829 CompositorDependencies* compositor_deps, 829 CompositorDependencies* compositor_deps,
830 blink::WebFrame* opener) { 830 blink::WebFrame* opener) {
831 // A main frame RenderFrame must have a RenderWidget. 831 // A main frame RenderFrame must have a RenderWidget.
832 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id); 832 DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id);
833 833
834 RenderFrameImpl* render_frame = 834 RenderFrameImpl* render_frame =
835 RenderFrameImpl::Create(render_view, routing_id); 835 RenderFrameImpl::Create(render_view, routing_id);
836 WebLocalFrame* web_frame = WebLocalFrame::create( 836 WebLocalFrame* web_frame = WebLocalFrame::create(
837 blink::WebTreeScopeType::Document, render_frame, opener); 837 blink::WebTreeScopeType::Document, render_frame, opener,
838 &render_frame->blink_service_registry_wrapper_);
838 render_frame->BindToWebFrame(web_frame); 839 render_frame->BindToWebFrame(web_frame);
839 render_view->webview()->setMainFrame(web_frame); 840 render_view->webview()->setMainFrame(web_frame);
840 render_frame->render_widget_ = RenderWidget::CreateForFrame( 841 render_frame->render_widget_ = RenderWidget::CreateForFrame(
841 widget_routing_id, hidden, screen_info, compositor_deps, web_frame); 842 widget_routing_id, hidden, screen_info, compositor_deps, web_frame);
842 // TODO(kenrb): Observing shouldn't be necessary when we sort out 843 // TODO(kenrb): Observing shouldn't be necessary when we sort out
843 // WasShown and WasHidden, separating page-level visibility from 844 // WasShown and WasHidden, separating page-level visibility from
844 // frame-level visibility. 845 // frame-level visibility.
845 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684 846 // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684
846 DCHECK_EQ(render_view->GetWidget(), render_frame->render_widget_) 847 DCHECK_EQ(render_view->GetWidget(), render_frame->render_widget_)
847 << "Main frame is no longer reusing the RenderView as its widget! " 848 << "Main frame is no longer reusing the RenderView as its widget! "
(...skipping 29 matching lines...) Expand all
877 previous_sibling_web_frame = previous_sibling_proxy->web_frame(); 878 previous_sibling_web_frame = previous_sibling_proxy->web_frame();
878 879
879 // Create the RenderFrame and WebLocalFrame, linking the two. 880 // Create the RenderFrame and WebLocalFrame, linking the two.
880 render_frame = 881 render_frame =
881 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); 882 RenderFrameImpl::Create(parent_proxy->render_view(), routing_id);
882 web_frame = parent_web_frame->createLocalChild( 883 web_frame = parent_web_frame->createLocalChild(
883 replicated_state.scope, WebString::fromUTF8(replicated_state.name), 884 replicated_state.scope, WebString::fromUTF8(replicated_state.name),
884 WebString::fromUTF8(replicated_state.unique_name), 885 WebString::fromUTF8(replicated_state.unique_name),
885 replicated_state.sandbox_flags, render_frame, 886 replicated_state.sandbox_flags, render_frame,
886 previous_sibling_web_frame, frame_owner_properties, 887 previous_sibling_web_frame, frame_owner_properties,
887 ResolveOpener(opener_routing_id, nullptr)); 888 ResolveOpener(opener_routing_id, nullptr),
889 &render_frame->blink_service_registry_wrapper_);
888 890
889 // The RenderFrame is created and inserted into the frame tree in the above 891 // The RenderFrame is created and inserted into the frame tree in the above
890 // call to createLocalChild. 892 // call to createLocalChild.
891 render_frame->in_frame_tree_ = true; 893 render_frame->in_frame_tree_ = true;
892 } else { 894 } else {
893 RenderFrameProxy* proxy = 895 RenderFrameProxy* proxy =
894 RenderFrameProxy::FromRoutingID(proxy_routing_id); 896 RenderFrameProxy::FromRoutingID(proxy_routing_id);
895 // The remote frame could've been detached while the remote-to-local 897 // The remote frame could've been detached while the remote-to-local
896 // navigation was being initiated in the browser process. Drop the 898 // navigation was being initiated in the browser process. Drop the
897 // navigation and don't create the frame in that case. See 899 // navigation and don't create the frame in that case. See
898 // https://crbug.com/526304. 900 // https://crbug.com/526304.
899 if (!proxy) 901 if (!proxy)
900 return; 902 return;
901 903
902 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 904 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
903 render_frame->proxy_routing_id_ = proxy_routing_id; 905 render_frame->proxy_routing_id_ = proxy_routing_id;
904 web_frame = blink::WebLocalFrame::createProvisional( 906 web_frame = blink::WebLocalFrame::createProvisional(
905 render_frame, proxy->web_frame(), replicated_state.sandbox_flags, 907 render_frame, proxy->web_frame(), replicated_state.sandbox_flags,
906 frame_owner_properties); 908 frame_owner_properties, &render_frame->blink_service_registry_wrapper_);
907 } 909 }
908 render_frame->BindToWebFrame(web_frame); 910 render_frame->BindToWebFrame(web_frame);
909 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent()); 911 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent());
910 912
911 if (widget_params.routing_id != MSG_ROUTING_NONE) { 913 if (widget_params.routing_id != MSG_ROUTING_NONE) {
912 CHECK(!web_frame->parent() || 914 CHECK(!web_frame->parent() ||
913 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 915 SiteIsolationPolicy::AreCrossProcessFramesPossible());
914 render_frame->render_widget_ = RenderWidget::CreateForFrame( 916 render_frame->render_widget_ = RenderWidget::CreateForFrame(
915 widget_params.routing_id, widget_params.hidden, 917 widget_params.routing_id, widget_params.hidden,
916 render_frame->render_view_->screen_info(), compositor_deps, web_frame); 918 render_frame->render_view_->screen_info(), compositor_deps, web_frame);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 cdm_manager_(NULL), 1012 cdm_manager_(NULL),
1011 #endif 1013 #endif
1012 #if defined(VIDEO_HOLE) 1014 #if defined(VIDEO_HOLE)
1013 contains_media_player_(false), 1015 contains_media_player_(false),
1014 #endif 1016 #endif
1015 devtools_agent_(nullptr), 1017 devtools_agent_(nullptr),
1016 wakelock_dispatcher_(nullptr), 1018 wakelock_dispatcher_(nullptr),
1017 geolocation_dispatcher_(NULL), 1019 geolocation_dispatcher_(NULL),
1018 push_messaging_dispatcher_(NULL), 1020 push_messaging_dispatcher_(NULL),
1019 presentation_dispatcher_(NULL), 1021 presentation_dispatcher_(NULL),
1022 blink_service_registry_wrapper_(&service_registry_),
1020 screen_orientation_dispatcher_(NULL), 1023 screen_orientation_dispatcher_(NULL),
1021 manifest_manager_(NULL), 1024 manifest_manager_(NULL),
1022 accessibility_mode_(AccessibilityModeOff), 1025 accessibility_mode_(AccessibilityModeOff),
1023 renderer_accessibility_(NULL), 1026 renderer_accessibility_(NULL),
1024 media_player_delegate_(NULL), 1027 media_player_delegate_(NULL),
1025 is_using_lofi_(false), 1028 is_using_lofi_(false),
1026 is_pasting_(false), 1029 is_pasting_(false),
1027 weak_factory_(this) { 1030 weak_factory_(this) {
1028 std::pair<RoutingIDFrameMap::iterator, bool> result = 1031 std::pair<RoutingIDFrameMap::iterator, bool> result =
1029 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); 1032 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 2603
2601 // Tracing analysis uses this to find main frames when this value is 2604 // Tracing analysis uses this to find main frames when this value is
2602 // MSG_ROUTING_NONE, and build the frame tree otherwise. 2605 // MSG_ROUTING_NONE, and build the frame tree otherwise.
2603 TRACE_EVENT2("navigation", "RenderFrameImpl::createChildFrame", 2606 TRACE_EVENT2("navigation", "RenderFrameImpl::createChildFrame",
2604 "id", routing_id_, 2607 "id", routing_id_,
2605 "child", child_routing_id); 2608 "child", child_routing_id);
2606 2609
2607 // Create the RenderFrame and WebLocalFrame, linking the two. 2610 // Create the RenderFrame and WebLocalFrame, linking the two.
2608 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create( 2611 RenderFrameImpl* child_render_frame = RenderFrameImpl::Create(
2609 render_view_.get(), child_routing_id); 2612 render_view_.get(), child_routing_id);
2610 blink::WebLocalFrame* web_frame = 2613 blink::WebLocalFrame* web_frame = WebLocalFrame::create(
2611 WebLocalFrame::create(scope, child_render_frame); 2614 scope, child_render_frame, nullptr,
2615 &child_render_frame->blink_service_registry_wrapper_);
2612 child_render_frame->BindToWebFrame(web_frame); 2616 child_render_frame->BindToWebFrame(web_frame);
2613 2617
2614 // Add the frame to the frame tree and initialize it. 2618 // Add the frame to the frame tree and initialize it.
2615 parent->appendChild(web_frame); 2619 parent->appendChild(web_frame);
2616 child_render_frame->in_frame_tree_ = true; 2620 child_render_frame->in_frame_tree_ = true;
2617 child_render_frame->Initialize(); 2621 child_render_frame->Initialize();
2618 2622
2619 return web_frame; 2623 return web_frame;
2620 } 2624 }
2621 2625
(...skipping 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after
6011 int match_count, 6015 int match_count,
6012 int ordinal, 6016 int ordinal,
6013 const WebRect& selection_rect, 6017 const WebRect& selection_rect,
6014 bool final_status_update) { 6018 bool final_status_update) {
6015 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6019 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6016 selection_rect, ordinal, 6020 selection_rect, ordinal,
6017 final_status_update)); 6021 final_status_update));
6018 } 6022 }
6019 6023
6020 } // namespace content 6024 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698