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

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

Issue 2861433002: Implement ProcessReusePolicy for SiteInstances (Closed)
Patch Set: Fixed ChromeOS issue Created 3 years, 7 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 class IndexedDBDispatcherHost; 65 class IndexedDBDispatcherHost;
66 class InProcessChildThreadParams; 66 class InProcessChildThreadParams;
67 class NotificationMessageFilter; 67 class NotificationMessageFilter;
68 #if BUILDFLAG(ENABLE_WEBRTC) 68 #if BUILDFLAG(ENABLE_WEBRTC)
69 class P2PSocketDispatcherHost; 69 class P2PSocketDispatcherHost;
70 #endif 70 #endif
71 class PermissionServiceContext; 71 class PermissionServiceContext;
72 class PeerConnectionTrackerHost; 72 class PeerConnectionTrackerHost;
73 class PushMessagingManager; 73 class PushMessagingManager;
74 class RenderFrameMessageFilter; 74 class RenderFrameMessageFilter;
75 class RenderProcessHostFactory;
75 class RenderWidgetHelper; 76 class RenderWidgetHelper;
76 class RenderWidgetHost; 77 class RenderWidgetHost;
77 class RenderWidgetHostImpl; 78 class RenderWidgetHostImpl;
78 class ResourceMessageFilter; 79 class ResourceMessageFilter;
80 class SiteInstanceImpl;
79 class StoragePartition; 81 class StoragePartition;
80 class StoragePartitionImpl; 82 class StoragePartitionImpl;
81 83
82 typedef base::Thread* (*RendererMainThreadFactoryFunction)( 84 typedef base::Thread* (*RendererMainThreadFactoryFunction)(
83 const InProcessChildThreadParams& params); 85 const InProcessChildThreadParams& params);
84 86
85 // Implements a concrete RenderProcessHost for the browser process for talking 87 // Implements a concrete RenderProcessHost for the browser process for talking
86 // to actual renderer processes (as opposed to mocks). 88 // to actual renderer processes (as opposed to mocks).
87 // 89 //
88 // Represents the browser side of the browser <--> renderer communication 90 // Represents the browser side of the browser <--> renderer communication
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Registers the given |process| to be used for any instance of |url| 248 // Registers the given |process| to be used for any instance of |url|
247 // within |browser_context|. 249 // within |browser_context|.
248 // This should only be used for process-per-site mode, which can be enabled 250 // This should only be used for process-per-site mode, which can be enabled
249 // globally with a command line flag or per-site, as determined by 251 // globally with a command line flag or per-site, as determined by
250 // SiteInstanceImpl::ShouldUseProcessPerSite. 252 // SiteInstanceImpl::ShouldUseProcessPerSite.
251 static void RegisterProcessHostForSite( 253 static void RegisterProcessHostForSite(
252 BrowserContext* browser_context, 254 BrowserContext* browser_context,
253 RenderProcessHost* process, 255 RenderProcessHost* process,
254 const GURL& url); 256 const GURL& url);
255 257
258 // Returns a suitable RenderProcessHost to use for |site_instance|. Depending
259 // on the SiteInstance's ProcessReusePolicy and its url, this may be an
260 // existing RenderProcessHost or a new one.
261 static RenderProcessHost* GetProcessHostForSiteInstance(
262 BrowserContext* browser_context,
263 SiteInstanceImpl* site_instance);
264
256 static base::MessageLoop* GetInProcessRendererThreadForTesting(); 265 static base::MessageLoop* GetInProcessRendererThreadForTesting();
257 266
258 // This forces a renderer that is running "in process" to shut down. 267 // This forces a renderer that is running "in process" to shut down.
259 static void ShutDownInProcessRenderer(); 268 static void ShutDownInProcessRenderer();
260 269
261 static void RegisterRendererMainThreadFactory( 270 static void RegisterRendererMainThreadFactory(
262 RendererMainThreadFactoryFunction create); 271 RendererMainThreadFactoryFunction create);
263 272
264 RenderFrameMessageFilter* render_frame_message_filter_for_testing() const { 273 RenderFrameMessageFilter* render_frame_message_filter_for_testing() const {
265 return render_frame_message_filter_.get(); 274 return render_frame_message_filter_.get();
(...skipping 19 matching lines...) Expand all
285 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 294 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
286 295
287 void RecomputeAndUpdateWebKitPreferences(); 296 void RecomputeAndUpdateWebKitPreferences();
288 297
289 // Called when an audio stream is added or removed and used to determine if 298 // Called when an audio stream is added or removed and used to determine if
290 // the process should be backgrounded or not. 299 // the process should be backgrounded or not.
291 void OnAudioStreamAdded() override; 300 void OnAudioStreamAdded() override;
292 void OnAudioStreamRemoved() override; 301 void OnAudioStreamRemoved() override;
293 int get_audio_stream_count_for_testing() const { return audio_stream_count_; } 302 int get_audio_stream_count_for_testing() const { return audio_stream_count_; }
294 303
304 // Sets the global factory used to create new RenderProcessHosts. It may be
305 // nullptr, in which case the default RenderProcessHost will be created (this
306 // is the behavior if you don't call this function). The factory must be set
307 // back to nullptr before it's destroyed; ownership is not transferred.
308 static void set_render_process_host_factory(
309 const RenderProcessHostFactory* rph_factory);
310
295 protected: 311 protected:
296 // A proxy for our IPC::Channel that lives on the IO thread. 312 // A proxy for our IPC::Channel that lives on the IO thread.
297 std::unique_ptr<IPC::ChannelProxy> channel_; 313 std::unique_ptr<IPC::ChannelProxy> channel_;
298 314
299 // True if fast shutdown has been performed on this RPH. 315 // True if fast shutdown has been performed on this RPH.
300 bool fast_shutdown_started_; 316 bool fast_shutdown_started_;
301 317
302 // True if we've posted a DeleteTask and will be deleted soon. 318 // True if we've posted a DeleteTask and will be deleted soon.
303 bool deleting_soon_; 319 bool deleting_soon_;
304 320
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // available for extraction by a SubprocesMetricsProvider in order to 398 // available for extraction by a SubprocesMetricsProvider in order to
383 // report those histograms to UMA. 399 // report those histograms to UMA.
384 void CreateSharedRendererHistogramAllocator(); 400 void CreateSharedRendererHistogramAllocator();
385 401
386 // Handle termination of our process. 402 // Handle termination of our process.
387 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); 403 void ProcessDied(bool already_dead, RendererClosedDetails* known_details);
388 404
389 // GpuSwitchingObserver implementation. 405 // GpuSwitchingObserver implementation.
390 void OnGpuSwitched() override; 406 void OnGpuSwitched() override;
391 407
408 // Returns the default subframe RenderProcessHost to use for |site_instance|.
409 static RenderProcessHost* GetDefaultSubframeProcessHost(
410 BrowserContext* browser_context,
411 SiteInstanceImpl* site_instance,
412 bool is_for_guests_only);
413
392 #if BUILDFLAG(ENABLE_WEBRTC) 414 #if BUILDFLAG(ENABLE_WEBRTC)
393 void OnRegisterAecDumpConsumer(int id); 415 void OnRegisterAecDumpConsumer(int id);
394 void OnUnregisterAecDumpConsumer(int id); 416 void OnUnregisterAecDumpConsumer(int id);
395 void RegisterAecDumpConsumerOnUIThread(int id); 417 void RegisterAecDumpConsumerOnUIThread(int id);
396 void UnregisterAecDumpConsumerOnUIThread(int id); 418 void UnregisterAecDumpConsumerOnUIThread(int id);
397 void EnableAecDumpForId(const base::FilePath& file, int id); 419 void EnableAecDumpForId(const base::FilePath& file, int id);
398 // Sends |file_for_transit| to the render process. 420 // Sends |file_for_transit| to the render process.
399 void SendAecDumpFileToRenderer(int id, 421 void SendAecDumpFileToRenderer(int id,
400 IPC::PlatformFileForTransit file_for_transit); 422 IPC::PlatformFileForTransit file_for_transit);
401 void SendDisableAecDumpToRenderer(); 423 void SendDisableAecDumpToRenderer();
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 FrameSinkProviderImpl frame_sink_provider_; 654 FrameSinkProviderImpl frame_sink_provider_;
633 655
634 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; 656 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_;
635 657
636 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 658 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
637 }; 659 };
638 660
639 } // namespace content 661 } // namespace content
640 662
641 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ 663 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698