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/memory/memory_pressure_listener.h" | 12 #include "base/memory/memory_pressure_listener.h" |
13 #include "base/metrics/user_metrics_action.h" | 13 #include "base/metrics/user_metrics_action.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "content/child/child_thread.h" | 19 #include "content/child/child_thread.h" |
20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
21 #include "content/common/gpu/client/gpu_channel_host.h" | 21 #include "content/common/gpu/client/gpu_channel_host.h" |
| 22 #include "content/common/render_process.mojom.h" |
22 #include "content/public/renderer/render_thread.h" | 23 #include "content/public/renderer/render_thread.h" |
| 24 #include "content/renderer/mojo/mojo_application.h" |
23 #include "ipc/ipc_channel_proxy.h" | 25 #include "ipc/ipc_channel_proxy.h" |
24 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
25 | 27 |
26 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
27 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" | 29 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" |
28 #endif | 30 #endif |
29 | 31 |
30 class GrContext; | 32 class GrContext; |
31 class SkBitmap; | 33 class SkBitmap; |
32 struct ViewMsg_New_Params; | 34 struct ViewMsg_New_Params; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // instances live. The RenderThread supports an API that is used by its | 102 // instances live. The RenderThread supports an API that is used by its |
101 // consumer to talk indirectly to the RenderViews and supporting objects. | 103 // consumer to talk indirectly to the RenderViews and supporting objects. |
102 // Likewise, it provides an API for the RenderViews to talk back to the main | 104 // Likewise, it provides an API for the RenderViews to talk back to the main |
103 // process (i.e., their corresponding WebContentsImpl). | 105 // process (i.e., their corresponding WebContentsImpl). |
104 // | 106 // |
105 // Most of the communication occurs in the form of IPC messages. They are | 107 // Most of the communication occurs in the form of IPC messages. They are |
106 // routed to the RenderThread according to the routing IDs of the messages. | 108 // routed to the RenderThread according to the routing IDs of the messages. |
107 // The routing IDs correspond to RenderView instances. | 109 // The routing IDs correspond to RenderView instances. |
108 class CONTENT_EXPORT RenderThreadImpl : public RenderThread, | 110 class CONTENT_EXPORT RenderThreadImpl : public RenderThread, |
109 public ChildThread, | 111 public ChildThread, |
110 public GpuChannelHostFactory { | 112 public GpuChannelHostFactory, |
| 113 public mojo::ShellClient, |
| 114 public IRenderProcess { |
111 public: | 115 public: |
112 static RenderThreadImpl* current(); | 116 static RenderThreadImpl* current(); |
113 | 117 |
114 RenderThreadImpl(); | 118 RenderThreadImpl(); |
115 // Constructor that's used when running in single process mode. | 119 // Constructor that's used when running in single process mode. |
116 explicit RenderThreadImpl(const std::string& channel_name); | 120 explicit RenderThreadImpl(const std::string& channel_name); |
117 virtual ~RenderThreadImpl(); | 121 virtual ~RenderThreadImpl(); |
118 virtual void Shutdown() OVERRIDE; | 122 virtual void Shutdown() OVERRIDE; |
119 | 123 |
120 // When initializing WebKit, ensure that any schemes needed for the content | 124 // When initializing WebKit, ensure that any schemes needed for the content |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 virtual void CreateImage( | 398 virtual void CreateImage( |
395 gfx::PluginWindowHandle window, | 399 gfx::PluginWindowHandle window, |
396 int32 image_id, | 400 int32 image_id, |
397 const CreateImageCallback& callback) OVERRIDE; | 401 const CreateImageCallback& callback) OVERRIDE; |
398 virtual void DeleteImage(int32 image_id, int32 sync_point) OVERRIDE; | 402 virtual void DeleteImage(int32 image_id, int32 sync_point) OVERRIDE; |
399 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 403 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( |
400 size_t width, | 404 size_t width, |
401 size_t height, | 405 size_t height, |
402 unsigned internalformat) OVERRIDE; | 406 unsigned internalformat) OVERRIDE; |
403 | 407 |
| 408 // mojo::ShellClient implementation: |
| 409 virtual void AcceptConnection( |
| 410 const mojo::String& url, |
| 411 mojo::ScopedMessagePipeHandle message_pipe) OVERRIDE; |
| 412 |
| 413 // IRenderProcess implementation: |
| 414 virtual void SetWebUIHandle( |
| 415 int32 view_routing_id, |
| 416 mojo::ScopedMessagePipeHandle web_ui_handle) OVERRIDE; |
| 417 |
404 void Init(); | 418 void Init(); |
405 | 419 |
406 void OnSetZoomLevelForCurrentURL(const std::string& scheme, | 420 void OnSetZoomLevelForCurrentURL(const std::string& scheme, |
407 const std::string& host, | 421 const std::string& host, |
408 double zoom_level); | 422 double zoom_level); |
409 void OnCreateNewView(const ViewMsg_New_Params& params); | 423 void OnCreateNewView(const ViewMsg_New_Params& params); |
410 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 424 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
411 void OnPurgePluginListCache(bool reload_pages); | 425 void OnPurgePluginListCache(bool reload_pages); |
412 void OnNetworkStateChanged(bool online); | 426 void OnNetworkStateChanged(bool online); |
413 void OnGetAccessibilityTree(); | 427 void OnGetAccessibilityTree(); |
(...skipping 11 matching lines...) Expand all Loading... |
425 blink::ScrollerStyle preferred_scroller_style, | 439 blink::ScrollerStyle preferred_scroller_style, |
426 bool redraw); | 440 bool redraw); |
427 #endif | 441 #endif |
428 void OnCreateNewSharedWorker( | 442 void OnCreateNewSharedWorker( |
429 const WorkerProcessMsg_CreateWorker_Params& params); | 443 const WorkerProcessMsg_CreateWorker_Params& params); |
430 | 444 |
431 void IdleHandlerInForegroundTab(); | 445 void IdleHandlerInForegroundTab(); |
432 | 446 |
433 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext3d(); | 447 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext3d(); |
434 | 448 |
| 449 MojoApplication mojo_application_; |
| 450 mojo::RemotePtr<IRenderProcessHost> render_process_host_; |
| 451 |
435 // These objects live solely on the render thread. | 452 // These objects live solely on the render thread. |
436 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; | 453 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; |
437 scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_; | 454 scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_; |
438 scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; | 455 scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; |
439 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; | 456 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; |
440 scoped_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_; | 457 scoped_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_; |
441 | 458 |
442 // Used on the render thread and deleted by WebKit at shutdown. | 459 // Used on the render thread and deleted by WebKit at shutdown. |
443 blink::WebMediaStreamCenter* media_stream_center_; | 460 blink::WebMediaStreamCenter* media_stream_center_; |
444 | 461 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 bool is_low_res_tiling_enabled_; | 558 bool is_low_res_tiling_enabled_; |
542 bool is_lcd_text_enabled_; | 559 bool is_lcd_text_enabled_; |
543 bool is_map_image_enabled_; | 560 bool is_map_image_enabled_; |
544 | 561 |
545 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 562 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
546 }; | 563 }; |
547 | 564 |
548 } // namespace content | 565 } // namespace content |
549 | 566 |
550 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 567 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |