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 15 matching lines...) Expand all Loading... |
26 #include "content/child/child_thread_impl.h" | 26 #include "content/child/child_thread_impl.h" |
27 #include "content/common/content_export.h" | 27 #include "content/common/content_export.h" |
28 #include "content/common/frame.mojom.h" | 28 #include "content/common/frame.mojom.h" |
29 #include "content/common/frame_replication_state.h" | 29 #include "content/common/frame_replication_state.h" |
30 #include "content/common/render_frame_message_filter.mojom.h" | 30 #include "content/common/render_frame_message_filter.mojom.h" |
31 #include "content/common/storage_partition_service.mojom.h" | 31 #include "content/common/storage_partition_service.mojom.h" |
32 #include "content/public/renderer/render_thread.h" | 32 #include "content/public/renderer/render_thread.h" |
33 #include "content/renderer/gpu/compositor_dependencies.h" | 33 #include "content/renderer/gpu/compositor_dependencies.h" |
34 #include "content/renderer/layout_test_dependencies.h" | 34 #include "content/renderer/layout_test_dependencies.h" |
35 #include "gpu/ipc/client/gpu_channel_host.h" | 35 #include "gpu/ipc/client/gpu_channel_host.h" |
| 36 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 37 #include "mojo/public/cpp/bindings/associated_binding_set.h" |
36 #include "net/base/network_change_notifier.h" | 38 #include "net/base/network_change_notifier.h" |
37 #include "third_party/WebKit/public/platform/WebConnectionType.h" | 39 #include "third_party/WebKit/public/platform/WebConnectionType.h" |
38 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 40 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
39 #include "ui/gfx/native_widget_types.h" | 41 #include "ui/gfx/native_widget_types.h" |
40 | 42 |
41 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
42 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" | 44 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" |
43 #endif | 45 #endif |
44 | 46 |
45 class GrContext; | 47 class GrContext; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // | 146 // |
145 // Most of the communication occurs in the form of IPC messages. They are | 147 // Most of the communication occurs in the form of IPC messages. They are |
146 // routed to the RenderThread according to the routing IDs of the messages. | 148 // routed to the RenderThread according to the routing IDs of the messages. |
147 // The routing IDs correspond to RenderView instances. | 149 // The routing IDs correspond to RenderView instances. |
148 class CONTENT_EXPORT RenderThreadImpl | 150 class CONTENT_EXPORT RenderThreadImpl |
149 : public RenderThread, | 151 : public RenderThread, |
150 public ChildThreadImpl, | 152 public ChildThreadImpl, |
151 public gpu::GpuChannelHostFactory, | 153 public gpu::GpuChannelHostFactory, |
152 public blink::scheduler::RendererScheduler::RAILModeObserver, | 154 public blink::scheduler::RendererScheduler::RAILModeObserver, |
153 public memory_coordinator::ChildMemoryCoordinatorDelegate, | 155 public memory_coordinator::ChildMemoryCoordinatorDelegate, |
154 NON_EXPORTED_BASE(public CompositorDependencies) { | 156 NON_EXPORTED_BASE(public CompositorDependencies), |
| 157 NON_EXPORTED_BASE(public mojom::RouteProvider) { |
155 public: | 158 public: |
156 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 159 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
157 static RenderThreadImpl* Create( | 160 static RenderThreadImpl* Create( |
158 std::unique_ptr<base::MessageLoop> main_message_loop, | 161 std::unique_ptr<base::MessageLoop> main_message_loop, |
159 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); | 162 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); |
160 static RenderThreadImpl* current(); | 163 static RenderThreadImpl* current(); |
161 | 164 |
162 ~RenderThreadImpl() override; | 165 ~RenderThreadImpl() override; |
163 void Shutdown() override; | 166 void Shutdown() override; |
164 | 167 |
165 // When initializing WebKit, ensure that any schemes needed for the content | 168 // When initializing WebKit, ensure that any schemes needed for the content |
166 // module are registered properly. Static to allow sharing with tests. | 169 // module are registered properly. Static to allow sharing with tests. |
167 static void RegisterSchemes(); | 170 static void RegisterSchemes(); |
168 | 171 |
169 // Notify V8 that the date/time configuration of the system might have | 172 // Notify V8 that the date/time configuration of the system might have |
170 // changed. | 173 // changed. |
171 static void NotifyTimezoneChange(); | 174 static void NotifyTimezoneChange(); |
172 | 175 |
173 // RenderThread implementation: | 176 // RenderThread implementation: |
174 bool Send(IPC::Message* msg) override; | 177 bool Send(IPC::Message* msg) override; |
175 IPC::SyncChannel* GetChannel() override; | 178 IPC::SyncChannel* GetChannel() override; |
176 std::string GetLocale() override; | 179 std::string GetLocale() override; |
177 IPC::SyncMessageFilter* GetSyncMessageFilter() override; | 180 IPC::SyncMessageFilter* GetSyncMessageFilter() override; |
178 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override; | 181 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override; |
179 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; | 182 void AddRoute(int32_t routing_id, IPC::Listener* listener) override; |
180 void RemoveRoute(int32_t routing_id) override; | 183 void RemoveRoute(int32_t routing_id) override; |
181 int GenerateRoutingID() override; | 184 int GenerateRoutingID() override; |
| 185 void AddRoutedInterfaces(int32_t routing_id, |
| 186 mojom::RoutedInterfaceProvider* provider) override; |
| 187 mojom::RouteProvider* GetRemoteRouteProvider() override; |
182 void AddFilter(IPC::MessageFilter* filter) override; | 188 void AddFilter(IPC::MessageFilter* filter) override; |
183 void RemoveFilter(IPC::MessageFilter* filter) override; | 189 void RemoveFilter(IPC::MessageFilter* filter) override; |
184 void AddObserver(RenderThreadObserver* observer) override; | 190 void AddObserver(RenderThreadObserver* observer) override; |
185 void RemoveObserver(RenderThreadObserver* observer) override; | 191 void RemoveObserver(RenderThreadObserver* observer) override; |
186 void SetResourceDispatcherDelegate( | 192 void SetResourceDispatcherDelegate( |
187 ResourceDispatcherDelegate* delegate) override; | 193 ResourceDispatcherDelegate* delegate) override; |
188 std::unique_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( | 194 std::unique_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( |
189 size_t buffer_size) override; | 195 size_t buffer_size) override; |
190 cc::SharedBitmapManager* GetSharedBitmapManager() override; | 196 cc::SharedBitmapManager* GetSharedBitmapManager() override; |
191 void RegisterExtension(v8::Extension* extension) override; | 197 void RegisterExtension(v8::Extension* extension) override; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 const WorkerProcessMsg_CreateWorker_Params& params); | 526 const WorkerProcessMsg_CreateWorker_Params& params); |
521 bool RendererIsHidden() const; | 527 bool RendererIsHidden() const; |
522 void OnRendererHidden(); | 528 void OnRendererHidden(); |
523 void OnRendererVisible(); | 529 void OnRendererVisible(); |
524 | 530 |
525 void ReleaseFreeMemory(); | 531 void ReleaseFreeMemory(); |
526 | 532 |
527 void OnSyncMemoryPressure( | 533 void OnSyncMemoryPressure( |
528 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); | 534 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
529 | 535 |
| 536 void OnRouteProviderRequest(mojom::RouteProviderAssociatedRequest request); |
| 537 |
| 538 // mojom::RouteProvider: |
| 539 void GetRoutedInterfaces( |
| 540 int32_t routing_id, |
| 541 mojom::RoutedInterfaceProviderAssociatedRequest request) override; |
| 542 |
530 // These objects live solely on the render thread. | 543 // These objects live solely on the render thread. |
531 std::unique_ptr<AppCacheDispatcher> appcache_dispatcher_; | 544 std::unique_ptr<AppCacheDispatcher> appcache_dispatcher_; |
532 std::unique_ptr<DomStorageDispatcher> dom_storage_dispatcher_; | 545 std::unique_ptr<DomStorageDispatcher> dom_storage_dispatcher_; |
533 std::unique_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; | 546 std::unique_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; |
534 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler_; | 547 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler_; |
535 std::unique_ptr<RendererBlinkPlatformImpl> blink_platform_impl_; | 548 std::unique_ptr<RendererBlinkPlatformImpl> blink_platform_impl_; |
536 std::unique_ptr<ResourceDispatchThrottler> resource_dispatch_throttler_; | 549 std::unique_ptr<ResourceDispatchThrottler> resource_dispatch_throttler_; |
537 std::unique_ptr<CacheStorageDispatcher> main_thread_cache_storage_dispatcher_; | 550 std::unique_ptr<CacheStorageDispatcher> main_thread_cache_storage_dispatcher_; |
538 std::unique_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_; | 551 std::unique_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_; |
539 | 552 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 mojom::FrameRequest frame_request_; | 713 mojom::FrameRequest frame_request_; |
701 mojom::FrameHostPtr frame_host_; | 714 mojom::FrameHostPtr frame_host_; |
702 }; | 715 }; |
703 | 716 |
704 using PendingFrameCreateMap = | 717 using PendingFrameCreateMap = |
705 std::map<int, scoped_refptr<PendingFrameCreate>>; | 718 std::map<int, scoped_refptr<PendingFrameCreate>>; |
706 PendingFrameCreateMap pending_frame_creates_; | 719 PendingFrameCreateMap pending_frame_creates_; |
707 | 720 |
708 mojom::StoragePartitionServicePtr storage_partition_service_; | 721 mojom::StoragePartitionServicePtr storage_partition_service_; |
709 | 722 |
| 723 // Registered routed interface providers. These are not owned. |
| 724 std::map<int32_t, mojom::RoutedInterfaceProvider*> |
| 725 routed_interface_providers_; |
| 726 |
| 727 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; |
| 728 mojo::AssociatedBindingSet<mojom::RoutedInterfaceProvider> |
| 729 routed_interface_provider_bindings_; |
| 730 |
| 731 mojom::RouteProviderAssociatedPtr remote_route_provider_; |
710 mojom::RenderFrameMessageFilterAssociatedPtr render_frame_message_filter_; | 732 mojom::RenderFrameMessageFilterAssociatedPtr render_frame_message_filter_; |
711 | 733 |
712 bool is_renderer_suspended_; | 734 bool is_renderer_suspended_; |
713 | 735 |
714 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 736 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
715 }; | 737 }; |
716 | 738 |
717 #if defined(COMPILER_MSVC) | 739 #if defined(COMPILER_MSVC) |
718 #pragma warning(pop) | 740 #pragma warning(pop) |
719 #endif | 741 #endif |
720 | 742 |
721 } // namespace content | 743 } // namespace content |
722 | 744 |
723 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 745 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |