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> |
11 | 11 |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/timer.h" | 14 #include "base/timer.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/child/child_process.h" | |
17 #include "content/child/child_thread.h" | 16 #include "content/child/child_thread.h" |
18 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
19 #include "content/common/gpu/client/gpu_channel_host.h" | 18 #include "content/common/gpu/client/gpu_channel_host.h" |
20 #include "content/common/gpu/gpu_process_launch_causes.h" | 19 #include "content/common/gpu/gpu_process_launch_causes.h" |
21 #include "content/public/renderer/render_thread.h" | 20 #include "content/public/renderer/render_thread.h" |
22 #include "ipc/ipc_channel_proxy.h" | 21 #include "ipc/ipc_channel_proxy.h" |
23 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
24 | 23 |
25 class GrContext; | 24 class GrContext; |
26 class SkBitmap; | 25 class SkBitmap; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 int64 idle_notification_delay_in_ms) OVERRIDE; | 147 int64 idle_notification_delay_in_ms) OVERRIDE; |
149 virtual void ToggleWebKitSharedTimer(bool suspend) OVERRIDE; | 148 virtual void ToggleWebKitSharedTimer(bool suspend) OVERRIDE; |
150 virtual void UpdateHistograms(int sequence_number) OVERRIDE; | 149 virtual void UpdateHistograms(int sequence_number) OVERRIDE; |
151 virtual int PostTaskToAllWebWorkers(const base::Closure& closure) OVERRIDE; | 150 virtual int PostTaskToAllWebWorkers(const base::Closure& closure) OVERRIDE; |
152 virtual bool ResolveProxy(const GURL& url, std::string* proxy_list) OVERRIDE; | 151 virtual bool ResolveProxy(const GURL& url, std::string* proxy_list) OVERRIDE; |
153 #if defined(OS_WIN) | 152 #if defined(OS_WIN) |
154 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE; | 153 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE; |
155 virtual void ReleaseCachedFonts() OVERRIDE; | 154 virtual void ReleaseCachedFonts() OVERRIDE; |
156 #endif | 155 #endif |
157 | 156 |
158 // ChildThread: | |
159 virtual bool IsWebFrameValid(WebKit::WebFrame* frame) OVERRIDE; | |
160 | |
161 // GpuChannelHostFactory implementation: | |
162 virtual bool IsMainThread() OVERRIDE; | |
163 virtual base::MessageLoop* GetMainLoop() OVERRIDE; | |
164 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE; | |
165 virtual base::WaitableEvent* GetShutDownEvent() OVERRIDE; | |
166 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( | |
167 size_t size) OVERRIDE; | |
168 virtual int32 CreateViewCommandBuffer( | |
169 int32 surface_id, | |
170 const GPUCreateCommandBufferConfig& init_params) OVERRIDE; | |
171 virtual void CreateImage( | |
172 gfx::PluginWindowHandle window, | |
173 int32 image_id, | |
174 const CreateImageCallback& callback) OVERRIDE; | |
175 virtual void DeleteImage(int32 image_id, int32 sync_point) OVERRIDE; | |
176 | |
177 // Synchronously establish a channel to the GPU plugin if not previously | 157 // Synchronously establish a channel to the GPU plugin if not previously |
178 // established or if it has been lost (for example if the GPU plugin crashed). | 158 // established or if it has been lost (for example if the GPU plugin crashed). |
179 // If there is a pending asynchronous request, it will be completed by the | 159 // If there is a pending asynchronous request, it will be completed by the |
180 // time this routine returns. | 160 // time this routine returns. |
181 virtual GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch) OVERRIDE; | 161 virtual GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch) OVERRIDE; |
182 | 162 |
183 | 163 |
184 // These methods modify how the next message is sent. Normally, when sending | 164 // These methods modify how the next message is sent. Normally, when sending |
185 // a synchronous message that runs a nested message loop, we need to suspend | 165 // a synchronous message that runs a nested message loop, we need to suspend |
186 // callbacks into WebKit. This involves disabling timers and deferring | 166 // callbacks into WebKit. This involves disabling timers and deferring |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 }; | 324 }; |
345 | 325 |
346 HistogramCustomizer* histogram_customizer() { | 326 HistogramCustomizer* histogram_customizer() { |
347 return &histogram_customizer_; | 327 return &histogram_customizer_; |
348 } | 328 } |
349 | 329 |
350 void SetFlingCurveParameters(const std::vector<float>& new_touchpad, | 330 void SetFlingCurveParameters(const std::vector<float>& new_touchpad, |
351 const std::vector<float>& new_touchscreen); | 331 const std::vector<float>& new_touchscreen); |
352 | 332 |
353 private: | 333 private: |
| 334 // ChildThread |
354 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; | 335 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; |
355 | 336 |
| 337 // GpuChannelHostFactory implementation: |
| 338 virtual bool IsMainThread() OVERRIDE; |
| 339 virtual base::MessageLoop* GetMainLoop() OVERRIDE; |
| 340 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE; |
| 341 virtual base::WaitableEvent* GetShutDownEvent() OVERRIDE; |
| 342 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( |
| 343 size_t size) OVERRIDE; |
| 344 virtual int32 CreateViewCommandBuffer( |
| 345 int32 surface_id, |
| 346 const GPUCreateCommandBufferConfig& init_params) OVERRIDE; |
| 347 virtual void CreateImage( |
| 348 gfx::PluginWindowHandle window, |
| 349 int32 image_id, |
| 350 const CreateImageCallback& callback) OVERRIDE; |
| 351 virtual void DeleteImage(int32 image_id, int32 sync_point) OVERRIDE; |
| 352 |
356 void Init(); | 353 void Init(); |
357 | 354 |
358 void OnSetZoomLevelForCurrentURL(const std::string& scheme, | 355 void OnSetZoomLevelForCurrentURL(const std::string& scheme, |
359 const std::string& host, | 356 const std::string& host, |
360 double zoom_level); | 357 double zoom_level); |
361 void OnCreateNewView(const ViewMsg_New_Params& params); | 358 void OnCreateNewView(const ViewMsg_New_Params& params); |
362 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 359 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
363 void OnPurgePluginListCache(bool reload_pages); | 360 void OnPurgePluginListCache(bool reload_pages); |
364 void OnNetworkStateChanged(bool online); | 361 void OnNetworkStateChanged(bool online); |
365 void OnGetAccessibilityTree(); | 362 void OnGetAccessibilityTree(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 420 |
424 // The following flag is used to control layout test specific behavior. | 421 // The following flag is used to control layout test specific behavior. |
425 bool layout_test_mode_; | 422 bool layout_test_mode_; |
426 | 423 |
427 // Timer that periodically calls IdleHandler. | 424 // Timer that periodically calls IdleHandler. |
428 base::RepeatingTimer<RenderThreadImpl> idle_timer_; | 425 base::RepeatingTimer<RenderThreadImpl> idle_timer_; |
429 | 426 |
430 // The channel from the renderer process to the GPU process. | 427 // The channel from the renderer process to the GPU process. |
431 scoped_refptr<GpuChannelHost> gpu_channel_; | 428 scoped_refptr<GpuChannelHost> gpu_channel_; |
432 | 429 |
| 430 // Cache of variables that are needed on the compositor thread by |
| 431 // GpuChannelHostFactory methods. |
| 432 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 433 base::WaitableEvent* shutdown_event_; |
| 434 |
433 // A lazily initiated thread on which file operations are run. | 435 // A lazily initiated thread on which file operations are run. |
434 scoped_ptr<base::Thread> file_thread_; | 436 scoped_ptr<base::Thread> file_thread_; |
435 | 437 |
436 // May be null if overridden by ContentRendererClient. | 438 // May be null if overridden by ContentRendererClient. |
437 scoped_ptr<base::Thread> compositor_thread_; | 439 scoped_ptr<base::Thread> compositor_thread_; |
438 | 440 |
439 // Thread for running multimedia operations (e.g., video decoding). | 441 // Thread for running multimedia operations (e.g., video decoding). |
440 scoped_ptr<base::Thread> media_thread_; | 442 scoped_ptr<base::Thread> media_thread_; |
441 | 443 |
442 // Will point to appropriate MessageLoopProxy after initialization, | 444 // Will point to appropriate MessageLoopProxy after initialization, |
(...skipping 21 matching lines...) Expand all Loading... |
464 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_; | 466 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_; |
465 | 467 |
466 HistogramCustomizer histogram_customizer_; | 468 HistogramCustomizer histogram_customizer_; |
467 | 469 |
468 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 470 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
469 }; | 471 }; |
470 | 472 |
471 } // namespace content | 473 } // namespace content |
472 | 474 |
473 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 475 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |