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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void EnableSendQueue() override; | 116 void EnableSendQueue() override; |
117 int GetNextRoutingID() override; | 117 int GetNextRoutingID() override; |
118 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; | 118 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; |
119 void RemoveRoute(int32_t routing_id) override; | 119 void RemoveRoute(int32_t routing_id) override; |
120 void AddObserver(RenderProcessHostObserver* observer) override; | 120 void AddObserver(RenderProcessHostObserver* observer) override; |
121 void RemoveObserver(RenderProcessHostObserver* observer) override; | 121 void RemoveObserver(RenderProcessHostObserver* observer) override; |
122 void ShutdownForBadMessage(CrashReportMode crash_report_mode) override; | 122 void ShutdownForBadMessage(CrashReportMode crash_report_mode) override; |
123 void WidgetRestored() override; | 123 void WidgetRestored() override; |
124 void WidgetHidden() override; | 124 void WidgetHidden() override; |
125 int VisibleWidgetCount() const override; | 125 int VisibleWidgetCount() const override; |
126 void AudioStateChanged() override; | |
127 bool IsForGuestsOnly() const override; | 126 bool IsForGuestsOnly() const override; |
128 StoragePartition* GetStoragePartition() const override; | 127 StoragePartition* GetStoragePartition() const override; |
129 bool Shutdown(int exit_code, bool wait) override; | 128 bool Shutdown(int exit_code, bool wait) override; |
130 bool FastShutdownIfPossible() override; | 129 bool FastShutdownIfPossible() override; |
131 base::ProcessHandle GetHandle() const override; | 130 base::ProcessHandle GetHandle() const override; |
132 bool IsReady() const override; | 131 bool IsReady() const override; |
133 BrowserContext* GetBrowserContext() const override; | 132 BrowserContext* GetBrowserContext() const override; |
134 bool InSameStoragePartition(StoragePartition* partition) const override; | 133 bool InSameStoragePartition(StoragePartition* partition) const override; |
135 int GetID() const override; | 134 int GetID() const override; |
136 bool HasConnection() const override; | 135 bool HasConnection() const override; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void GetAudioOutputControllers( | 279 void GetAudioOutputControllers( |
281 const GetAudioOutputControllersCallback& callback) const override; | 280 const GetAudioOutputControllersCallback& callback) const override; |
282 | 281 |
283 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 282 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
284 // Launch the zygote early in the browser startup. | 283 // Launch the zygote early in the browser startup. |
285 static void EarlyZygoteLaunch(); | 284 static void EarlyZygoteLaunch(); |
286 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 285 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
287 | 286 |
288 void RecomputeAndUpdateWebKitPreferences(); | 287 void RecomputeAndUpdateWebKitPreferences(); |
289 | 288 |
| 289 // Called when an audio stream is added or removed and used to determine if |
| 290 // the process should be backgrounded or not. |
| 291 void OnAudioStreamAdded() override; |
| 292 void OnAudioStreamRemoved() override; |
| 293 int get_audio_stream_count_for_testing() const { return audio_stream_count_; } |
| 294 |
290 protected: | 295 protected: |
291 // A proxy for our IPC::Channel that lives on the IO thread. | 296 // A proxy for our IPC::Channel that lives on the IO thread. |
292 std::unique_ptr<IPC::ChannelProxy> channel_; | 297 std::unique_ptr<IPC::ChannelProxy> channel_; |
293 | 298 |
294 // True if fast shutdown has been performed on this RPH. | 299 // True if fast shutdown has been performed on this RPH. |
295 bool fast_shutdown_started_; | 300 bool fast_shutdown_started_; |
296 | 301 |
297 // True if we've posted a DeleteTask and will be deleted soon. | 302 // True if we've posted a DeleteTask and will be deleted soon. |
298 bool deleting_soon_; | 303 bool deleting_soon_; |
299 | 304 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 597 |
593 scoped_refptr<ResourceMessageFilter> resource_message_filter_; | 598 scoped_refptr<ResourceMessageFilter> resource_message_filter_; |
594 std::unique_ptr<GpuClient, BrowserThread::DeleteOnIOThread> gpu_client_; | 599 std::unique_ptr<GpuClient, BrowserThread::DeleteOnIOThread> gpu_client_; |
595 | 600 |
596 std::unique_ptr<OffscreenCanvasCompositorFrameSinkProviderImpl> | 601 std::unique_ptr<OffscreenCanvasCompositorFrameSinkProviderImpl> |
597 offscreen_canvas_provider_; | 602 offscreen_canvas_provider_; |
598 | 603 |
599 mojom::RouteProviderAssociatedPtr remote_route_provider_; | 604 mojom::RouteProviderAssociatedPtr remote_route_provider_; |
600 mojom::RendererAssociatedPtr renderer_interface_; | 605 mojom::RendererAssociatedPtr renderer_interface_; |
601 | 606 |
| 607 // Tracks active audio streams within the render process; used to determine if |
| 608 // if a process should be backgrounded. |
| 609 int audio_stream_count_ = 0; |
| 610 |
602 // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend | 611 // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend |
603 // WeakPtrs which are invalidated any time the RPHI is recycled. | 612 // WeakPtrs which are invalidated any time the RPHI is recycled. |
604 std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>> | 613 std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>> |
605 instance_weak_factory_; | 614 instance_weak_factory_; |
606 | 615 |
607 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 616 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
608 | 617 |
609 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 618 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
610 }; | 619 }; |
611 | 620 |
612 } // namespace content | 621 } // namespace content |
613 | 622 |
614 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 623 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |