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 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <queue> | 13 #include <queue> |
14 #include <set> | 14 #include <set> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/process/process.h" | 20 #include "base/process/process.h" |
21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
22 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "content/browser/child_process_launcher.h" | 24 #include "content/browser/child_process_launcher.h" |
25 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 25 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
26 #include "content/browser/renderer_host/frame_sink_provider_impl.h" | 26 #include "content/browser/renderer_host/frame_sink_provider_impl.h" |
| 27 #include "content/browser/renderer_host/media/renderer_audio_output_stream_facto
ry_context_impl.h" |
27 #include "content/browser/renderer_host/offscreen_canvas_provider_impl.h" | 28 #include "content/browser/renderer_host/offscreen_canvas_provider_impl.h" |
28 #include "content/browser/webrtc/webrtc_eventlog_host.h" | 29 #include "content/browser/webrtc/webrtc_eventlog_host.h" |
29 #include "content/common/associated_interface_registry_impl.h" | 30 #include "content/common/associated_interface_registry_impl.h" |
30 #include "content/common/associated_interfaces.mojom.h" | 31 #include "content/common/associated_interfaces.mojom.h" |
31 #include "content/common/content_export.h" | 32 #include "content/common/content_export.h" |
32 #include "content/common/indexed_db/indexed_db.mojom.h" | 33 #include "content/common/indexed_db/indexed_db.mojom.h" |
| 34 #include "content/common/media/renderer_audio_output_stream_factory.mojom.h" |
33 #include "content/common/renderer.mojom.h" | 35 #include "content/common/renderer.mojom.h" |
34 #include "content/common/storage_partition_service.mojom.h" | 36 #include "content/common/storage_partition_service.mojom.h" |
35 #include "content/common/url_loader_factory.mojom.h" | 37 #include "content/common/url_loader_factory.mojom.h" |
36 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
37 #include "content/public/common/service_manager_connection.h" | 39 #include "content/public/common/service_manager_connection.h" |
38 #include "ipc/ipc_channel_proxy.h" | 40 #include "ipc/ipc_channel_proxy.h" |
39 #include "ipc/ipc_platform_file.h" | 41 #include "ipc/ipc_platform_file.h" |
40 #include "media/media_features.h" | 42 #include "media/media_features.h" |
41 #include "mojo/edk/embedder/outgoing_broker_client_invitation.h" | 43 #include "mojo/edk/embedder/outgoing_broker_client_invitation.h" |
42 #include "mojo/public/cpp/bindings/associated_binding.h" | 44 #include "mojo/public/cpp/bindings/associated_binding.h" |
(...skipping 10 matching lines...) Expand all Loading... |
53 #endif | 55 #endif |
54 | 56 |
55 namespace base { | 57 namespace base { |
56 class CommandLine; | 58 class CommandLine; |
57 class MessageLoop; | 59 class MessageLoop; |
58 class SharedPersistentMemoryAllocator; | 60 class SharedPersistentMemoryAllocator; |
59 } | 61 } |
60 | 62 |
61 namespace content { | 63 namespace content { |
62 class AudioInputRendererHost; | 64 class AudioInputRendererHost; |
63 class AudioRendererHost; | |
64 class ChildConnection; | 65 class ChildConnection; |
65 class GpuClient; | 66 class GpuClient; |
66 class IndexedDBDispatcherHost; | 67 class IndexedDBDispatcherHost; |
67 class InProcessChildThreadParams; | 68 class InProcessChildThreadParams; |
68 class NotificationMessageFilter; | 69 class NotificationMessageFilter; |
69 #if BUILDFLAG(ENABLE_WEBRTC) | 70 #if BUILDFLAG(ENABLE_WEBRTC) |
70 class P2PSocketDispatcherHost; | 71 class P2PSocketDispatcherHost; |
71 #endif | 72 #endif |
72 class PermissionServiceContext; | 73 class PermissionServiceContext; |
73 class PeerConnectionTrackerHost; | 74 class PeerConnectionTrackerHost; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const std::string& interface_name, | 200 const std::string& interface_name, |
200 mojo::ScopedInterfaceEndpointHandle handle) override; | 201 mojo::ScopedInterfaceEndpointHandle handle) override; |
201 void OnChannelConnected(int32_t peer_pid) override; | 202 void OnChannelConnected(int32_t peer_pid) override; |
202 void OnChannelError() override; | 203 void OnChannelError() override; |
203 void OnBadMessageReceived(const IPC::Message& message) override; | 204 void OnBadMessageReceived(const IPC::Message& message) override; |
204 | 205 |
205 // ChildProcessLauncher::Client implementation. | 206 // ChildProcessLauncher::Client implementation. |
206 void OnProcessLaunched() override; | 207 void OnProcessLaunched() override; |
207 void OnProcessLaunchFailed(int error_code) override; | 208 void OnProcessLaunchFailed(int error_code) override; |
208 | 209 |
209 scoped_refptr<AudioRendererHost> audio_renderer_host() const; | |
210 | |
211 // Call this function when it is evident that the child process is actively | 210 // 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. | 211 // performing some operation, for example if we just received an IPC message. |
213 void mark_child_process_activity_time() { | 212 void mark_child_process_activity_time() { |
214 child_process_activity_time_ = base::TimeTicks::Now(); | 213 child_process_activity_time_ = base::TimeTicks::Now(); |
215 } | 214 } |
216 | 215 |
217 // Used to extend the lifetime of the sessions until the render view | 216 // 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 | 217 // in the renderer is fully closed. This is static because its also called |
219 // with mock hosts as input in test cases. | 218 // with mock hosts as input in test cases. |
220 static void ReleaseOnCloseACK( | 219 static void ReleaseOnCloseACK( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 is_for_guests_only_ = is_for_guests_only; | 288 is_for_guests_only_ = is_for_guests_only; |
290 } | 289 } |
291 | 290 |
292 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 291 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
293 // Launch the zygote early in the browser startup. | 292 // Launch the zygote early in the browser startup. |
294 static void EarlyZygoteLaunch(); | 293 static void EarlyZygoteLaunch(); |
295 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 294 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
296 | 295 |
297 void RecomputeAndUpdateWebKitPreferences(); | 296 void RecomputeAndUpdateWebKitPreferences(); |
298 | 297 |
| 298 UniqueAudioOutputStreamFactoryPtr CreateAudioOutputStreamFactory( |
| 299 int frame_id, |
| 300 mojom::RendererAudioOutputStreamFactoryRequest request); |
| 301 |
299 // Called when an audio stream is added or removed and used to determine if | 302 // Called when an audio stream is added or removed and used to determine if |
300 // the process should be backgrounded or not. | 303 // the process should be backgrounded or not. |
301 void OnAudioStreamAdded() override; | 304 void OnAudioStreamAdded() override; |
302 void OnAudioStreamRemoved() override; | 305 void OnAudioStreamRemoved() override; |
303 int get_audio_stream_count_for_testing() const { return audio_stream_count_; } | 306 int get_audio_stream_count_for_testing() const { return audio_stream_count_; } |
304 | 307 |
305 // Sets the global factory used to create new RenderProcessHosts. It may be | 308 // Sets the global factory used to create new RenderProcessHosts. It may be |
306 // nullptr, in which case the default RenderProcessHost will be created (this | 309 // nullptr, in which case the default RenderProcessHost will be created (this |
307 // is the behavior if you don't call this function). The factory must be set | 310 // is the behavior if you don't call this function). The factory must be set |
308 // back to nullptr before it's destroyed; ownership is not transferred. | 311 // back to nullptr before it's destroyed; ownership is not transferred. |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 bool gpu_observer_registered_; | 616 bool gpu_observer_registered_; |
614 | 617 |
615 // Set if a call to Cleanup is required once the RenderProcessHostImpl is no | 618 // Set if a call to Cleanup is required once the RenderProcessHostImpl is no |
616 // longer within the RenderProcessHostObserver::RenderProcessExited callbacks. | 619 // longer within the RenderProcessHostObserver::RenderProcessExited callbacks. |
617 bool delayed_cleanup_needed_; | 620 bool delayed_cleanup_needed_; |
618 | 621 |
619 // Indicates whether RenderProcessHostImpl is currently iterating and calling | 622 // Indicates whether RenderProcessHostImpl is currently iterating and calling |
620 // through RenderProcessHostObserver::RenderProcessExited. | 623 // through RenderProcessHostObserver::RenderProcessExited. |
621 bool within_process_died_observer_; | 624 bool within_process_died_observer_; |
622 | 625 |
623 scoped_refptr<AudioRendererHost> audio_renderer_host_; | 626 std::unique_ptr<RendererAudioOutputStreamFactoryContextImpl, |
| 627 BrowserThread::DeleteOnIOThread> |
| 628 audio_output_stream_factory_context_; |
624 | 629 |
625 scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_; | 630 scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_; |
626 | 631 |
627 #if BUILDFLAG(ENABLE_WEBRTC) | 632 #if BUILDFLAG(ENABLE_WEBRTC) |
628 scoped_refptr<P2PSocketDispatcherHost> p2p_socket_dispatcher_host_; | 633 scoped_refptr<P2PSocketDispatcherHost> p2p_socket_dispatcher_host_; |
629 | 634 |
630 // Must be accessed on UI thread. | 635 // Must be accessed on UI thread. |
631 std::vector<int> aec_dump_consumers_; | 636 std::vector<int> aec_dump_consumers_; |
632 | 637 |
633 WebRtcStopRtpDumpCallback stop_rtp_dump_callback_; | 638 WebRtcStopRtpDumpCallback stop_rtp_dump_callback_; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 FrameSinkProviderImpl frame_sink_provider_; | 693 FrameSinkProviderImpl frame_sink_provider_; |
689 | 694 |
690 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 695 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
691 | 696 |
692 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 697 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
693 }; | 698 }; |
694 | 699 |
695 } // namespace content | 700 } // namespace content |
696 | 701 |
697 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 702 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |