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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2710823003: NOCOMMIT prototype: GRC service plumbing and process priority
Patch Set: Buildfixes Created 3 years, 9 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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 DISALLOW_COPY_AND_ASSIGN(RemoterFactoryImpl); 238 DISALLOW_COPY_AND_ASSIGN(RemoterFactoryImpl);
239 }; 239 };
240 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) 240 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
241 241
242 template <typename Interface> 242 template <typename Interface>
243 void IgnoreInterfaceRequest(mojo::InterfaceRequest<Interface> request) { 243 void IgnoreInterfaceRequest(mojo::InterfaceRequest<Interface> request) {
244 // Intentionally ignore the interface request. 244 // Intentionally ignore the interface request.
245 } 245 }
246 246
247 void CreateResourceCoordinatorFrameInterface(
248 RenderFrameHostImpl* render_frame_host,
249 resource_coordinator::mojom::CoordinationUnitRequest request) {
250 render_frame_host->GetFrameResourceCoordinator()->service()->Duplicate(
251 std::move(request));
252 }
253
247 } // namespace 254 } // namespace
248 255
249 // static 256 // static
250 RenderFrameHost* RenderFrameHost::FromID(int render_process_id, 257 RenderFrameHost* RenderFrameHost::FromID(int render_process_id,
251 int render_frame_id) { 258 int render_frame_id) {
252 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 259 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
253 } 260 }
254 261
255 #if defined(OS_ANDROID) 262 #if defined(OS_ANDROID)
256 // static 263 // static
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 routing_id_)); 2349 routing_id_));
2343 2350
2344 #if defined(ENABLE_WEBVR) 2351 #if defined(ENABLE_WEBVR)
2345 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>( 2352 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>(
2346 base::Bind(&device::VRServiceImpl::Create)); 2353 base::Bind(&device::VRServiceImpl::Create));
2347 #else 2354 #else
2348 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>( 2355 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>(
2349 base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>)); 2356 base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>));
2350 #endif 2357 #endif
2351 2358
2359 GetInterfaceRegistry()->AddInterface(base::Bind(
2360 &CreateResourceCoordinatorFrameInterface, base::Unretained(this)));
2361
2352 if (base::FeatureList::IsEnabled(features::kGenericSensor)) { 2362 if (base::FeatureList::IsEnabled(features::kGenericSensor)) {
2353 GetInterfaceRegistry()->AddInterface( 2363 GetInterfaceRegistry()->AddInterface(
2354 base::Bind(&device::SensorProviderImpl::Create, 2364 base::Bind(&device::SensorProviderImpl::Create,
2355 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)), 2365 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)),
2356 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); 2366 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
2357 } 2367 }
2358 2368
2359 #if BUILDFLAG(ENABLE_WEBRTC) 2369 #if BUILDFLAG(ENABLE_WEBRTC)
2360 // BrowserMainLoop::GetInstance() may be null on unit tests. 2370 // BrowserMainLoop::GetInstance() may be null on unit tests.
2361 if (BrowserMainLoop::GetInstance()) { 2371 if (BrowserMainLoop::GetInstance()) {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 service_manager_connection->RemoveOnConnectHandler(on_connect_handler_id_); 2787 service_manager_connection->RemoveOnConnectHandler(on_connect_handler_id_);
2778 on_connect_handler_id_ = 0; 2788 on_connect_handler_id_ = 0;
2779 } 2789 }
2780 2790
2781 frame_.reset(); 2791 frame_.reset();
2782 frame_host_binding_.Close(); 2792 frame_host_binding_.Close();
2783 frame_bindings_control_.reset(); 2793 frame_bindings_control_.reset();
2784 2794
2785 // Disconnect with ImageDownloader Mojo service in RenderFrame. 2795 // Disconnect with ImageDownloader Mojo service in RenderFrame.
2786 mojo_image_downloader_.reset(); 2796 mojo_image_downloader_.reset();
2797 frame_resource_coordinator_.reset();
2787 } 2798 }
2788 2799
2789 bool RenderFrameHostImpl::IsFocused() { 2800 bool RenderFrameHostImpl::IsFocused() {
2790 return GetRenderWidgetHost()->is_focused() && 2801 return GetRenderWidgetHost()->is_focused() &&
2791 frame_tree_->GetFocusedFrame() && 2802 frame_tree_->GetFocusedFrame() &&
2792 (frame_tree_->GetFocusedFrame() == frame_tree_node() || 2803 (frame_tree_->GetFocusedFrame() == frame_tree_node() ||
2793 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node())); 2804 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node()));
2794 } 2805 }
2795 2806
2796 bool RenderFrameHostImpl::UpdatePendingWebUI(const GURL& dest_url, 2807 bool RenderFrameHostImpl::UpdatePendingWebUI(const GURL& dest_url,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 web_ui_.reset(); 2894 web_ui_.reset();
2884 } 2895 }
2885 2896
2886 const content::mojom::ImageDownloaderPtr& 2897 const content::mojom::ImageDownloaderPtr&
2887 RenderFrameHostImpl::GetMojoImageDownloader() { 2898 RenderFrameHostImpl::GetMojoImageDownloader() {
2888 if (!mojo_image_downloader_.get() && GetRemoteInterfaces()) 2899 if (!mojo_image_downloader_.get() && GetRemoteInterfaces())
2889 GetRemoteInterfaces()->GetInterface(&mojo_image_downloader_); 2900 GetRemoteInterfaces()->GetInterface(&mojo_image_downloader_);
2890 return mojo_image_downloader_; 2901 return mojo_image_downloader_;
2891 } 2902 }
2892 2903
2904 resource_coordinator::ResourceCoordinatorInterface*
2905 RenderFrameHostImpl::GetFrameResourceCoordinator() {
2906 if (!frame_resource_coordinator_) {
2907 frame_resource_coordinator_ =
2908 base::MakeUnique<resource_coordinator::ResourceCoordinatorInterface>(
2909 ServiceManagerConnection::GetForProcess()->GetConnector(),
2910 resource_coordinator::mojom::IDType::FRAME);
2911 }
2912
2913 return frame_resource_coordinator_.get();
2914 }
2915
2893 void RenderFrameHostImpl::ResetLoadingState() { 2916 void RenderFrameHostImpl::ResetLoadingState() {
2894 if (is_loading()) { 2917 if (is_loading()) {
2895 // When pending deletion, just set the loading state to not loading. 2918 // When pending deletion, just set the loading state to not loading.
2896 // Otherwise, OnDidStopLoading will take care of that, as well as sending 2919 // Otherwise, OnDidStopLoading will take care of that, as well as sending
2897 // notification to the FrameTreeNode about the change in loading state. 2920 // notification to the FrameTreeNode about the change in loading state.
2898 if (!is_active()) 2921 if (!is_active())
2899 is_loading_ = false; 2922 is_loading_ = false;
2900 else 2923 else
2901 OnDidStopLoading(); 2924 OnDidStopLoading();
2902 } 2925 }
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 // There is no pending NavigationEntry in these cases, so pass 0 as the 3484 // There is no pending NavigationEntry in these cases, so pass 0 as the
3462 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3485 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3463 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3486 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3464 return NavigationHandleImpl::Create( 3487 return NavigationHandleImpl::Create(
3465 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3488 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3466 params.was_within_same_page, base::TimeTicks::Now(), 3489 params.was_within_same_page, base::TimeTicks::Now(),
3467 entry_id_for_data_nav, false); // started_from_context_menu 3490 entry_id_for_data_nav, false); // started_from_context_menu
3468 } 3491 }
3469 3492
3470 } // namespace content 3493 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698