| 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/string16.h" | 13 #include "base/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/common/child_process.h" | 16 #include "content/common/child_process.h" |
| 17 #include "content/common/child_thread.h" | 17 #include "content/common/child_thread.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/gpu/client/gpu_channel_host.h" | 19 #include "content/common/gpu/client/gpu_channel_host.h" |
| 20 #include "content/common/gpu/client/offscreen_context.h" |
| 20 #include "content/common/gpu/gpu_process_launch_causes.h" | 21 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 21 #include "content/public/renderer/render_thread.h" | 22 #include "content/public/renderer/render_thread.h" |
| 22 #include "ipc/ipc_channel_proxy.h" | 23 #include "ipc/ipc_channel_proxy.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 24 | 25 |
| 25 class SkBitmap; | 26 class SkBitmap; |
| 26 struct ViewMsg_New_Params; | 27 struct ViewMsg_New_Params; |
| 27 | 28 |
| 28 namespace WebKit { | 29 namespace WebKit { |
| 29 class WebMediaStreamCenter; | 30 class WebMediaStreamCenter; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 78 |
| 78 // The RenderThreadImpl class represents a background thread where RenderView | 79 // The RenderThreadImpl class represents a background thread where RenderView |
| 79 // instances live. The RenderThread supports an API that is used by its | 80 // instances live. The RenderThread supports an API that is used by its |
| 80 // consumer to talk indirectly to the RenderViews and supporting objects. | 81 // consumer to talk indirectly to the RenderViews and supporting objects. |
| 81 // Likewise, it provides an API for the RenderViews to talk back to the main | 82 // Likewise, it provides an API for the RenderViews to talk back to the main |
| 82 // process (i.e., their corresponding WebContentsImpl). | 83 // process (i.e., their corresponding WebContentsImpl). |
| 83 // | 84 // |
| 84 // Most of the communication occurs in the form of IPC messages. They are | 85 // Most of the communication occurs in the form of IPC messages. They are |
| 85 // routed to the RenderThread according to the routing IDs of the messages. | 86 // routed to the RenderThread according to the routing IDs of the messages. |
| 86 // The routing IDs correspond to RenderView instances. | 87 // The routing IDs correspond to RenderView instances. |
| 87 class CONTENT_EXPORT RenderThreadImpl : public RenderThread, | 88 class CONTENT_EXPORT RenderThreadImpl |
| 88 public ChildThread, | 89 : public RenderThread, |
| 89 public GpuChannelHostFactory { | 90 public ChildThread, |
| 91 public GpuChannelHostFactory, |
| 92 public OffscreenContextClient { |
| 90 public: | 93 public: |
| 91 static RenderThreadImpl* current(); | 94 static RenderThreadImpl* current(); |
| 92 | 95 |
| 93 RenderThreadImpl(); | 96 RenderThreadImpl(); |
| 94 // Constructor that's used when running in single process mode. | 97 // Constructor that's used when running in single process mode. |
| 95 explicit RenderThreadImpl(const std::string& channel_name); | 98 explicit RenderThreadImpl(const std::string& channel_name); |
| 96 virtual ~RenderThreadImpl(); | 99 virtual ~RenderThreadImpl(); |
| 97 | 100 |
| 98 // When initializing WebKit, ensure that any schemes needed for the content | 101 // When initializing WebKit, ensure that any schemes needed for the content |
| 99 // module are registered properly. Static to allow sharing with tests. | 102 // module are registered properly. Static to allow sharing with tests. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 194 } |
| 192 | 195 |
| 193 AudioInputMessageFilter* audio_input_message_filter() { | 196 AudioInputMessageFilter* audio_input_message_filter() { |
| 194 return audio_input_message_filter_.get(); | 197 return audio_input_message_filter_.get(); |
| 195 } | 198 } |
| 196 | 199 |
| 197 AudioMessageFilter* audio_message_filter() { | 200 AudioMessageFilter* audio_message_filter() { |
| 198 return audio_message_filter_.get(); | 201 return audio_message_filter_.get(); |
| 199 } | 202 } |
| 200 | 203 |
| 201 | 204 WebKit::WebGraphicsContext3D* OffscreenContext3dForMainThread(); |
| 205 WebKit::WebGraphicsContext3D* OffscreenContext3dForCompositorThread(); |
| 206 GrContext* OffscreenGrContextForMainThread(); |
| 207 GrContext* OffscreenGrContextForCompositorThread(); |
| 202 | 208 |
| 203 // Creates the embedder implementation of WebMediaStreamCenter. | 209 // Creates the embedder implementation of WebMediaStreamCenter. |
| 204 // The resulting object is owned by WebKit and deleted by WebKit at tear-down. | 210 // The resulting object is owned by WebKit and deleted by WebKit at tear-down. |
| 205 WebKit::WebMediaStreamCenter* CreateMediaStreamCenter( | 211 WebKit::WebMediaStreamCenter* CreateMediaStreamCenter( |
| 206 WebKit::WebMediaStreamCenterClient* client); | 212 WebKit::WebMediaStreamCenterClient* client); |
| 207 | 213 |
| 208 // Returns a factory used for creating RTC PeerConnection objects. | 214 // Returns a factory used for creating RTC PeerConnection objects. |
| 209 MediaStreamDependencyFactory* GetMediaStreamDependencyFactory(); | 215 MediaStreamDependencyFactory* GetMediaStreamDependencyFactory(); |
| 210 | 216 |
| 211 PeerConnectionTracker* peer_connection_tracker() { | 217 PeerConnectionTracker* peer_connection_tracker() { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level); | 322 void OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level); |
| 317 void OnCreateNewView(const ViewMsg_New_Params& params); | 323 void OnCreateNewView(const ViewMsg_New_Params& params); |
| 318 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 324 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
| 319 void OnPurgePluginListCache(bool reload_pages); | 325 void OnPurgePluginListCache(bool reload_pages); |
| 320 void OnNetworkStateChanged(bool online); | 326 void OnNetworkStateChanged(bool online); |
| 321 void OnGetAccessibilityTree(); | 327 void OnGetAccessibilityTree(); |
| 322 void OnTempCrashWithData(const GURL& data); | 328 void OnTempCrashWithData(const GURL& data); |
| 323 | 329 |
| 324 void IdleHandlerInForegroundTab(); | 330 void IdleHandlerInForegroundTab(); |
| 325 | 331 |
| 332 // OffscreenContextClient implementation. |
| 333 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() |
| 334 OVERRIDE; |
| 335 virtual void DidLoseContext(OffscreenContext* offscreen_context) |
| 336 OVERRIDE {} |
| 337 virtual void DidCreateContext(OffscreenContext* offscreen_context, |
| 338 bool success) OVERRIDE {} |
| 339 |
| 326 // These objects live solely on the render thread. | 340 // These objects live solely on the render thread. |
| 327 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; | 341 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; |
| 328 scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_; | 342 scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_; |
| 329 scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; | 343 scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; |
| 330 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; | 344 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; |
| 331 | 345 |
| 332 // Used on the render thread and deleted by WebKit at shutdown. | 346 // Used on the render thread and deleted by WebKit at shutdown. |
| 333 MediaStreamCenter* media_stream_center_; | 347 MediaStreamCenter* media_stream_center_; |
| 334 | 348 |
| 335 // Used on the renderer and IPC threads. | 349 // Used on the renderer and IPC threads. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // The channel from the renderer process to the GPU process. | 393 // The channel from the renderer process to the GPU process. |
| 380 scoped_refptr<GpuChannelHost> gpu_channel_; | 394 scoped_refptr<GpuChannelHost> gpu_channel_; |
| 381 | 395 |
| 382 // A lazily initiated thread on which file operations are run. | 396 // A lazily initiated thread on which file operations are run. |
| 383 scoped_ptr<base::Thread> file_thread_; | 397 scoped_ptr<base::Thread> file_thread_; |
| 384 | 398 |
| 385 bool compositor_initialized_; | 399 bool compositor_initialized_; |
| 386 scoped_ptr<CompositorThread> compositor_thread_; | 400 scoped_ptr<CompositorThread> compositor_thread_; |
| 387 scoped_refptr<IPC::ForwardingMessageFilter> compositor_output_surface_filter_; | 401 scoped_refptr<IPC::ForwardingMessageFilter> compositor_output_surface_filter_; |
| 388 | 402 |
| 403 OffscreenContext shared_context_main_thread_; |
| 404 OffscreenContext shared_context_compositor_thread_; |
| 405 |
| 389 ObserverList<RenderProcessObserver> observers_; | 406 ObserverList<RenderProcessObserver> observers_; |
| 390 | 407 |
| 391 class GpuVDAContextLostCallback; | 408 class GpuVDAContextLostCallback; |
| 392 scoped_ptr<GpuVDAContextLostCallback> context_lost_cb_; | 409 scoped_ptr<GpuVDAContextLostCallback> context_lost_cb_; |
| 393 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> gpu_vda_context3d_; | 410 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> gpu_vda_context3d_; |
| 394 | 411 |
| 395 scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; | 412 scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; |
| 396 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_; | 413 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_; |
| 397 | 414 |
| 398 HistogramCustomizer histogram_customizer_; | 415 HistogramCustomizer histogram_customizer_; |
| 399 | 416 |
| 400 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 417 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
| 401 }; | 418 }; |
| 402 | 419 |
| 403 } // namespace content | 420 } // namespace content |
| 404 | 421 |
| 405 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 422 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| OLD | NEW |