Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 // because all the IPCs from the RenderViews (renderer) will only ever be able | 107 // because all the IPCs from the RenderViews (renderer) will only ever be able |
| 108 // to access the partition they are assigned to. | 108 // to access the partition they are assigned to. |
| 109 class CONTENT_EXPORT RenderProcessHostImpl | 109 class CONTENT_EXPORT RenderProcessHostImpl |
| 110 : public RenderProcessHost, | 110 : public RenderProcessHost, |
| 111 public ChildProcessLauncher::Client, | 111 public ChildProcessLauncher::Client, |
| 112 public ui::GpuSwitchingObserver, | 112 public ui::GpuSwitchingObserver, |
| 113 public NON_EXPORTED_BASE(mojom::RouteProvider), | 113 public NON_EXPORTED_BASE(mojom::RouteProvider), |
| 114 public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider), | 114 public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider), |
| 115 public NON_EXPORTED_BASE(mojom::RendererHost) { | 115 public NON_EXPORTED_BASE(mojom::RendererHost) { |
| 116 public: | 116 public: |
| 117 RenderProcessHostImpl(BrowserContext* browser_context, | 117 static RenderProcessHost* CreateRenderProcessHost( |
| 118 StoragePartitionImpl* storage_partition_impl, | 118 BrowserContext* browser_context, |
| 119 bool is_for_guests_only); | 119 StoragePartitionImpl* storage_partition_impl, |
| 120 bool is_for_guests_only); | |
| 121 | |
| 120 ~RenderProcessHostImpl() override; | 122 ~RenderProcessHostImpl() override; |
| 121 | 123 |
| 122 // RenderProcessHost implementation (public portion). | 124 // RenderProcessHost implementation (public portion). |
| 123 bool Init() override; | 125 bool Init() override; |
| 124 void EnableSendQueue() override; | 126 void EnableSendQueue() override; |
| 125 int GetNextRoutingID() override; | 127 int GetNextRoutingID() override; |
| 126 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; | 128 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; |
| 127 void RemoveRoute(int32_t routing_id) override; | 129 void RemoveRoute(int32_t routing_id) override; |
| 128 void AddObserver(RenderProcessHostObserver* observer) override; | 130 void AddObserver(RenderProcessHostObserver* observer) override; |
| 129 void RemoveObserver(RenderProcessHostObserver* observer) override; | 131 void RemoveObserver(RenderProcessHostObserver* observer) override; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 // RenderProcessHosts. | 330 // RenderProcessHosts. |
| 329 static void AddExpectedNavigationToSite( | 331 static void AddExpectedNavigationToSite( |
| 330 BrowserContext* browser_context, | 332 BrowserContext* browser_context, |
| 331 RenderProcessHost* render_process_host, | 333 RenderProcessHost* render_process_host, |
| 332 const GURL& site_url); | 334 const GURL& site_url); |
| 333 static void RemoveExpectedNavigationToSite( | 335 static void RemoveExpectedNavigationToSite( |
| 334 BrowserContext* browser_context, | 336 BrowserContext* browser_context, |
| 335 RenderProcessHost* render_process_host, | 337 RenderProcessHost* render_process_host, |
| 336 const GURL& site_url); | 338 const GURL& site_url); |
| 337 | 339 |
| 340 // This should be called when the storage partition associated with the | |
| 341 // RenderProcessHost is shutdown. | |
|
Charlie Reis
2017/06/26 21:22:50
nit: This is a static method, so "associated with
mattcary
2017/06/28 13:14:38
Done.
| |
| 342 static void OnStoragePartitionShutdown(StoragePartition* partition); | |
| 343 | |
| 344 // Return the spare RenderProcessHost, if it exists. There is at most one | |
| 345 // globally-used spare RenderProcessHost at any time. | |
| 346 static RenderProcessHost* GetSpareRenderProcessHostForTesting(); | |
| 347 | |
| 338 protected: | 348 protected: |
| 339 // A proxy for our IPC::Channel that lives on the IO thread. | 349 // A proxy for our IPC::Channel that lives on the IO thread. |
| 340 std::unique_ptr<IPC::ChannelProxy> channel_; | 350 std::unique_ptr<IPC::ChannelProxy> channel_; |
| 341 | 351 |
| 342 // True if fast shutdown has been performed on this RPH. | 352 // True if fast shutdown has been performed on this RPH. |
| 343 bool fast_shutdown_started_; | 353 bool fast_shutdown_started_; |
| 344 | 354 |
| 345 // True if we've posted a DeleteTask and will be deleted soon. | 355 // True if we've posted a DeleteTask and will be deleted soon. |
| 346 bool deleting_soon_; | 356 bool deleting_soon_; |
| 347 | 357 |
| 348 #ifndef NDEBUG | 358 #ifndef NDEBUG |
| 349 // True if this object has deleted itself. | 359 // True if this object has deleted itself. |
| 350 bool is_self_deleted_; | 360 bool is_self_deleted_; |
| 351 #endif | 361 #endif |
| 352 | 362 |
| 353 // The count of currently swapped out but pending RenderViews. We have | 363 // The count of currently swapped out but pending RenderViews. We have |
| 354 // started to swap these in, so the renderer process should not exit if | 364 // started to swap these in, so the renderer process should not exit if |
| 355 // this count is non-zero. | 365 // this count is non-zero. |
| 356 int32_t pending_views_; | 366 int32_t pending_views_; |
| 357 | 367 |
| 358 private: | 368 private: |
| 359 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; | 369 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; |
| 360 friend class VisitRelayingRenderProcessHost; | 370 friend class VisitRelayingRenderProcessHost; |
| 361 class ConnectionFilterController; | 371 class ConnectionFilterController; |
| 362 class ConnectionFilterImpl; | 372 class ConnectionFilterImpl; |
| 363 | 373 |
| 374 // Use CreateRenderProcessHost() instead of calling this constructor | |
| 375 // directly. | |
| 376 RenderProcessHostImpl(BrowserContext* browser_context, | |
| 377 StoragePartitionImpl* storage_partition_impl, | |
| 378 bool is_for_guests_only); | |
| 379 | |
| 364 // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected | 380 // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected |
| 365 // to the next child process launched for this host, if any. | 381 // to the next child process launched for this host, if any. |
| 366 void InitializeChannelProxy(); | 382 void InitializeChannelProxy(); |
| 367 | 383 |
| 368 // Resets |channel_|, removing it from the attachment broker if necessary. | 384 // Resets |channel_|, removing it from the attachment broker if necessary. |
| 369 // Always call this in lieu of directly resetting |channel_|. | 385 // Always call this in lieu of directly resetting |channel_|. |
| 370 void ResetChannelProxy(); | 386 void ResetChannelProxy(); |
| 371 | 387 |
| 372 // Creates and adds the IO thread message filters. | 388 // Creates and adds the IO thread message filters. |
| 373 void CreateMessageFilters(); | 389 void CreateMessageFilters(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 706 FrameSinkProviderImpl frame_sink_provider_; | 722 FrameSinkProviderImpl frame_sink_provider_; |
| 707 | 723 |
| 708 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 724 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
| 709 | 725 |
| 710 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 726 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
| 711 }; | 727 }; |
| 712 | 728 |
| 713 } // namespace content | 729 } // namespace content |
| 714 | 730 |
| 715 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 731 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |