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

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: Rebase Created 3 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/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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 } 260 }
261 261
262 const int process_id_; 262 const int process_id_;
263 const int routing_id_; 263 const int routing_id_;
264 264
265 DISALLOW_COPY_AND_ASSIGN(RemoterFactoryImpl); 265 DISALLOW_COPY_AND_ASSIGN(RemoterFactoryImpl);
266 }; 266 };
267 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) 267 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
268 268
269 void CreateResourceCoordinatorFrameInterface(
270 RenderFrameHostImpl* render_frame_host,
271 const service_manager::BindSourceInfo& source_info,
272 resource_coordinator::mojom::CoordinationUnitRequest request) {
273 render_frame_host->GetFrameResourceCoordinator()->service()->Duplicate(
274 std::move(request));
275 }
276
269 template <typename Interface> 277 template <typename Interface>
270 void IgnoreInterfaceRequest(const service_manager::BindSourceInfo& source_info, 278 void IgnoreInterfaceRequest(const service_manager::BindSourceInfo& source_info,
271 mojo::InterfaceRequest<Interface> request) { 279 mojo::InterfaceRequest<Interface> request) {
272 // Intentionally ignore the interface request. 280 // Intentionally ignore the interface request.
273 } 281 }
274 282
275 // The following functions simplify code paths where the UI thread notifies the 283 // The following functions simplify code paths where the UI thread notifies the
276 // ResourceDispatcherHostImpl of information pertaining to loading behavior of 284 // ResourceDispatcherHostImpl of information pertaining to loading behavior of
277 // frame hosts. 285 // frame hosts.
278 void NotifyRouteChangesOnIO( 286 void NotifyRouteChangesOnIO(
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 routing_id_)); 2831 routing_id_));
2824 2832
2825 #if BUILDFLAG(ENABLE_VR) 2833 #if BUILDFLAG(ENABLE_VR)
2826 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>( 2834 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>(
2827 base::Bind(&device::VRServiceImpl::Create)); 2835 base::Bind(&device::VRServiceImpl::Create));
2828 #else 2836 #else
2829 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>( 2837 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>(
2830 base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>)); 2838 base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>));
2831 #endif 2839 #endif
2832 2840
2841 GetInterfaceRegistry()->AddInterface(base::Bind(
2842 &CreateResourceCoordinatorFrameInterface, base::Unretained(this)));
2843
2833 #if BUILDFLAG(ENABLE_WEBRTC) 2844 #if BUILDFLAG(ENABLE_WEBRTC)
2834 // BrowserMainLoop::GetInstance() may be null on unit tests. 2845 // BrowserMainLoop::GetInstance() may be null on unit tests.
2835 if (BrowserMainLoop::GetInstance()) { 2846 if (BrowserMainLoop::GetInstance()) {
2836 // BrowserMainLoop, which owns MediaStreamManager, is alive for the lifetime 2847 // BrowserMainLoop, which owns MediaStreamManager, is alive for the lifetime
2837 // of Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(), 2848 // of Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(),
2838 // which shuts down Mojo). Hence, passing that MediaStreamManager instance 2849 // which shuts down Mojo). Hence, passing that MediaStreamManager instance
2839 // as a raw pointer here is safe. 2850 // as a raw pointer here is safe.
2840 MediaStreamManager* media_stream_manager = 2851 MediaStreamManager* media_stream_manager =
2841 BrowserMainLoop::GetInstance()->media_stream_manager(); 2852 BrowserMainLoop::GetInstance()->media_stream_manager();
2842 GetInterfaceRegistry()->AddInterface( 2853 GetInterfaceRegistry()->AddInterface(
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 3258
3248 void RenderFrameHostImpl::InvalidateMojoConnection() { 3259 void RenderFrameHostImpl::InvalidateMojoConnection() {
3249 interface_registry_.reset(); 3260 interface_registry_.reset();
3250 3261
3251 frame_.reset(); 3262 frame_.reset();
3252 frame_host_interface_broker_binding_.Close(); 3263 frame_host_interface_broker_binding_.Close();
3253 frame_bindings_control_.reset(); 3264 frame_bindings_control_.reset();
3254 3265
3255 // Disconnect with ImageDownloader Mojo service in RenderFrame. 3266 // Disconnect with ImageDownloader Mojo service in RenderFrame.
3256 mojo_image_downloader_.reset(); 3267 mojo_image_downloader_.reset();
3268 frame_resource_coordinator_.reset();
3257 } 3269 }
3258 3270
3259 bool RenderFrameHostImpl::IsFocused() { 3271 bool RenderFrameHostImpl::IsFocused() {
3260 return GetRenderWidgetHost()->is_focused() && 3272 return GetRenderWidgetHost()->is_focused() &&
3261 frame_tree_->GetFocusedFrame() && 3273 frame_tree_->GetFocusedFrame() &&
3262 (frame_tree_->GetFocusedFrame() == frame_tree_node() || 3274 (frame_tree_->GetFocusedFrame() == frame_tree_node() ||
3263 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node())); 3275 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node()));
3264 } 3276 }
3265 3277
3266 bool RenderFrameHostImpl::UpdatePendingWebUI(const GURL& dest_url, 3278 bool RenderFrameHostImpl::UpdatePendingWebUI(const GURL& dest_url,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 web_ui_.reset(); 3365 web_ui_.reset();
3354 } 3366 }
3355 3367
3356 const content::mojom::ImageDownloaderPtr& 3368 const content::mojom::ImageDownloaderPtr&
3357 RenderFrameHostImpl::GetMojoImageDownloader() { 3369 RenderFrameHostImpl::GetMojoImageDownloader() {
3358 if (!mojo_image_downloader_.get() && GetRemoteInterfaces()) 3370 if (!mojo_image_downloader_.get() && GetRemoteInterfaces())
3359 GetRemoteInterfaces()->GetInterface(&mojo_image_downloader_); 3371 GetRemoteInterfaces()->GetInterface(&mojo_image_downloader_);
3360 return mojo_image_downloader_; 3372 return mojo_image_downloader_;
3361 } 3373 }
3362 3374
3375 resource_coordinator::ResourceCoordinatorInterface*
3376 RenderFrameHostImpl::GetFrameResourceCoordinator() {
3377 if (!frame_resource_coordinator_) {
3378 frame_resource_coordinator_ =
3379 base::MakeUnique<resource_coordinator::ResourceCoordinatorInterface>(
3380 ServiceManagerConnection::GetForProcess()->GetConnector(),
3381 resource_coordinator::CoordinationUnitType::kFrame);
3382 }
3383
3384 return frame_resource_coordinator_.get();
3385 }
3386
3363 void RenderFrameHostImpl::ResetLoadingState() { 3387 void RenderFrameHostImpl::ResetLoadingState() {
3364 if (is_loading()) { 3388 if (is_loading()) {
3365 // When pending deletion, just set the loading state to not loading. 3389 // When pending deletion, just set the loading state to not loading.
3366 // Otherwise, OnDidStopLoading will take care of that, as well as sending 3390 // Otherwise, OnDidStopLoading will take care of that, as well as sending
3367 // notification to the FrameTreeNode about the change in loading state. 3391 // notification to the FrameTreeNode about the change in loading state.
3368 if (!is_active()) 3392 if (!is_active())
3369 is_loading_ = false; 3393 is_loading_ = false;
3370 else 3394 else
3371 OnDidStopLoading(); 3395 OnDidStopLoading();
3372 } 3396 }
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
4065 } 4089 }
4066 4090
4067 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4091 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
4068 const std::string& interface_name, 4092 const std::string& interface_name,
4069 mojo::ScopedMessagePipeHandle pipe) { 4093 mojo::ScopedMessagePipeHandle pipe) {
4070 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4094 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
4071 } 4095 }
4072 #endif 4096 #endif
4073 4097
4074 } // namespace content 4098 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698