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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.h

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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "content/common/url_loader_factory.mojom.h" 35 #include "content/common/url_loader_factory.mojom.h"
36 #include "content/public/browser/render_process_host.h" 36 #include "content/public/browser/render_process_host.h"
37 #include "content/public/common/service_manager_connection.h" 37 #include "content/public/common/service_manager_connection.h"
38 #include "ipc/ipc_channel_proxy.h" 38 #include "ipc/ipc_channel_proxy.h"
39 #include "ipc/ipc_platform_file.h" 39 #include "ipc/ipc_platform_file.h"
40 #include "media/media_features.h" 40 #include "media/media_features.h"
41 #include "mojo/edk/embedder/outgoing_broker_client_invitation.h" 41 #include "mojo/edk/embedder/outgoing_broker_client_invitation.h"
42 #include "mojo/public/cpp/bindings/associated_binding.h" 42 #include "mojo/public/cpp/bindings/associated_binding.h"
43 #include "mojo/public/cpp/bindings/associated_binding_set.h" 43 #include "mojo/public/cpp/bindings/associated_binding_set.h"
44 #include "mojo/public/cpp/bindings/interface_ptr.h" 44 #include "mojo/public/cpp/bindings/interface_ptr.h"
45 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac e.h"
45 #include "services/service_manager/public/cpp/binder_registry.h" 46 #include "services/service_manager/public/cpp/binder_registry.h"
46 #include "services/service_manager/public/interfaces/service.mojom.h" 47 #include "services/service_manager/public/interfaces/service.mojom.h"
47 #include "services/ui/public/interfaces/gpu.mojom.h" 48 #include "services/ui/public/interfaces/gpu.mojom.h"
48 #include "ui/gfx/gpu_memory_buffer.h" 49 #include "ui/gfx/gpu_memory_buffer.h"
49 #include "ui/gl/gpu_switching_observer.h" 50 #include "ui/gl/gpu_switching_observer.h"
50 51
51 #if defined(OS_ANDROID) 52 #if defined(OS_ANDROID)
52 #include "content/browser/android/synchronous_compositor_browser_filter.h" 53 #include "content/browser/android/synchronous_compositor_browser_filter.h"
53 #endif 54 #endif
54 55
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // communicate through the two process objects. 102 // communicate through the two process objects.
102 // 103 //
103 // A RenderProcessHost is also associated with one and only one 104 // A RenderProcessHost is also associated with one and only one
104 // StoragePartition. This allows us to implement strong storage isolation 105 // StoragePartition. This allows us to implement strong storage isolation
105 // because all the IPCs from the RenderViews (renderer) will only ever be able 106 // because all the IPCs from the RenderViews (renderer) will only ever be able
106 // to access the partition they are assigned to. 107 // to access the partition they are assigned to.
107 class CONTENT_EXPORT RenderProcessHostImpl 108 class CONTENT_EXPORT RenderProcessHostImpl
108 : public RenderProcessHost, 109 : public RenderProcessHost,
109 public ChildProcessLauncher::Client, 110 public ChildProcessLauncher::Client,
110 public ui::GpuSwitchingObserver, 111 public ui::GpuSwitchingObserver,
112 public resource_coordinator::mojom::CoordinationPolicyCallback,
111 public NON_EXPORTED_BASE(mojom::RouteProvider), 113 public NON_EXPORTED_BASE(mojom::RouteProvider),
112 public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) { 114 public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) {
113 public: 115 public:
114 RenderProcessHostImpl(BrowserContext* browser_context, 116 RenderProcessHostImpl(BrowserContext* browser_context,
115 StoragePartitionImpl* storage_partition_impl, 117 StoragePartitionImpl* storage_partition_impl,
116 bool is_for_guests_only); 118 bool is_for_guests_only);
117 ~RenderProcessHostImpl() override; 119 ~RenderProcessHostImpl() override;
118 120
119 // RenderProcessHost implementation (public portion). 121 // RenderProcessHost implementation (public portion).
120 bool Init() override; 122 bool Init() override;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 size_t GetWorkerRefCount() const override; 180 size_t GetWorkerRefCount() const override;
179 void IncrementServiceWorkerRefCount() override; 181 void IncrementServiceWorkerRefCount() override;
180 void DecrementServiceWorkerRefCount() override; 182 void DecrementServiceWorkerRefCount() override;
181 void IncrementSharedWorkerRefCount() override; 183 void IncrementSharedWorkerRefCount() override;
182 void DecrementSharedWorkerRefCount() override; 184 void DecrementSharedWorkerRefCount() override;
183 void ForceReleaseWorkerRefCounts() override; 185 void ForceReleaseWorkerRefCounts() override;
184 bool IsWorkerRefCountDisabled() override; 186 bool IsWorkerRefCountDisabled() override;
185 void PurgeAndSuspend() override; 187 void PurgeAndSuspend() override;
186 void Resume() override; 188 void Resume() override;
187 mojom::Renderer* GetRendererInterface() override; 189 mojom::Renderer* GetRendererInterface() override;
190 resource_coordinator::ResourceCoordinatorInterface*
191 GetProcessResourceCoordinator() override;
192
188 void SetIsNeverSuitableForReuse() override; 193 void SetIsNeverSuitableForReuse() override;
189 bool MayReuseHost() override; 194 bool MayReuseHost() override;
190 195
191 mojom::RouteProvider* GetRemoteRouteProvider(); 196 mojom::RouteProvider* GetRemoteRouteProvider();
192 197
193 // IPC::Sender via RenderProcessHost. 198 // IPC::Sender via RenderProcessHost.
194 bool Send(IPC::Message* msg) override; 199 bool Send(IPC::Message* msg) override;
195 200
196 // IPC::Listener via RenderProcessHost. 201 // IPC::Listener via RenderProcessHost.
197 bool OnMessageReceived(const IPC::Message& msg) override; 202 bool OnMessageReceived(const IPC::Message& msg) override;
198 void OnAssociatedInterfaceRequest( 203 void OnAssociatedInterfaceRequest(
199 const std::string& interface_name, 204 const std::string& interface_name,
200 mojo::ScopedInterfaceEndpointHandle handle) override; 205 mojo::ScopedInterfaceEndpointHandle handle) override;
201 void OnChannelConnected(int32_t peer_pid) override; 206 void OnChannelConnected(int32_t peer_pid) override;
202 void OnChannelError() override; 207 void OnChannelError() override;
203 void OnBadMessageReceived(const IPC::Message& message) override; 208 void OnBadMessageReceived(const IPC::Message& message) override;
204 209
205 // ChildProcessLauncher::Client implementation. 210 // ChildProcessLauncher::Client implementation.
206 void OnProcessLaunched() override; 211 void OnProcessLaunched() override;
207 void OnProcessLaunchFailed(int error_code) override; 212 void OnProcessLaunchFailed(int error_code) override;
208 213
214 // resource_coordinator::mojom::CoordinationPolicyCallback implementation.
215 void SetCoordinationPolicy(
216 resource_coordinator::mojom::CoordinationPolicyPtr policy) override;
217
209 scoped_refptr<AudioRendererHost> audio_renderer_host() const; 218 scoped_refptr<AudioRendererHost> audio_renderer_host() const;
210 219
211 // Call this function when it is evident that the child process is actively 220 // Call this function when it is evident that the child process is actively
212 // performing some operation, for example if we just received an IPC message. 221 // performing some operation, for example if we just received an IPC message.
213 void mark_child_process_activity_time() { 222 void mark_child_process_activity_time() {
214 child_process_activity_time_ = base::TimeTicks::Now(); 223 child_process_activity_time_ = base::TimeTicks::Now();
215 } 224 }
216 225
217 // Used to extend the lifetime of the sessions until the render view 226 // Used to extend the lifetime of the sessions until the render view
218 // in the renderer is fully closed. This is static because its also called 227 // in the renderer is fully closed. This is static because its also called
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // Copies applicable command line switches from the given |browser_cmd| line 416 // Copies applicable command line switches from the given |browser_cmd| line
408 // flags to the output |renderer_cmd| line flags. Not all switches will be 417 // flags to the output |renderer_cmd| line flags. Not all switches will be
409 // copied over. 418 // copied over.
410 void PropagateBrowserCommandLineToRenderer( 419 void PropagateBrowserCommandLineToRenderer(
411 const base::CommandLine& browser_cmd, 420 const base::CommandLine& browser_cmd,
412 base::CommandLine* renderer_cmd); 421 base::CommandLine* renderer_cmd);
413 422
414 // Inspects the current object state and sets/removes background priority if 423 // Inspects the current object state and sets/removes background priority if
415 // appropriate. Should be called after any of the involved data members 424 // appropriate. Should be called after any of the involved data members
416 // change. 425 // change.
417 void UpdateProcessPriority(); 426 void SetProcessPriority(bool should_background);
418 427
419 // Creates a PersistentMemoryAllocator and shares it with the renderer 428 // Creates a PersistentMemoryAllocator and shares it with the renderer
420 // process for it to store histograms from that process. The allocator is 429 // process for it to store histograms from that process. The allocator is
421 // available for extraction by a SubprocesMetricsProvider in order to 430 // available for extraction by a SubprocesMetricsProvider in order to
422 // report those histograms to UMA. 431 // report those histograms to UMA.
423 void CreateSharedRendererHistogramAllocator(); 432 void CreateSharedRendererHistogramAllocator();
424 433
425 // Handle termination of our process. 434 // Handle termination of our process.
426 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); 435 void ProcessDied(bool already_dead, RendererClosedDetails* known_details);
427 436
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 682
674 std::unique_ptr<OffscreenCanvasProviderImpl> offscreen_canvas_provider_; 683 std::unique_ptr<OffscreenCanvasProviderImpl> offscreen_canvas_provider_;
675 684
676 mojom::RouteProviderAssociatedPtr remote_route_provider_; 685 mojom::RouteProviderAssociatedPtr remote_route_provider_;
677 mojom::RendererAssociatedPtr renderer_interface_; 686 mojom::RendererAssociatedPtr renderer_interface_;
678 687
679 // Tracks active audio streams within the render process; used to determine if 688 // Tracks active audio streams within the render process; used to determine if
680 // if a process should be backgrounded. 689 // if a process should be backgrounded.
681 int audio_stream_count_ = 0; 690 int audio_stream_count_ = 0;
682 691
692 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface>
693 process_resource_coordinator_;
694 mojo::Binding<resource_coordinator::mojom::CoordinationPolicyCallback>
695 resource_coordinator_binding_;
696
683 // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend 697 // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend
684 // WeakPtrs which are invalidated any time the RPHI is recycled. 698 // WeakPtrs which are invalidated any time the RPHI is recycled.
685 std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>> 699 std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>>
686 instance_weak_factory_; 700 instance_weak_factory_;
687 701
688 FrameSinkProviderImpl frame_sink_provider_; 702 FrameSinkProviderImpl frame_sink_provider_;
689 703
690 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; 704 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_;
691 705
692 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 706 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
693 }; 707 };
694 708
695 } // namespace content 709 } // namespace content
696 710
697 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ 711 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698