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 <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/cancelable_callback.h" | 15 #include "base/cancelable_callback.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/memory_pressure_listener.h" | 17 #include "base/memory/memory_pressure_listener.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/metrics/user_metrics_action.h" | 19 #include "base/metrics/user_metrics_action.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
23 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "content/child/child_thread_impl.h" | 25 #include "content/child/child_thread_impl.h" |
26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
27 #include "content/common/frame_replication_state.h" | 27 #include "content/common/frame_replication_state.h" |
28 #include "content/common/gpu/client/gpu_channel_host.h" | |
29 #include "content/common/gpu_process_launch_causes.h" | 28 #include "content/common/gpu_process_launch_causes.h" |
30 #include "content/common/storage_partition_service.mojom.h" | 29 #include "content/common/storage_partition_service.mojom.h" |
31 #include "content/public/renderer/render_thread.h" | 30 #include "content/public/renderer/render_thread.h" |
32 #include "content/renderer/gpu/compositor_dependencies.h" | 31 #include "content/renderer/gpu/compositor_dependencies.h" |
| 32 #include "gpu/ipc/client/gpu_channel_host.h" |
33 #include "net/base/network_change_notifier.h" | 33 #include "net/base/network_change_notifier.h" |
34 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 34 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
35 #include "ui/gfx/native_widget_types.h" | 35 #include "ui/gfx/native_widget_types.h" |
36 | 36 |
37 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
38 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" | 38 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" |
39 #endif | 39 #endif |
40 | 40 |
41 class GrContext; | 41 class GrContext; |
42 class SkBitmap; | 42 class SkBitmap; |
(...skipping 17 matching lines...) Expand all Loading... |
60 namespace cc { | 60 namespace cc { |
61 class ContextProvider; | 61 class ContextProvider; |
62 class ImageSerializationProcessor; | 62 class ImageSerializationProcessor; |
63 class TaskGraphRunner; | 63 class TaskGraphRunner; |
64 } | 64 } |
65 | 65 |
66 namespace cc_blink { | 66 namespace cc_blink { |
67 class ContextProviderWebContext; | 67 class ContextProviderWebContext; |
68 } | 68 } |
69 | 69 |
| 70 namespace gpu { |
| 71 class GpuChannelHost; |
| 72 } |
| 73 |
70 namespace IPC { | 74 namespace IPC { |
71 class MessageFilter; | 75 class MessageFilter; |
72 } | 76 } |
73 | 77 |
74 namespace media { | 78 namespace media { |
75 class AudioHardwareConfig; | 79 class AudioHardwareConfig; |
76 class GpuVideoAcceleratorFactories; | 80 class GpuVideoAcceleratorFactories; |
77 } | 81 } |
78 | 82 |
79 namespace scheduler { | 83 namespace scheduler { |
(...skipping 15 matching lines...) Expand all Loading... |
95 class BlobMessageFilter; | 99 class BlobMessageFilter; |
96 class BluetoothMessageFilter; | 100 class BluetoothMessageFilter; |
97 class BrowserPluginManager; | 101 class BrowserPluginManager; |
98 class CacheStorageDispatcher; | 102 class CacheStorageDispatcher; |
99 class CompositorForwardingMessageFilter; | 103 class CompositorForwardingMessageFilter; |
100 class ContextProviderCommandBuffer; | 104 class ContextProviderCommandBuffer; |
101 class DBMessageFilter; | 105 class DBMessageFilter; |
102 class DevToolsAgentFilter; | 106 class DevToolsAgentFilter; |
103 class DomStorageDispatcher; | 107 class DomStorageDispatcher; |
104 class EmbeddedWorkerDispatcher; | 108 class EmbeddedWorkerDispatcher; |
105 class GpuChannelHost; | |
106 class IndexedDBDispatcher; | 109 class IndexedDBDispatcher; |
107 class InputHandlerManager; | 110 class InputHandlerManager; |
108 class MediaStreamCenter; | 111 class MediaStreamCenter; |
109 class MemoryObserver; | 112 class MemoryObserver; |
110 class MidiMessageFilter; | 113 class MidiMessageFilter; |
111 class NetInfoDispatcher; | 114 class NetInfoDispatcher; |
112 class P2PSocketDispatcher; | 115 class P2PSocketDispatcher; |
113 class PeerConnectionDependencyFactory; | 116 class PeerConnectionDependencyFactory; |
114 class PeerConnectionTracker; | 117 class PeerConnectionTracker; |
115 class RasterWorkerPool; | 118 class RasterWorkerPool; |
(...skipping 23 matching lines...) Expand all Loading... |
139 // consumer to talk indirectly to the RenderViews and supporting objects. | 142 // consumer to talk indirectly to the RenderViews and supporting objects. |
140 // Likewise, it provides an API for the RenderViews to talk back to the main | 143 // Likewise, it provides an API for the RenderViews to talk back to the main |
141 // process (i.e., their corresponding WebContentsImpl). | 144 // process (i.e., their corresponding WebContentsImpl). |
142 // | 145 // |
143 // Most of the communication occurs in the form of IPC messages. They are | 146 // Most of the communication occurs in the form of IPC messages. They are |
144 // routed to the RenderThread according to the routing IDs of the messages. | 147 // routed to the RenderThread according to the routing IDs of the messages. |
145 // The routing IDs correspond to RenderView instances. | 148 // The routing IDs correspond to RenderView instances. |
146 class CONTENT_EXPORT RenderThreadImpl | 149 class CONTENT_EXPORT RenderThreadImpl |
147 : public RenderThread, | 150 : public RenderThread, |
148 public ChildThreadImpl, | 151 public ChildThreadImpl, |
149 public GpuChannelHostFactory, | 152 public gpu::GpuChannelHostFactory, |
150 NON_EXPORTED_BASE(public CompositorDependencies) { | 153 NON_EXPORTED_BASE(public CompositorDependencies) { |
151 public: | 154 public: |
152 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 155 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
153 static RenderThreadImpl* Create( | 156 static RenderThreadImpl* Create( |
154 scoped_ptr<base::MessageLoop> main_message_loop, | 157 scoped_ptr<base::MessageLoop> main_message_loop, |
155 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler); | 158 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler); |
156 static RenderThreadImpl* current(); | 159 static RenderThreadImpl* current(); |
157 | 160 |
158 ~RenderThreadImpl() override; | 161 ~RenderThreadImpl() override; |
159 void Shutdown() override; | 162 void Shutdown() override; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 int routing_id) override; | 221 int routing_id) override; |
219 cc::ImageSerializationProcessor* GetImageSerializationProcessor() override; | 222 cc::ImageSerializationProcessor* GetImageSerializationProcessor() override; |
220 cc::TaskGraphRunner* GetTaskGraphRunner() override; | 223 cc::TaskGraphRunner* GetTaskGraphRunner() override; |
221 bool AreImageDecodeTasksEnabled() override; | 224 bool AreImageDecodeTasksEnabled() override; |
222 bool IsThreadedAnimationEnabled() override; | 225 bool IsThreadedAnimationEnabled() override; |
223 | 226 |
224 // Synchronously establish a channel to the GPU plugin if not previously | 227 // Synchronously establish a channel to the GPU plugin if not previously |
225 // established or if it has been lost (for example if the GPU plugin crashed). | 228 // established or if it has been lost (for example if the GPU plugin crashed). |
226 // If there is a pending asynchronous request, it will be completed by the | 229 // If there is a pending asynchronous request, it will be completed by the |
227 // time this routine returns. | 230 // time this routine returns. |
228 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch); | 231 gpu::GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch); |
229 | |
230 | 232 |
231 // This method modifies how the next message is sent. Normally, when sending | 233 // This method modifies how the next message is sent. Normally, when sending |
232 // a synchronous message that runs a nested message loop, we need to suspend | 234 // a synchronous message that runs a nested message loop, we need to suspend |
233 // callbacks into WebKit. This involves disabling timers and deferring | 235 // callbacks into WebKit. This involves disabling timers and deferring |
234 // resource loads. However, there are exceptions when we need to customize | 236 // resource loads. However, there are exceptions when we need to customize |
235 // the behavior. | 237 // the behavior. |
236 void DoNotNotifyWebKitOfModalLoop(); | 238 void DoNotNotifyWebKitOfModalLoop(); |
237 | 239 |
238 // True if we are running layout tests. This currently disables forwarding | 240 // True if we are running layout tests. This currently disables forwarding |
239 // various status messages to the console, skips network error pages, and | 241 // various status messages to the console, skips network error pages, and |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return p2p_socket_dispatcher_.get(); | 327 return p2p_socket_dispatcher_.get(); |
326 } | 328 } |
327 #endif | 329 #endif |
328 | 330 |
329 VideoCaptureImplManager* video_capture_impl_manager() const { | 331 VideoCaptureImplManager* video_capture_impl_manager() const { |
330 return vc_manager_.get(); | 332 return vc_manager_.get(); |
331 } | 333 } |
332 | 334 |
333 // Get the GPU channel. Returns NULL if the channel is not established or | 335 // Get the GPU channel. Returns NULL if the channel is not established or |
334 // has been lost. | 336 // has been lost. |
335 GpuChannelHost* GetGpuChannel(); | 337 gpu::GpuChannelHost* GetGpuChannel(); |
336 | 338 |
337 // Returns a SingleThreadTaskRunner instance corresponding to the message loop | 339 // Returns a SingleThreadTaskRunner instance corresponding to the message loop |
338 // of the thread on which file operations should be run. Must be called | 340 // of the thread on which file operations should be run. Must be called |
339 // on the renderer's main thread. | 341 // on the renderer's main thread. |
340 scoped_refptr<base::SingleThreadTaskRunner> GetFileThreadMessageLoopProxy(); | 342 scoped_refptr<base::SingleThreadTaskRunner> GetFileThreadMessageLoopProxy(); |
341 | 343 |
342 // Returns a SingleThreadTaskRunner instance corresponding to the message loop | 344 // Returns a SingleThreadTaskRunner instance corresponding to the message loop |
343 // of the thread on which media operations should be run. Must be called | 345 // of the thread on which media operations should be run. Must be called |
344 // on the renderer's main thread. | 346 // on the renderer's main thread. |
345 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); | 347 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 bool notify_webkit_of_modal_loop_; | 589 bool notify_webkit_of_modal_loop_; |
588 bool webkit_shared_timer_suspended_; | 590 bool webkit_shared_timer_suspended_; |
589 | 591 |
590 // The following flag is used to control layout test specific behavior. | 592 // The following flag is used to control layout test specific behavior. |
591 bool layout_test_mode_; | 593 bool layout_test_mode_; |
592 | 594 |
593 // Timer that periodically calls IdleHandler. | 595 // Timer that periodically calls IdleHandler. |
594 base::RepeatingTimer idle_timer_; | 596 base::RepeatingTimer idle_timer_; |
595 | 597 |
596 // The channel from the renderer process to the GPU process. | 598 // The channel from the renderer process to the GPU process. |
597 scoped_refptr<GpuChannelHost> gpu_channel_; | 599 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
598 | 600 |
599 // Cache of variables that are needed on the compositor thread by | 601 // Cache of variables that are needed on the compositor thread by |
600 // GpuChannelHostFactory methods. | 602 // GpuChannelHostFactory methods. |
601 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | 603 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
602 | 604 |
603 // The message loop of the renderer main thread. | 605 // The message loop of the renderer main thread. |
604 // This message loop should be destructed before the RenderThreadImpl | 606 // This message loop should be destructed before the RenderThreadImpl |
605 // shuts down Blink. | 607 // shuts down Blink. |
606 scoped_ptr<base::MessageLoop> main_message_loop_; | 608 scoped_ptr<base::MessageLoop> main_message_loop_; |
607 | 609 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 717 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
716 }; | 718 }; |
717 | 719 |
718 #if defined(COMPILER_MSVC) | 720 #if defined(COMPILER_MSVC) |
719 #pragma warning(pop) | 721 #pragma warning(pop) |
720 #endif | 722 #endif |
721 | 723 |
722 } // namespace content | 724 } // namespace content |
723 | 725 |
724 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 726 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |