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 14 matching lines...) Expand all Loading... |
25 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_p
rovider_impl.h" | 25 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_p
rovider_impl.h" |
26 #include "content/browser/webrtc/webrtc_eventlog_host.h" | 26 #include "content/browser/webrtc/webrtc_eventlog_host.h" |
27 #include "content/common/associated_interfaces.mojom.h" | 27 #include "content/common/associated_interfaces.mojom.h" |
28 #include "content/common/content_export.h" | 28 #include "content/common/content_export.h" |
29 #include "content/common/indexed_db/indexed_db.mojom.h" | 29 #include "content/common/indexed_db/indexed_db.mojom.h" |
30 #include "content/common/renderer.mojom.h" | 30 #include "content/common/renderer.mojom.h" |
31 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
32 #include "content/public/common/service_manager_connection.h" | 32 #include "content/public/common/service_manager_connection.h" |
33 #include "ipc/ipc_channel_proxy.h" | 33 #include "ipc/ipc_channel_proxy.h" |
34 #include "ipc/ipc_platform_file.h" | 34 #include "ipc/ipc_platform_file.h" |
| 35 #include "media/audio/audio_streams_tracker.h" |
35 #include "media/media_features.h" | 36 #include "media/media_features.h" |
36 #include "mojo/public/cpp/bindings/associated_binding.h" | 37 #include "mojo/public/cpp/bindings/associated_binding.h" |
37 #include "mojo/public/cpp/bindings/associated_binding_set.h" | 38 #include "mojo/public/cpp/bindings/associated_binding_set.h" |
38 #include "mojo/public/cpp/bindings/interface_ptr.h" | 39 #include "mojo/public/cpp/bindings/interface_ptr.h" |
39 #include "services/service_manager/public/cpp/interface_registry.h" | 40 #include "services/service_manager/public/cpp/interface_registry.h" |
40 #include "services/service_manager/public/interfaces/service.mojom.h" | 41 #include "services/service_manager/public/interfaces/service.mojom.h" |
41 #include "services/ui/public/interfaces/gpu.mojom.h" | 42 #include "services/ui/public/interfaces/gpu.mojom.h" |
42 #include "ui/gfx/gpu_memory_buffer.h" | 43 #include "ui/gfx/gpu_memory_buffer.h" |
43 #include "ui/gl/gpu_switching_observer.h" | 44 #include "ui/gl/gpu_switching_observer.h" |
44 | 45 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void EnableSendQueue() override; | 117 void EnableSendQueue() override; |
117 int GetNextRoutingID() override; | 118 int GetNextRoutingID() override; |
118 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; | 119 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; |
119 void RemoveRoute(int32_t routing_id) override; | 120 void RemoveRoute(int32_t routing_id) override; |
120 void AddObserver(RenderProcessHostObserver* observer) override; | 121 void AddObserver(RenderProcessHostObserver* observer) override; |
121 void RemoveObserver(RenderProcessHostObserver* observer) override; | 122 void RemoveObserver(RenderProcessHostObserver* observer) override; |
122 void ShutdownForBadMessage(CrashReportMode crash_report_mode) override; | 123 void ShutdownForBadMessage(CrashReportMode crash_report_mode) override; |
123 void WidgetRestored() override; | 124 void WidgetRestored() override; |
124 void WidgetHidden() override; | 125 void WidgetHidden() override; |
125 int VisibleWidgetCount() const override; | 126 int VisibleWidgetCount() const override; |
126 void AudioStateChanged() override; | |
127 bool IsForGuestsOnly() const override; | 127 bool IsForGuestsOnly() const override; |
128 StoragePartition* GetStoragePartition() const override; | 128 StoragePartition* GetStoragePartition() const override; |
129 bool Shutdown(int exit_code, bool wait) override; | 129 bool Shutdown(int exit_code, bool wait) override; |
130 bool FastShutdownIfPossible() override; | 130 bool FastShutdownIfPossible() override; |
131 base::ProcessHandle GetHandle() const override; | 131 base::ProcessHandle GetHandle() const override; |
132 bool IsReady() const override; | 132 bool IsReady() const override; |
133 BrowserContext* GetBrowserContext() const override; | 133 BrowserContext* GetBrowserContext() const override; |
134 bool InSameStoragePartition(StoragePartition* partition) const override; | 134 bool InSameStoragePartition(StoragePartition* partition) const override; |
135 int GetID() const override; | 135 int GetID() const override; |
136 bool HasConnection() const override; | 136 bool HasConnection() const override; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void GetAudioOutputControllers( | 280 void GetAudioOutputControllers( |
281 const GetAudioOutputControllersCallback& callback) const override; | 281 const GetAudioOutputControllersCallback& callback) const override; |
282 | 282 |
283 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 283 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
284 // Launch the zygote early in the browser startup. | 284 // Launch the zygote early in the browser startup. |
285 static void EarlyZygoteLaunch(); | 285 static void EarlyZygoteLaunch(); |
286 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 286 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
287 | 287 |
288 void RecomputeAndUpdateWebKitPreferences(); | 288 void RecomputeAndUpdateWebKitPreferences(); |
289 | 289 |
| 290 // Called when an audio stream is added or removed and used to determine if |
| 291 // the process should be backgrounded or not. |
| 292 // |
| 293 // TODO(dalecurtis, maxmorin): Currently this only checks if a stream is |
| 294 // playing or not, but instead it should be based on if the stream is audible |
| 295 // or not. |
| 296 void OnAudioStreamAdded(); |
| 297 void OnAudioStreamRemoved(); |
| 298 |
290 protected: | 299 protected: |
291 // A proxy for our IPC::Channel that lives on the IO thread. | 300 // A proxy for our IPC::Channel that lives on the IO thread. |
292 std::unique_ptr<IPC::ChannelProxy> channel_; | 301 std::unique_ptr<IPC::ChannelProxy> channel_; |
293 | 302 |
294 // True if fast shutdown has been performed on this RPH. | 303 // True if fast shutdown has been performed on this RPH. |
295 bool fast_shutdown_started_; | 304 bool fast_shutdown_started_; |
296 | 305 |
297 // True if we've posted a DeleteTask and will be deleted soon. | 306 // True if we've posted a DeleteTask and will be deleted soon. |
298 bool deleting_soon_; | 307 bool deleting_soon_; |
299 | 308 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 601 |
593 scoped_refptr<ResourceMessageFilter> resource_message_filter_; | 602 scoped_refptr<ResourceMessageFilter> resource_message_filter_; |
594 std::unique_ptr<GpuClient, BrowserThread::DeleteOnIOThread> gpu_client_; | 603 std::unique_ptr<GpuClient, BrowserThread::DeleteOnIOThread> gpu_client_; |
595 | 604 |
596 std::unique_ptr<OffscreenCanvasCompositorFrameSinkProviderImpl> | 605 std::unique_ptr<OffscreenCanvasCompositorFrameSinkProviderImpl> |
597 offscreen_canvas_provider_; | 606 offscreen_canvas_provider_; |
598 | 607 |
599 mojom::RouteProviderAssociatedPtr remote_route_provider_; | 608 mojom::RouteProviderAssociatedPtr remote_route_provider_; |
600 mojom::RendererAssociatedPtr renderer_interface_; | 609 mojom::RendererAssociatedPtr renderer_interface_; |
601 | 610 |
| 611 // Tracks active audio streams within the render process; used to determine if |
| 612 // if a process should be backgrounded. |
| 613 media::AudioStreamsTracker audio_streams_tracker_; |
| 614 |
602 // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend | 615 // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend |
603 // WeakPtrs which are invalidated any time the RPHI is recycled. | 616 // WeakPtrs which are invalidated any time the RPHI is recycled. |
604 std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>> | 617 std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>> |
605 instance_weak_factory_; | 618 instance_weak_factory_; |
606 | 619 |
607 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 620 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
608 | 621 |
609 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 622 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
610 }; | 623 }; |
611 | 624 |
612 } // namespace content | 625 } // namespace content |
613 | 626 |
614 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 627 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |