| 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_RENDERER_RENDER_THREAD_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/cancelable_callback.h" | 16 #include "base/cancelable_callback.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/memory_coordinator_client.h" | 18 #include "base/memory/memory_coordinator_client.h" |
| 19 #include "base/memory/memory_pressure_listener.h" | 19 #include "base/memory/memory_pressure_listener.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/metrics/user_metrics_action.h" | 21 #include "base/metrics/user_metrics_action.h" |
| 22 #include "base/observer_list.h" | 22 #include "base/observer_list.h" |
| 23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 24 #include "base/threading/thread_checker.h" | 24 #include "base/threading/thread_checker.h" |
| 25 #include "base/timer/timer.h" | 25 #include "base/timer/timer.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "components/display_compositor/interfaces/shared_bitmap_manager.mojom.h
" |
| 27 #include "content/child/child_thread_impl.h" | 28 #include "content/child/child_thread_impl.h" |
| 28 #include "content/child/memory/child_memory_coordinator_impl.h" | 29 #include "content/child/memory/child_memory_coordinator_impl.h" |
| 29 #include "content/common/associated_interface_registry_impl.h" | 30 #include "content/common/associated_interface_registry_impl.h" |
| 30 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
| 31 #include "content/common/frame.mojom.h" | 32 #include "content/common/frame.mojom.h" |
| 32 #include "content/common/frame_replication_state.h" | 33 #include "content/common/frame_replication_state.h" |
| 33 #include "content/common/render_frame_message_filter.mojom.h" | 34 #include "content/common/render_frame_message_filter.mojom.h" |
| 34 #include "content/common/render_message_filter.mojom.h" | 35 #include "content/common/render_message_filter.mojom.h" |
| 35 #include "content/common/renderer.mojom.h" | 36 #include "content/common/renderer.mojom.h" |
| 36 #include "content/common/storage_partition_service.mojom.h" | 37 #include "content/common/storage_partition_service.mojom.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 class BeginFrameSource; | 74 class BeginFrameSource; |
| 74 class CompositorFrameSink; | 75 class CompositorFrameSink; |
| 75 class FrameSinkId; | 76 class FrameSinkId; |
| 76 class TaskGraphRunner; | 77 class TaskGraphRunner; |
| 77 } | 78 } |
| 78 | 79 |
| 79 namespace discardable_memory { | 80 namespace discardable_memory { |
| 80 class ClientDiscardableSharedMemoryManager; | 81 class ClientDiscardableSharedMemoryManager; |
| 81 } | 82 } |
| 82 | 83 |
| 84 namespace display_compositor { |
| 85 class ChildSharedBitmapManager; |
| 86 } |
| 87 |
| 83 namespace gpu { | 88 namespace gpu { |
| 84 class GpuChannelHost; | 89 class GpuChannelHost; |
| 85 } | 90 } |
| 86 | 91 |
| 87 namespace IPC { | 92 namespace IPC { |
| 88 class MessageFilter; | 93 class MessageFilter; |
| 89 } | 94 } |
| 90 | 95 |
| 91 namespace media { | 96 namespace media { |
| 92 class GpuVideoAcceleratorFactories; | 97 class GpuVideoAcceleratorFactories; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 104 namespace content { | 109 namespace content { |
| 105 | 110 |
| 106 class AppCacheDispatcher; | 111 class AppCacheDispatcher; |
| 107 class AecDumpMessageFilter; | 112 class AecDumpMessageFilter; |
| 108 class AudioInputMessageFilter; | 113 class AudioInputMessageFilter; |
| 109 class AudioMessageFilter; | 114 class AudioMessageFilter; |
| 110 class AudioRendererMixerManager; | 115 class AudioRendererMixerManager; |
| 111 class BlobMessageFilter; | 116 class BlobMessageFilter; |
| 112 class BrowserPluginManager; | 117 class BrowserPluginManager; |
| 113 class CacheStorageDispatcher; | 118 class CacheStorageDispatcher; |
| 114 class ChildSharedBitmapManager; | |
| 115 class CompositorForwardingMessageFilter; | 119 class CompositorForwardingMessageFilter; |
| 116 class DBMessageFilter; | 120 class DBMessageFilter; |
| 117 class DevToolsAgentFilter; | 121 class DevToolsAgentFilter; |
| 118 class DomStorageDispatcher; | 122 class DomStorageDispatcher; |
| 119 class EmbeddedWorkerDispatcher; | 123 class EmbeddedWorkerDispatcher; |
| 120 class FrameSwapMessageQueue; | 124 class FrameSwapMessageQueue; |
| 121 class IndexedDBDispatcher; | 125 class IndexedDBDispatcher; |
| 122 class InputHandlerManager; | 126 class InputHandlerManager; |
| 123 class MemoryObserver; | 127 class MemoryObserver; |
| 124 class MidiMessageFilter; | 128 class MidiMessageFilter; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 public base::MemoryCoordinatorClient, | 164 public base::MemoryCoordinatorClient, |
| 161 NON_EXPORTED_BASE(public mojom::Renderer), | 165 NON_EXPORTED_BASE(public mojom::Renderer), |
| 162 NON_EXPORTED_BASE(public CompositorDependencies) { | 166 NON_EXPORTED_BASE(public CompositorDependencies) { |
| 163 public: | 167 public: |
| 164 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 168 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
| 165 static RenderThreadImpl* Create( | 169 static RenderThreadImpl* Create( |
| 166 std::unique_ptr<base::MessageLoop> main_message_loop, | 170 std::unique_ptr<base::MessageLoop> main_message_loop, |
| 167 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); | 171 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); |
| 168 static RenderThreadImpl* current(); | 172 static RenderThreadImpl* current(); |
| 169 static mojom::RenderMessageFilter* current_render_message_filter(); | 173 static mojom::RenderMessageFilter* current_render_message_filter(); |
| 170 static const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& | |
| 171 current_thread_safe_render_message_filter(); | |
| 172 | 174 |
| 173 static void SetRenderMessageFilterForTesting( | 175 static void SetRenderMessageFilterForTesting( |
| 174 mojom::RenderMessageFilter* render_message_filter); | 176 mojom::RenderMessageFilter* render_message_filter); |
| 175 | 177 |
| 176 ~RenderThreadImpl() override; | 178 ~RenderThreadImpl() override; |
| 177 void Shutdown() override; | 179 void Shutdown() override; |
| 178 bool ShouldBeDestroyed() override; | 180 bool ShouldBeDestroyed() override; |
| 179 | 181 |
| 180 // When initializing WebKit, ensure that any schemes needed for the content | 182 // When initializing WebKit, ensure that any schemes needed for the content |
| 181 // module are registered properly. Static to allow sharing with tests. | 183 // module are registered properly. Static to allow sharing with tests. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. | 349 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. |
| 348 P2PSocketDispatcher* p2p_socket_dispatcher() { | 350 P2PSocketDispatcher* p2p_socket_dispatcher() { |
| 349 return p2p_socket_dispatcher_.get(); | 351 return p2p_socket_dispatcher_.get(); |
| 350 } | 352 } |
| 351 #endif | 353 #endif |
| 352 | 354 |
| 353 VideoCaptureImplManager* video_capture_impl_manager() const { | 355 VideoCaptureImplManager* video_capture_impl_manager() const { |
| 354 return vc_manager_.get(); | 356 return vc_manager_.get(); |
| 355 } | 357 } |
| 356 | 358 |
| 357 ChildSharedBitmapManager* shared_bitmap_manager() const { | 359 display_compositor::ChildSharedBitmapManager* shared_bitmap_manager() const { |
| 358 DCHECK(shared_bitmap_manager_); | 360 DCHECK(shared_bitmap_manager_); |
| 359 return shared_bitmap_manager_.get(); | 361 return shared_bitmap_manager_.get(); |
| 360 } | 362 } |
| 361 | 363 |
| 362 mojom::RenderFrameMessageFilter* render_frame_message_filter(); | 364 mojom::RenderFrameMessageFilter* render_frame_message_filter(); |
| 363 mojom::RenderMessageFilter* render_message_filter(); | 365 mojom::RenderMessageFilter* render_message_filter(); |
| 364 const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& | |
| 365 thread_safe_render_message_filter(); | |
| 366 | 366 |
| 367 // Get the GPU channel. Returns NULL if the channel is not established or | 367 // Get the GPU channel. Returns NULL if the channel is not established or |
| 368 // has been lost. | 368 // has been lost. |
| 369 gpu::GpuChannelHost* GetGpuChannel(); | 369 gpu::GpuChannelHost* GetGpuChannel(); |
| 370 | 370 |
| 371 // Returns a SingleThreadTaskRunner instance corresponding to the message loop | 371 // Returns a SingleThreadTaskRunner instance corresponding to the message loop |
| 372 // of the thread on which file operations should be run. Must be called | 372 // of the thread on which file operations should be run. Must be called |
| 373 // on the renderer's main thread. | 373 // on the renderer's main thread. |
| 374 scoped_refptr<base::SingleThreadTaskRunner> GetFileThreadTaskRunner(); | 374 scoped_refptr<base::SingleThreadTaskRunner> GetFileThreadTaskRunner(); |
| 375 | 375 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 // Used for communicating registering AEC dump consumers with the browser and | 619 // Used for communicating registering AEC dump consumers with the browser and |
| 620 // receving AEC dump file handles when AEC dump is enabled. An AEC dump is | 620 // receving AEC dump file handles when AEC dump is enabled. An AEC dump is |
| 621 // diagnostic audio data for WebRTC stored locally when enabled by the user in | 621 // diagnostic audio data for WebRTC stored locally when enabled by the user in |
| 622 // chrome://webrtc-internals. | 622 // chrome://webrtc-internals. |
| 623 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; | 623 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; |
| 624 #endif | 624 #endif |
| 625 | 625 |
| 626 // Used on the render thread. | 626 // Used on the render thread. |
| 627 std::unique_ptr<VideoCaptureImplManager> vc_manager_; | 627 std::unique_ptr<VideoCaptureImplManager> vc_manager_; |
| 628 | 628 |
| 629 std::unique_ptr<ChildSharedBitmapManager> shared_bitmap_manager_; | 629 std::unique_ptr<display_compositor::ChildSharedBitmapManager> |
| 630 shared_bitmap_manager_; |
| 630 | 631 |
| 631 // The count of RenderWidgets running through this thread. | 632 // The count of RenderWidgets running through this thread. |
| 632 int widget_count_; | 633 int widget_count_; |
| 633 | 634 |
| 634 // The count of hidden RenderWidgets running through this thread. | 635 // The count of hidden RenderWidgets running through this thread. |
| 635 int hidden_widget_count_; | 636 int hidden_widget_count_; |
| 636 | 637 |
| 637 // The current value of the idle notification timer delay. | 638 // The current value of the idle notification timer delay. |
| 638 int64_t idle_notification_delay_in_ms_; | 639 int64_t idle_notification_delay_in_ms_; |
| 639 | 640 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 PendingFrameCreateMap pending_frame_creates_; | 756 PendingFrameCreateMap pending_frame_creates_; |
| 756 | 757 |
| 757 mojom::StoragePartitionServicePtr storage_partition_service_; | 758 mojom::StoragePartitionServicePtr storage_partition_service_; |
| 758 | 759 |
| 759 AssociatedInterfaceRegistryImpl associated_interfaces_; | 760 AssociatedInterfaceRegistryImpl associated_interfaces_; |
| 760 | 761 |
| 761 mojo::AssociatedBinding<mojom::Renderer> renderer_binding_; | 762 mojo::AssociatedBinding<mojom::Renderer> renderer_binding_; |
| 762 | 763 |
| 763 mojom::RenderFrameMessageFilterAssociatedPtr render_frame_message_filter_; | 764 mojom::RenderFrameMessageFilterAssociatedPtr render_frame_message_filter_; |
| 764 mojom::RenderMessageFilterAssociatedPtr render_message_filter_; | 765 mojom::RenderMessageFilterAssociatedPtr render_message_filter_; |
| 765 scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr> | 766 scoped_refptr< |
| 766 thread_safe_render_message_filter_; | 767 display_compositor::mojom::ThreadSafeSharedBitmapManagerAssociatedPtr> |
| 768 thread_safe_shared_bitmap_manager_ptr_; |
| 767 | 769 |
| 768 base::CancelableClosure record_purge_suspend_metric_closure_; | 770 base::CancelableClosure record_purge_suspend_metric_closure_; |
| 769 RendererMemoryMetrics purge_and_suspend_memory_metrics_; | 771 RendererMemoryMetrics purge_and_suspend_memory_metrics_; |
| 770 base::CancelableClosure record_purge_suspend_growth_metric_closure_; | 772 base::CancelableClosure record_purge_suspend_growth_metric_closure_; |
| 771 bool needs_to_record_first_active_paint_; | 773 bool needs_to_record_first_active_paint_; |
| 772 | 774 |
| 773 int32_t client_id_; | 775 int32_t client_id_; |
| 774 | 776 |
| 775 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 777 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
| 776 }; | 778 }; |
| 777 | 779 |
| 778 #if defined(COMPILER_MSVC) | 780 #if defined(COMPILER_MSVC) |
| 779 #pragma warning(pop) | 781 #pragma warning(pop) |
| 780 #endif | 782 #endif |
| 781 | 783 |
| 782 } // namespace content | 784 } // namespace content |
| 783 | 785 |
| 784 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 786 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| OLD | NEW |