| 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 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 namespace content { | 102 namespace content { |
| 103 | 103 |
| 104 class AppCacheDispatcher; | 104 class AppCacheDispatcher; |
| 105 class AecDumpMessageFilter; | 105 class AecDumpMessageFilter; |
| 106 class AudioInputMessageFilter; | 106 class AudioInputMessageFilter; |
| 107 class AudioMessageFilter; | 107 class AudioMessageFilter; |
| 108 class AudioRendererMixerManager; | 108 class AudioRendererMixerManager; |
| 109 class BlobMessageFilter; | 109 class BlobMessageFilter; |
| 110 class BrowserPluginManager; | 110 class BrowserPluginManager; |
| 111 class CacheStorageDispatcher; | 111 class CacheStorageDispatcher; |
| 112 class ChildGpuMemoryBufferManager; | |
| 113 class ChildSharedBitmapManager; | 112 class ChildSharedBitmapManager; |
| 114 class CompositorForwardingMessageFilter; | 113 class CompositorForwardingMessageFilter; |
| 115 class ContextProviderCommandBuffer; | 114 class ContextProviderCommandBuffer; |
| 116 class DBMessageFilter; | 115 class DBMessageFilter; |
| 117 class DevToolsAgentFilter; | 116 class DevToolsAgentFilter; |
| 118 class DomStorageDispatcher; | 117 class DomStorageDispatcher; |
| 119 class EmbeddedWorkerDispatcher; | 118 class EmbeddedWorkerDispatcher; |
| 120 class FrameSwapMessageQueue; | 119 class FrameSwapMessageQueue; |
| 121 class IndexedDBDispatcher; | 120 class IndexedDBDispatcher; |
| 122 class InputHandlerManager; | 121 class InputHandlerManager; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 149 // consumer to talk indirectly to the RenderViews and supporting objects. | 148 // consumer to talk indirectly to the RenderViews and supporting objects. |
| 150 // Likewise, it provides an API for the RenderViews to talk back to the main | 149 // Likewise, it provides an API for the RenderViews to talk back to the main |
| 151 // process (i.e., their corresponding WebContentsImpl). | 150 // process (i.e., their corresponding WebContentsImpl). |
| 152 // | 151 // |
| 153 // Most of the communication occurs in the form of IPC messages. They are | 152 // Most of the communication occurs in the form of IPC messages. They are |
| 154 // routed to the RenderThread according to the routing IDs of the messages. | 153 // routed to the RenderThread according to the routing IDs of the messages. |
| 155 // The routing IDs correspond to RenderView instances. | 154 // The routing IDs correspond to RenderView instances. |
| 156 class CONTENT_EXPORT RenderThreadImpl | 155 class CONTENT_EXPORT RenderThreadImpl |
| 157 : public RenderThread, | 156 : public RenderThread, |
| 158 public ChildThreadImpl, | 157 public ChildThreadImpl, |
| 159 public gpu::GpuChannelHostFactory, | |
| 160 public blink::scheduler::RendererScheduler::RAILModeObserver, | 158 public blink::scheduler::RendererScheduler::RAILModeObserver, |
| 161 public ChildMemoryCoordinatorDelegate, | 159 public ChildMemoryCoordinatorDelegate, |
| 162 public base::MemoryCoordinatorClient, | 160 public base::MemoryCoordinatorClient, |
| 163 NON_EXPORTED_BASE(public mojom::Renderer), | 161 NON_EXPORTED_BASE(public mojom::Renderer), |
| 164 NON_EXPORTED_BASE(public CompositorDependencies) { | 162 NON_EXPORTED_BASE(public CompositorDependencies) { |
| 165 public: | 163 public: |
| 166 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 164 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
| 167 static RenderThreadImpl* Create( | 165 static RenderThreadImpl* Create( |
| 168 std::unique_ptr<base::MessageLoop> main_message_loop, | 166 std::unique_ptr<base::MessageLoop> main_message_loop, |
| 169 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); | 167 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 void OnChannelError() override; | 494 void OnChannelError() override; |
| 497 | 495 |
| 498 // ChildThread | 496 // ChildThread |
| 499 bool OnControlMessageReceived(const IPC::Message& msg) override; | 497 bool OnControlMessageReceived(const IPC::Message& msg) override; |
| 500 void OnProcessBackgrounded(bool backgrounded) override; | 498 void OnProcessBackgrounded(bool backgrounded) override; |
| 501 void OnProcessResume() override; | 499 void OnProcessResume() override; |
| 502 void OnProcessPurgeAndSuspend() override; | 500 void OnProcessPurgeAndSuspend() override; |
| 503 void RecordAction(const base::UserMetricsAction& action) override; | 501 void RecordAction(const base::UserMetricsAction& action) override; |
| 504 void RecordComputedAction(const std::string& action) override; | 502 void RecordComputedAction(const std::string& action) override; |
| 505 | 503 |
| 506 // GpuChannelHostFactory implementation: | 504 bool IsMainThread(); |
| 507 bool IsMainThread() override; | |
| 508 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | |
| 509 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | |
| 510 size_t size) override; | |
| 511 | 505 |
| 512 // Purges memory and suspends the renderer. | 506 // Purges memory and suspends the renderer. |
| 513 void SuspendRenderer(); | 507 void SuspendRenderer(); |
| 514 | 508 |
| 515 // base::MemoryCoordinatorClient implementation: | 509 // base::MemoryCoordinatorClient implementation: |
| 516 void OnMemoryStateChange(base::MemoryState state) override; | 510 void OnMemoryStateChange(base::MemoryState state) override; |
| 517 | 511 |
| 518 void ClearMemory(); | 512 void ClearMemory(); |
| 519 | 513 |
| 520 void Init( | 514 void Init( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 | 628 |
| 635 // Used to control layout test specific behavior. | 629 // Used to control layout test specific behavior. |
| 636 std::unique_ptr<LayoutTestDependencies> layout_test_deps_; | 630 std::unique_ptr<LayoutTestDependencies> layout_test_deps_; |
| 637 | 631 |
| 638 // Timer that periodically calls IdleHandler. | 632 // Timer that periodically calls IdleHandler. |
| 639 base::RepeatingTimer idle_timer_; | 633 base::RepeatingTimer idle_timer_; |
| 640 | 634 |
| 641 // The channel from the renderer process to the GPU process. | 635 // The channel from the renderer process to the GPU process. |
| 642 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | 636 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
| 643 | 637 |
| 644 // Cache of variables that are needed on the compositor thread by | |
| 645 // GpuChannelHostFactory methods. | |
| 646 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | |
| 647 | |
| 648 // The message loop of the renderer main thread. | 638 // The message loop of the renderer main thread. |
| 649 // This message loop should be destructed before the RenderThreadImpl | 639 // This message loop should be destructed before the RenderThreadImpl |
| 650 // shuts down Blink. | 640 // shuts down Blink. |
| 651 std::unique_ptr<base::MessageLoop> main_message_loop_; | 641 std::unique_ptr<base::MessageLoop> main_message_loop_; |
| 652 | 642 |
| 653 // A lazily initiated thread on which file operations are run. | 643 // A lazily initiated thread on which file operations are run. |
| 654 std::unique_ptr<base::Thread> file_thread_; | 644 std::unique_ptr<base::Thread> file_thread_; |
| 655 | 645 |
| 656 // May be null if overridden by ContentRendererClient. | 646 // May be null if overridden by ContentRendererClient. |
| 657 std::unique_ptr<blink::scheduler::WebThreadBase> compositor_thread_; | 647 std::unique_ptr<blink::scheduler::WebThreadBase> compositor_thread_; |
| 658 | 648 |
| 659 std::unique_ptr<ChildGpuMemoryBufferManager> gpu_memory_buffer_manager_; | |
| 660 | |
| 661 // Utility class to provide GPU functionalities to media. | 649 // Utility class to provide GPU functionalities to media. |
| 662 // TODO(dcastagna): This should be just one scoped_ptr once | 650 // TODO(dcastagna): This should be just one scoped_ptr once |
| 663 // http://crbug.com/580386 is fixed. | 651 // http://crbug.com/580386 is fixed. |
| 664 // NOTE(dcastagna): At worst this accumulates a few bytes per context lost. | 652 // NOTE(dcastagna): At worst this accumulates a few bytes per context lost. |
| 665 ScopedVector<content::RendererGpuVideoAcceleratorFactories> gpu_factories_; | 653 ScopedVector<content::RendererGpuVideoAcceleratorFactories> gpu_factories_; |
| 666 | 654 |
| 667 // Thread for running multimedia operations (e.g., video decoding). | 655 // Thread for running multimedia operations (e.g., video decoding). |
| 668 std::unique_ptr<base::Thread> media_thread_; | 656 std::unique_ptr<base::Thread> media_thread_; |
| 669 | 657 |
| 670 // Will point to appropriate task runner after initialization, | 658 // Will point to appropriate task runner after initialization, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 692 | 680 |
| 693 std::unique_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; | 681 std::unique_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; |
| 694 | 682 |
| 695 HistogramCustomizer histogram_customizer_; | 683 HistogramCustomizer histogram_customizer_; |
| 696 | 684 |
| 697 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 685 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 698 | 686 |
| 699 std::unique_ptr<MemoryObserver> memory_observer_; | 687 std::unique_ptr<MemoryObserver> memory_observer_; |
| 700 std::unique_ptr<ChildMemoryCoordinatorImpl> memory_coordinator_; | 688 std::unique_ptr<ChildMemoryCoordinatorImpl> memory_coordinator_; |
| 701 | 689 |
| 702 #if defined(USE_AURA) | |
| 703 std::unique_ptr<ui::Gpu> gpu_; | 690 std::unique_ptr<ui::Gpu> gpu_; |
| 704 #endif | |
| 705 | 691 |
| 706 scoped_refptr<base::SingleThreadTaskRunner> | 692 scoped_refptr<base::SingleThreadTaskRunner> |
| 707 main_thread_compositor_task_runner_; | 693 main_thread_compositor_task_runner_; |
| 708 | 694 |
| 709 // Compositor settings. | 695 // Compositor settings. |
| 710 bool is_gpu_rasterization_enabled_; | 696 bool is_gpu_rasterization_enabled_; |
| 711 bool is_gpu_rasterization_forced_; | 697 bool is_gpu_rasterization_forced_; |
| 712 bool is_async_worker_context_enabled_; | 698 bool is_async_worker_context_enabled_; |
| 713 int gpu_rasterization_msaa_sample_count_; | 699 int gpu_rasterization_msaa_sample_count_; |
| 714 bool is_lcd_text_enabled_; | 700 bool is_lcd_text_enabled_; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 754 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
| 769 }; | 755 }; |
| 770 | 756 |
| 771 #if defined(COMPILER_MSVC) | 757 #if defined(COMPILER_MSVC) |
| 772 #pragma warning(pop) | 758 #pragma warning(pop) |
| 773 #endif | 759 #endif |
| 774 | 760 |
| 775 } // namespace content | 761 } // namespace content |
| 776 | 762 |
| 777 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 763 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| OLD | NEW |