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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // The routing IDs correspond to RenderView instances. | 113 // The routing IDs correspond to RenderView instances. |
114 class CONTENT_EXPORT RenderThreadImpl : public RenderThread, | 114 class CONTENT_EXPORT RenderThreadImpl : public RenderThread, |
115 public ChildThread, | 115 public ChildThread, |
116 public GpuChannelHostFactory { | 116 public GpuChannelHostFactory { |
117 public: | 117 public: |
118 static RenderThreadImpl* current(); | 118 static RenderThreadImpl* current(); |
119 | 119 |
120 RenderThreadImpl(); | 120 RenderThreadImpl(); |
121 // Constructor that's used when running in single process mode. | 121 // Constructor that's used when running in single process mode. |
122 explicit RenderThreadImpl(const std::string& channel_name); | 122 explicit RenderThreadImpl(const std::string& channel_name); |
123 virtual ~RenderThreadImpl(); | 123 ~RenderThreadImpl() override; |
124 virtual void Shutdown() override; | 124 void Shutdown() override; |
125 | 125 |
126 // When initializing WebKit, ensure that any schemes needed for the content | 126 // When initializing WebKit, ensure that any schemes needed for the content |
127 // module are registered properly. Static to allow sharing with tests. | 127 // module are registered properly. Static to allow sharing with tests. |
128 static void RegisterSchemes(); | 128 static void RegisterSchemes(); |
129 | 129 |
130 // Notify V8 that the date/time configuration of the system might have | 130 // Notify V8 that the date/time configuration of the system might have |
131 // changed. | 131 // changed. |
132 static void NotifyTimezoneChange(); | 132 static void NotifyTimezoneChange(); |
133 | 133 |
134 // RenderThread implementation: | 134 // RenderThread implementation: |
135 virtual bool Send(IPC::Message* msg) override; | 135 bool Send(IPC::Message* msg) override; |
136 virtual base::MessageLoop* GetMessageLoop() override; | 136 base::MessageLoop* GetMessageLoop() override; |
137 virtual IPC::SyncChannel* GetChannel() override; | 137 IPC::SyncChannel* GetChannel() override; |
138 virtual std::string GetLocale() override; | 138 std::string GetLocale() override; |
139 virtual IPC::SyncMessageFilter* GetSyncMessageFilter() override; | 139 IPC::SyncMessageFilter* GetSyncMessageFilter() override; |
140 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() | 140 scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() override; |
141 override; | 141 void AddRoute(int32 routing_id, IPC::Listener* listener) override; |
142 virtual void AddRoute(int32 routing_id, IPC::Listener* listener) override; | 142 void RemoveRoute(int32 routing_id) override; |
143 virtual void RemoveRoute(int32 routing_id) override; | 143 int GenerateRoutingID() override; |
144 virtual int GenerateRoutingID() override; | 144 void AddFilter(IPC::MessageFilter* filter) override; |
145 virtual void AddFilter(IPC::MessageFilter* filter) override; | 145 void RemoveFilter(IPC::MessageFilter* filter) override; |
146 virtual void RemoveFilter(IPC::MessageFilter* filter) override; | 146 void AddObserver(RenderProcessObserver* observer) override; |
147 virtual void AddObserver(RenderProcessObserver* observer) override; | 147 void RemoveObserver(RenderProcessObserver* observer) override; |
148 virtual void RemoveObserver(RenderProcessObserver* observer) override; | 148 void SetResourceDispatcherDelegate( |
149 virtual void SetResourceDispatcherDelegate( | |
150 ResourceDispatcherDelegate* delegate) override; | 149 ResourceDispatcherDelegate* delegate) override; |
151 virtual void EnsureWebKitInitialized() override; | 150 void EnsureWebKitInitialized() override; |
152 virtual void RecordAction(const base::UserMetricsAction& action) override; | 151 void RecordAction(const base::UserMetricsAction& action) override; |
153 virtual void RecordComputedAction(const std::string& action) override; | 152 void RecordComputedAction(const std::string& action) override; |
154 virtual scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( | 153 scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( |
155 size_t buffer_size) override; | 154 size_t buffer_size) override; |
156 virtual void RegisterExtension(v8::Extension* extension) override; | 155 void RegisterExtension(v8::Extension* extension) override; |
157 virtual void ScheduleIdleHandler(int64 initial_delay_ms) override; | 156 void ScheduleIdleHandler(int64 initial_delay_ms) override; |
158 virtual void IdleHandler() override; | 157 void IdleHandler() override; |
159 virtual int64 GetIdleNotificationDelayInMs() const override; | 158 int64 GetIdleNotificationDelayInMs() const override; |
160 virtual void SetIdleNotificationDelayInMs( | 159 void SetIdleNotificationDelayInMs( |
161 int64 idle_notification_delay_in_ms) override; | 160 int64 idle_notification_delay_in_ms) override; |
162 virtual void UpdateHistograms(int sequence_number) override; | 161 void UpdateHistograms(int sequence_number) override; |
163 virtual int PostTaskToAllWebWorkers(const base::Closure& closure) override; | 162 int PostTaskToAllWebWorkers(const base::Closure& closure) override; |
164 virtual bool ResolveProxy(const GURL& url, std::string* proxy_list) override; | 163 bool ResolveProxy(const GURL& url, std::string* proxy_list) override; |
165 virtual base::WaitableEvent* GetShutdownEvent() override; | 164 base::WaitableEvent* GetShutdownEvent() override; |
166 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
167 virtual void PreCacheFont(const LOGFONT& log_font) override; | 166 virtual void PreCacheFont(const LOGFONT& log_font) override; |
168 virtual void ReleaseCachedFonts() override; | 167 virtual void ReleaseCachedFonts() override; |
169 #endif | 168 #endif |
170 virtual ServiceRegistry* GetServiceRegistry() override; | 169 ServiceRegistry* GetServiceRegistry() override; |
171 | 170 |
172 // Synchronously establish a channel to the GPU plugin if not previously | 171 // Synchronously establish a channel to the GPU plugin if not previously |
173 // established or if it has been lost (for example if the GPU plugin crashed). | 172 // established or if it has been lost (for example if the GPU plugin crashed). |
174 // If there is a pending asynchronous request, it will be completed by the | 173 // If there is a pending asynchronous request, it will be completed by the |
175 // time this routine returns. | 174 // time this routine returns. |
176 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch); | 175 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch); |
177 | 176 |
178 | 177 |
179 // These methods modify how the next message is sent. Normally, when sending | 178 // These methods modify how the next message is sent. Normally, when sending |
180 // a synchronous message that runs a nested message loop, we need to suspend | 179 // a synchronous message that runs a nested message loop, we need to suspend |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 void WidgetRestored(); | 393 void WidgetRestored(); |
395 | 394 |
396 void AddEmbeddedWorkerRoute(int32 routing_id, IPC::Listener* listener); | 395 void AddEmbeddedWorkerRoute(int32 routing_id, IPC::Listener* listener); |
397 void RemoveEmbeddedWorkerRoute(int32 routing_id); | 396 void RemoveEmbeddedWorkerRoute(int32 routing_id); |
398 | 397 |
399 void RegisterPendingRenderFrameConnect(int routing_id, | 398 void RegisterPendingRenderFrameConnect(int routing_id, |
400 mojo::ScopedMessagePipeHandle handle); | 399 mojo::ScopedMessagePipeHandle handle); |
401 | 400 |
402 private: | 401 private: |
403 // ChildThread | 402 // ChildThread |
404 virtual bool OnControlMessageReceived(const IPC::Message& msg) override; | 403 bool OnControlMessageReceived(const IPC::Message& msg) override; |
405 | 404 |
406 // GpuChannelHostFactory implementation: | 405 // GpuChannelHostFactory implementation: |
407 virtual bool IsMainThread() override; | 406 bool IsMainThread() override; |
408 virtual base::MessageLoop* GetMainLoop() override; | 407 base::MessageLoop* GetMainLoop() override; |
409 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() override; | 408 scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() override; |
410 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( | 409 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override; |
411 size_t size) override; | 410 CreateCommandBufferResult CreateViewCommandBuffer( |
412 virtual CreateCommandBufferResult CreateViewCommandBuffer( | |
413 int32 surface_id, | 411 int32 surface_id, |
414 const GPUCreateCommandBufferConfig& init_params, | 412 const GPUCreateCommandBufferConfig& init_params, |
415 int32 route_id) override; | 413 int32 route_id) override; |
416 | 414 |
417 void Init(); | 415 void Init(); |
418 | 416 |
419 void OnCreateNewFrame(int routing_id, int parent_routing_id); | 417 void OnCreateNewFrame(int routing_id, int parent_routing_id); |
420 void OnCreateNewFrameProxy(int routing_id, | 418 void OnCreateNewFrameProxy(int routing_id, |
421 int parent_routing_id, | 419 int parent_routing_id, |
422 int render_view_routing_id); | 420 int render_view_routing_id); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 bool is_one_copy_enabled_; | 567 bool is_one_copy_enabled_; |
570 | 568 |
571 std::map<int, mojo::MessagePipeHandle> pending_render_frame_connects_; | 569 std::map<int, mojo::MessagePipeHandle> pending_render_frame_connects_; |
572 | 570 |
573 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 571 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
574 }; | 572 }; |
575 | 573 |
576 } // namespace content | 574 } // namespace content |
577 | 575 |
578 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 576 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |