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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 class IndexedDBDispatcherHost; | 64 class IndexedDBDispatcherHost; |
| 65 class InProcessChildThreadParams; | 65 class InProcessChildThreadParams; |
| 66 class NotificationMessageFilter; | 66 class NotificationMessageFilter; |
| 67 #if BUILDFLAG(ENABLE_WEBRTC) | 67 #if BUILDFLAG(ENABLE_WEBRTC) |
| 68 class P2PSocketDispatcherHost; | 68 class P2PSocketDispatcherHost; |
| 69 #endif | 69 #endif |
| 70 class PermissionServiceContext; | 70 class PermissionServiceContext; |
| 71 class PeerConnectionTrackerHost; | 71 class PeerConnectionTrackerHost; |
| 72 class PushMessagingManager; | 72 class PushMessagingManager; |
| 73 class RenderFrameMessageFilter; | 73 class RenderFrameMessageFilter; |
| 74 class RenderProcessHostFactory; | |
| 74 class RenderWidgetHelper; | 75 class RenderWidgetHelper; |
| 75 class RenderWidgetHost; | 76 class RenderWidgetHost; |
| 76 class RenderWidgetHostImpl; | 77 class RenderWidgetHostImpl; |
| 77 class ResourceMessageFilter; | 78 class ResourceMessageFilter; |
| 79 class SiteInstanceImpl; | |
| 78 class StoragePartition; | 80 class StoragePartition; |
| 79 class StoragePartitionImpl; | 81 class StoragePartitionImpl; |
| 80 | 82 |
| 81 namespace mojom { | 83 namespace mojom { |
| 82 class StoragePartitionService; | 84 class StoragePartitionService; |
| 83 } // namespace mojom | 85 } // namespace mojom |
| 84 | 86 |
| 85 typedef base::Thread* (*RendererMainThreadFactoryFunction)( | 87 typedef base::Thread* (*RendererMainThreadFactoryFunction)( |
| 86 const InProcessChildThreadParams& params); | 88 const InProcessChildThreadParams& params); |
| 87 | 89 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 // Registers the given |process| to be used for any instance of |url| | 251 // Registers the given |process| to be used for any instance of |url| |
| 250 // within |browser_context|. | 252 // within |browser_context|. |
| 251 // This should only be used for process-per-site mode, which can be enabled | 253 // This should only be used for process-per-site mode, which can be enabled |
| 252 // globally with a command line flag or per-site, as determined by | 254 // globally with a command line flag or per-site, as determined by |
| 253 // SiteInstanceImpl::ShouldUseProcessPerSite. | 255 // SiteInstanceImpl::ShouldUseProcessPerSite. |
| 254 static void RegisterProcessHostForSite( | 256 static void RegisterProcessHostForSite( |
| 255 BrowserContext* browser_context, | 257 BrowserContext* browser_context, |
| 256 RenderProcessHost* process, | 258 RenderProcessHost* process, |
| 257 const GURL& url); | 259 const GURL& url); |
| 258 | 260 |
| 261 // The policy to apply when selecting a RenderProcessHost for a site. | |
|
Charlie Reis
2017/05/03 23:28:00
I'm unclear if this is just about process-per-site
clamy
2017/05/04 15:56:19
I have rephrased the comment.
| |
| 262 enum class ProcessReusePolicy { | |
|
Charlie Reis
2017/05/03 23:28:00
It's a bit odd that this enum is not used in any A
clamy
2017/05/04 15:56:19
Done.
| |
| 263 // Do not attempt to reuse an existing RenderProcessHost. | |
| 264 DONT, | |
|
Charlie Reis
2017/05/03 23:28:00
Let's clarify if this really means "never reuse, e
nasko
2017/05/03 23:46:17
nit: DO_NOT
clamy
2017/05/04 15:56:19
I initially thought we might want to change Render
| |
| 265 | |
| 266 // In this mode, all instances of the site will be rendered in the same | |
|
Charlie Reis
2017/05/03 23:28:00
Is the idea to also use this value for ServiceWork
nasko
2017/05/03 23:46:17
nit: s/rendererd/hosted/?
clamy
2017/05/04 15:56:19
Done.
For the naming question, I'm planning a dif
Charlie Reis
2017/05/04 23:12:23
Works for me, thanks.
| |
| 267 // RenderProcessHost. | |
| 268 PROCESS_PER_SITE, | |
| 269 | |
| 270 // In this mode, subframes will be rendered in a designated | |
| 271 // RenderProcessHost. | |
| 272 USE_DEFAULT_SUBFRAME_INSTANCE, | |
|
Charlie Reis
2017/05/03 23:28:00
s/INSTANCE/PROCESS/, perhaps?
There are multiple
clamy
2017/05/04 15:56:19
Done.
| |
| 273 | |
| 274 // By default, a new RenderProcessHost will be created unless the process | |
| 275 // limit has been reached. | |
|
Charlie Reis
2017/05/03 23:28:00
Let's mention that reuse after the limit is random
clamy
2017/05/04 15:56:19
Done.
| |
| 276 DEFAULT, | |
| 277 }; | |
| 278 | |
| 279 // Returns a suitable RenderProcessHost to use for |site_instance|. Depending | |
| 280 // on the SiteInstance ProcessReusePolicy and its url, this may be an existing | |
|
Charlie Reis
2017/05/03 23:28:00
nit: SiteInstance's
clamy
2017/05/04 15:56:19
Done.
| |
| 281 // RenderProcessHost or a new one. | |
| 282 static RenderProcessHost* GetProcessHostForSiteInstance( | |
| 283 BrowserContext* browser_context, | |
| 284 SiteInstanceImpl* site_instance); | |
| 285 | |
| 259 static base::MessageLoop* GetInProcessRendererThreadForTesting(); | 286 static base::MessageLoop* GetInProcessRendererThreadForTesting(); |
| 260 | 287 |
| 261 // This forces a renderer that is running "in process" to shut down. | 288 // This forces a renderer that is running "in process" to shut down. |
| 262 static void ShutDownInProcessRenderer(); | 289 static void ShutDownInProcessRenderer(); |
| 263 | 290 |
| 264 static void RegisterRendererMainThreadFactory( | 291 static void RegisterRendererMainThreadFactory( |
| 265 RendererMainThreadFactoryFunction create); | 292 RendererMainThreadFactoryFunction create); |
| 266 | 293 |
| 267 RenderFrameMessageFilter* render_frame_message_filter_for_testing() const { | 294 RenderFrameMessageFilter* render_frame_message_filter_for_testing() const { |
| 268 return render_frame_message_filter_.get(); | 295 return render_frame_message_filter_.get(); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 288 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 315 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
| 289 | 316 |
| 290 void RecomputeAndUpdateWebKitPreferences(); | 317 void RecomputeAndUpdateWebKitPreferences(); |
| 291 | 318 |
| 292 // Called when an audio stream is added or removed and used to determine if | 319 // Called when an audio stream is added or removed and used to determine if |
| 293 // the process should be backgrounded or not. | 320 // the process should be backgrounded or not. |
| 294 void OnAudioStreamAdded() override; | 321 void OnAudioStreamAdded() override; |
| 295 void OnAudioStreamRemoved() override; | 322 void OnAudioStreamRemoved() override; |
| 296 int get_audio_stream_count_for_testing() const { return audio_stream_count_; } | 323 int get_audio_stream_count_for_testing() const { return audio_stream_count_; } |
| 297 | 324 |
| 325 // Sets the global factory used to create new RenderProcessHosts. It may be | |
| 326 // nullptr, in which case the default RenderProcessHost will be created (this | |
| 327 // is the behavior if you don't call this function). The factory must be set | |
| 328 // back to nullptr before it's destroyed; ownership is not transferred. | |
| 329 static void set_render_process_host_factory( | |
|
Charlie Reis
2017/05/03 23:28:00
Thanks-- this makes more sense here.
| |
| 330 const RenderProcessHostFactory* rph_factory); | |
| 331 | |
| 298 protected: | 332 protected: |
| 299 // A proxy for our IPC::Channel that lives on the IO thread. | 333 // A proxy for our IPC::Channel that lives on the IO thread. |
| 300 std::unique_ptr<IPC::ChannelProxy> channel_; | 334 std::unique_ptr<IPC::ChannelProxy> channel_; |
| 301 | 335 |
| 302 // True if fast shutdown has been performed on this RPH. | 336 // True if fast shutdown has been performed on this RPH. |
| 303 bool fast_shutdown_started_; | 337 bool fast_shutdown_started_; |
| 304 | 338 |
| 305 // True if we've posted a DeleteTask and will be deleted soon. | 339 // True if we've posted a DeleteTask and will be deleted soon. |
| 306 bool deleting_soon_; | 340 bool deleting_soon_; |
| 307 | 341 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 // available for extraction by a SubprocesMetricsProvider in order to | 415 // available for extraction by a SubprocesMetricsProvider in order to |
| 382 // report those histograms to UMA. | 416 // report those histograms to UMA. |
| 383 void CreateSharedRendererHistogramAllocator(); | 417 void CreateSharedRendererHistogramAllocator(); |
| 384 | 418 |
| 385 // Handle termination of our process. | 419 // Handle termination of our process. |
| 386 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); | 420 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); |
| 387 | 421 |
| 388 // GpuSwitchingObserver implementation. | 422 // GpuSwitchingObserver implementation. |
| 389 void OnGpuSwitched() override; | 423 void OnGpuSwitched() override; |
| 390 | 424 |
| 425 // Returns the default subframe RenderProcessHost to use for |site_instance|. | |
| 426 static RenderProcessHost* GetDefaultSubframeProcessHost( | |
| 427 BrowserContext* browser_context, | |
| 428 SiteInstanceImpl* site_instance, | |
| 429 bool is_for_guests_only); | |
| 430 | |
| 391 #if BUILDFLAG(ENABLE_WEBRTC) | 431 #if BUILDFLAG(ENABLE_WEBRTC) |
| 392 void OnRegisterAecDumpConsumer(int id); | 432 void OnRegisterAecDumpConsumer(int id); |
| 393 void OnUnregisterAecDumpConsumer(int id); | 433 void OnUnregisterAecDumpConsumer(int id); |
| 394 void RegisterAecDumpConsumerOnUIThread(int id); | 434 void RegisterAecDumpConsumerOnUIThread(int id); |
| 395 void UnregisterAecDumpConsumerOnUIThread(int id); | 435 void UnregisterAecDumpConsumerOnUIThread(int id); |
| 396 void EnableAecDumpForId(const base::FilePath& file, int id); | 436 void EnableAecDumpForId(const base::FilePath& file, int id); |
| 397 // Sends |file_for_transit| to the render process. | 437 // Sends |file_for_transit| to the render process. |
| 398 void SendAecDumpFileToRenderer(int id, | 438 void SendAecDumpFileToRenderer(int id, |
| 399 IPC::PlatformFileForTransit file_for_transit); | 439 IPC::PlatformFileForTransit file_for_transit); |
| 400 void SendDisableAecDumpToRenderer(); | 440 void SendDisableAecDumpToRenderer(); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 FrameSinkProviderImpl frame_sink_provider_; | 669 FrameSinkProviderImpl frame_sink_provider_; |
| 630 | 670 |
| 631 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 671 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
| 632 | 672 |
| 633 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 673 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
| 634 }; | 674 }; |
| 635 | 675 |
| 636 } // namespace content | 676 } // namespace content |
| 637 | 677 |
| 638 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 678 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |