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 19 matching lines...) Expand all Loading... |
30 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
31 #include "content/common/frame.mojom.h" | 31 #include "content/common/frame.mojom.h" |
32 #include "content/common/frame_replication_state.h" | 32 #include "content/common/frame_replication_state.h" |
33 #include "content/common/render_frame_message_filter.mojom.h" | 33 #include "content/common/render_frame_message_filter.mojom.h" |
34 #include "content/common/render_message_filter.mojom.h" | 34 #include "content/common/render_message_filter.mojom.h" |
35 #include "content/common/renderer.mojom.h" | 35 #include "content/common/renderer.mojom.h" |
36 #include "content/common/storage_partition_service.mojom.h" | 36 #include "content/common/storage_partition_service.mojom.h" |
37 #include "content/public/renderer/render_thread.h" | 37 #include "content/public/renderer/render_thread.h" |
38 #include "content/renderer/gpu/compositor_dependencies.h" | 38 #include "content/renderer/gpu/compositor_dependencies.h" |
39 #include "content/renderer/layout_test_dependencies.h" | 39 #include "content/renderer/layout_test_dependencies.h" |
40 #include "device/time_zone_monitor/public/interfaces/time_zone_monitor.mojom.h" | |
41 #include "gpu/ipc/client/gpu_channel_host.h" | 40 #include "gpu/ipc/client/gpu_channel_host.h" |
42 #include "mojo/public/cpp/bindings/associated_binding.h" | 41 #include "mojo/public/cpp/bindings/associated_binding.h" |
43 #include "mojo/public/cpp/bindings/binding.h" | 42 #include "mojo/public/cpp/bindings/binding.h" |
44 #include "net/base/network_change_notifier.h" | 43 #include "net/base/network_change_notifier.h" |
45 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 44 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
46 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 45 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
47 #include "third_party/WebKit/public/web/WebMemoryStatistics.h" | 46 #include "third_party/WebKit/public/web/WebMemoryStatistics.h" |
48 #include "ui/gfx/native_widget_types.h" | 47 #include "ui/gfx/native_widget_types.h" |
49 | 48 |
50 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // routed to the RenderThread according to the routing IDs of the messages. | 150 // routed to the RenderThread according to the routing IDs of the messages. |
152 // The routing IDs correspond to RenderView instances. | 151 // The routing IDs correspond to RenderView instances. |
153 class CONTENT_EXPORT RenderThreadImpl | 152 class CONTENT_EXPORT RenderThreadImpl |
154 : public RenderThread, | 153 : public RenderThread, |
155 public ChildThreadImpl, | 154 public ChildThreadImpl, |
156 public gpu::GpuChannelHostFactory, | 155 public gpu::GpuChannelHostFactory, |
157 public blink::scheduler::RendererScheduler::RAILModeObserver, | 156 public blink::scheduler::RendererScheduler::RAILModeObserver, |
158 public ChildMemoryCoordinatorDelegate, | 157 public ChildMemoryCoordinatorDelegate, |
159 public base::MemoryCoordinatorClient, | 158 public base::MemoryCoordinatorClient, |
160 NON_EXPORTED_BASE(public mojom::Renderer), | 159 NON_EXPORTED_BASE(public mojom::Renderer), |
161 // TODO(blundell): Separate this impl out into Blink. | |
162 NON_EXPORTED_BASE(public device::mojom::TimeZoneMonitorClient), | |
163 NON_EXPORTED_BASE(public CompositorDependencies) { | 160 NON_EXPORTED_BASE(public CompositorDependencies) { |
164 public: | 161 public: |
165 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 162 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
166 static RenderThreadImpl* Create( | 163 static RenderThreadImpl* Create( |
167 std::unique_ptr<base::MessageLoop> main_message_loop, | 164 std::unique_ptr<base::MessageLoop> main_message_loop, |
168 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); | 165 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); |
169 static RenderThreadImpl* current(); | 166 static RenderThreadImpl* current(); |
170 static mojom::RenderMessageFilter* current_render_message_filter(); | 167 static mojom::RenderMessageFilter* current_render_message_filter(); |
171 | 168 |
172 static void SetRenderMessageFilterForTesting( | 169 static void SetRenderMessageFilterForTesting( |
173 mojom::RenderMessageFilter* render_message_filter); | 170 mojom::RenderMessageFilter* render_message_filter); |
174 | 171 |
175 ~RenderThreadImpl() override; | 172 ~RenderThreadImpl() override; |
176 void Shutdown() override; | 173 void Shutdown() override; |
177 | 174 |
178 // When initializing WebKit, ensure that any schemes needed for the content | 175 // When initializing WebKit, ensure that any schemes needed for the content |
179 // module are registered properly. Static to allow sharing with tests. | 176 // module are registered properly. Static to allow sharing with tests. |
180 static void RegisterSchemes(); | 177 static void RegisterSchemes(); |
181 | 178 |
182 // Notify V8 that the date/time configuration of the system might have | |
183 // changed. | |
184 static void NotifyTimezoneChange(); | |
185 | |
186 // RenderThread implementation: | 179 // RenderThread implementation: |
187 bool Send(IPC::Message* msg) override; | 180 bool Send(IPC::Message* msg) override; |
188 IPC::SyncChannel* GetChannel() override; | 181 IPC::SyncChannel* GetChannel() override; |
189 std::string GetLocale() override; | 182 std::string GetLocale() override; |
190 IPC::SyncMessageFilter* GetSyncMessageFilter() override; | 183 IPC::SyncMessageFilter* GetSyncMessageFilter() override; |
191 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override; | 184 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override; |
192 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; | 185 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; |
193 void RemoveRoute(int32_t routing_id) override; | 186 void RemoveRoute(int32_t routing_id) override; |
194 int GenerateRoutingID() override; | 187 int GenerateRoutingID() override; |
195 void AddFilter(IPC::MessageFilter* filter) override; | 188 void AddFilter(IPC::MessageFilter* filter) override; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 net::NetworkChangeNotifier::ConnectionType type, | 516 net::NetworkChangeNotifier::ConnectionType type, |
524 double max_bandwidth_mbps) override; | 517 double max_bandwidth_mbps) override; |
525 void SetWebKitSharedTimersSuspended(bool suspend) override; | 518 void SetWebKitSharedTimersSuspended(bool suspend) override; |
526 void UpdateScrollbarTheme( | 519 void UpdateScrollbarTheme( |
527 mojom::UpdateScrollbarThemeParamsPtr params) override; | 520 mojom::UpdateScrollbarThemeParamsPtr params) override; |
528 void OnSystemColorsChanged(int32_t aqua_color_variant, | 521 void OnSystemColorsChanged(int32_t aqua_color_variant, |
529 const std::string& highlight_text_color, | 522 const std::string& highlight_text_color, |
530 const std::string& highlight_color) override; | 523 const std::string& highlight_color) override; |
531 void PurgePluginListCache(bool reload_pages) override; | 524 void PurgePluginListCache(bool reload_pages) override; |
532 | 525 |
533 // device::mojom::TimeZoneClient: | |
534 void OnTimeZoneChange(const std::string& zoneId) override; | |
535 void OnMemoryPressure( | 526 void OnMemoryPressure( |
536 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); | 527 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
537 | 528 |
538 void OnCreateNewSharedWorker( | 529 void OnCreateNewSharedWorker( |
539 const WorkerProcessMsg_CreateWorker_Params& params); | 530 const WorkerProcessMsg_CreateWorker_Params& params); |
540 bool RendererIsHidden() const; | 531 bool RendererIsHidden() const; |
541 void OnRendererHidden(); | 532 void OnRendererHidden(); |
542 void OnRendererVisible(); | 533 void OnRendererVisible(); |
543 | 534 |
544 void RecordPurgeAndSuspendMetrics() const; | 535 void RecordPurgeAndSuspendMetrics() const; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // Dispatches all P2P sockets. | 577 // Dispatches all P2P sockets. |
587 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; | 578 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; |
588 | 579 |
589 // Used for communicating registering AEC dump consumers with the browser and | 580 // Used for communicating registering AEC dump consumers with the browser and |
590 // receving AEC dump file handles when AEC dump is enabled. An AEC dump is | 581 // receving AEC dump file handles when AEC dump is enabled. An AEC dump is |
591 // diagnostic audio data for WebRTC stored locally when enabled by the user in | 582 // diagnostic audio data for WebRTC stored locally when enabled by the user in |
592 // chrome://webrtc-internals. | 583 // chrome://webrtc-internals. |
593 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; | 584 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; |
594 #endif | 585 #endif |
595 | 586 |
596 mojo::Binding<device::mojom::TimeZoneMonitorClient> | |
597 time_zone_monitor_binding_; | |
598 | |
599 // Used on the render thread. | 587 // Used on the render thread. |
600 std::unique_ptr<VideoCaptureImplManager> vc_manager_; | 588 std::unique_ptr<VideoCaptureImplManager> vc_manager_; |
601 | 589 |
602 // The count of RenderWidgets running through this thread. | 590 // The count of RenderWidgets running through this thread. |
603 int widget_count_; | 591 int widget_count_; |
604 | 592 |
605 // The count of hidden RenderWidgets running through this thread. | 593 // The count of hidden RenderWidgets running through this thread. |
606 int hidden_widget_count_; | 594 int hidden_widget_count_; |
607 | 595 |
608 // The current value of the idle notification timer delay. | 596 // The current value of the idle notification timer delay. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 734 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
747 }; | 735 }; |
748 | 736 |
749 #if defined(COMPILER_MSVC) | 737 #if defined(COMPILER_MSVC) |
750 #pragma warning(pop) | 738 #pragma warning(pop) |
751 #endif | 739 #endif |
752 | 740 |
753 } // namespace content | 741 } // namespace content |
754 | 742 |
755 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 743 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |