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_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 namespace WebKit { | 47 namespace WebKit { |
48 class WebGestureEvent; | 48 class WebGestureEvent; |
49 class WebInputEvent; | 49 class WebInputEvent; |
50 class WebMouseEvent; | 50 class WebMouseEvent; |
51 class WebTouchEvent; | 51 class WebTouchEvent; |
52 struct WebPoint; | 52 struct WebPoint; |
53 struct WebRenderingStatsImpl; | 53 struct WebRenderingStatsImpl; |
54 } | 54 } |
55 | 55 |
56 namespace cc { class OutputSurface; } | 56 namespace cc { |
| 57 class InputHandlerClient; |
| 58 class OutputSurface; |
| 59 } |
57 | 60 |
58 namespace ui { | 61 namespace ui { |
59 class Range; | 62 class Range; |
60 } | 63 } |
61 | 64 |
62 namespace webkit { | 65 namespace webkit { |
63 namespace npapi { | 66 namespace npapi { |
64 struct WebPluginGeometry; | 67 struct WebPluginGeometry; |
65 } // namespace npapi | 68 } // namespace npapi |
66 | 69 |
67 namespace ppapi { | 70 namespace ppapi { |
68 class PluginInstance; | 71 class PluginInstance; |
69 } // namespace ppapi | 72 } // namespace ppapi |
70 } // namespace webkit | 73 } // namespace webkit |
71 | 74 |
72 namespace content { | 75 namespace content { |
73 struct GpuRenderingStats; | 76 struct GpuRenderingStats; |
74 class RenderWidgetCompositor; | 77 class RenderWidgetCompositor; |
75 class RenderWidgetTest; | 78 class RenderWidgetTest; |
| 79 class SynchronousCompositorImpl; |
76 | 80 |
77 // RenderWidget provides a communication bridge between a WebWidget and | 81 // RenderWidget provides a communication bridge between a WebWidget and |
78 // a RenderWidgetHost, the latter of which lives in a different process. | 82 // a RenderWidgetHost, the latter of which lives in a different process. |
79 class CONTENT_EXPORT RenderWidget | 83 class CONTENT_EXPORT RenderWidget |
80 : public IPC::Listener, | 84 : public IPC::Listener, |
81 public IPC::Sender, | 85 public IPC::Sender, |
82 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient), | 86 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient), |
83 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient), | 87 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient), |
84 public base::RefCounted<RenderWidget> { | 88 public base::RefCounted<RenderWidget> { |
85 public: | 89 public: |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 172 |
169 // Fills in a GpuRenderingStats struct containing information about | 173 // Fills in a GpuRenderingStats struct containing information about |
170 // GPU rendering, e.g. count of texture uploads performed, time spent | 174 // GPU rendering, e.g. count of texture uploads performed, time spent |
171 // uploading. | 175 // uploading. |
172 // This call is relatively expensive as it blocks on the GPU process | 176 // This call is relatively expensive as it blocks on the GPU process |
173 bool GetGpuRenderingStats(GpuRenderingStats*) const; | 177 bool GetGpuRenderingStats(GpuRenderingStats*) const; |
174 | 178 |
175 RenderWidgetCompositor* compositor() const; | 179 RenderWidgetCompositor* compositor() const; |
176 | 180 |
177 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(); | 181 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(); |
| 182 scoped_ptr<cc::InputHandlerClient> CreateInputHandlerClient(); |
178 | 183 |
179 // Callback for use with BeginSmoothScroll. | 184 // Callback for use with BeginSmoothScroll. |
180 typedef base::Callback<void()> SmoothScrollCompletionCallback; | 185 typedef base::Callback<void()> SmoothScrollCompletionCallback; |
181 | 186 |
182 // Directs the host to begin a smooth scroll. This scroll should have the same | 187 // Directs the host to begin a smooth scroll. This scroll should have the same |
183 // performance characteristics as a user-initiated scroll. Returns an ID of | 188 // performance characteristics as a user-initiated scroll. Returns an ID of |
184 // the scroll gesture. |mouse_event_x| and |mouse_event_y| are expected to be | 189 // the scroll gesture. |mouse_event_x| and |mouse_event_y| are expected to be |
185 // in local DIP coordinates. | 190 // in local DIP coordinates. |
186 void BeginSmoothScroll(bool scroll_down, | 191 void BeginSmoothScroll(bool scroll_down, |
187 const SmoothScrollCompletionCallback& callback, | 192 const SmoothScrollCompletionCallback& callback, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // at the given point. | 492 // at the given point. |
488 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const; | 493 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const; |
489 | 494 |
490 // Check whether the WebWidget has any touch event handlers registered. | 495 // Check whether the WebWidget has any touch event handlers registered. |
491 virtual void hasTouchEventHandlers(bool has_handlers); | 496 virtual void hasTouchEventHandlers(bool has_handlers); |
492 | 497 |
493 // Creates a 3D context associated with this view. | 498 // Creates a 3D context associated with this view. |
494 WebGraphicsContext3DCommandBufferImpl* CreateGraphicsContext3D( | 499 WebGraphicsContext3DCommandBufferImpl* CreateGraphicsContext3D( |
495 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 500 const WebKit::WebGraphicsContext3D::Attributes& attributes); |
496 | 501 |
| 502 // Lazily creates the synchronous compositor on first call. |
| 503 SynchronousCompositorImpl* GetSynchronousCompositor(); |
| 504 |
497 bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap); | 505 bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap); |
498 | 506 |
499 // Routing ID that allows us to communicate to the parent browser process | 507 // Routing ID that allows us to communicate to the parent browser process |
500 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. | 508 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. |
501 int32 routing_id_; | 509 int32 routing_id_; |
502 | 510 |
503 int32 surface_id_; | 511 int32 surface_id_; |
504 | 512 |
505 // We are responsible for destroying this object via its Close method. | 513 // We are responsible for destroying this object via its Close method. |
506 WebKit::WebWidget* webwidget_; | 514 WebKit::WebWidget* webwidget_; |
507 | 515 |
508 // This is lazily constructed and must not outlive webwidget_. | 516 // This is lazily constructed and must not outlive webwidget_. |
509 scoped_ptr<RenderWidgetCompositor> compositor_; | 517 scoped_ptr<RenderWidgetCompositor> compositor_; |
510 | 518 |
| 519 #if defined(OS_ANDROID) |
| 520 // This is lazily constructed. |
| 521 scoped_ptr<SynchronousCompositorImpl> synchronous_compositor_; |
| 522 #endif |
| 523 |
511 // Set to the ID of the view that initiated creating this view, if any. When | 524 // Set to the ID of the view that initiated creating this view, if any. When |
512 // the view was initiated by the browser (the common case), this will be | 525 // the view was initiated by the browser (the common case), this will be |
513 // MSG_ROUTING_NONE. This is used in determining ownership when opening | 526 // MSG_ROUTING_NONE. This is used in determining ownership when opening |
514 // child tabs. See RenderWidget::createWebViewWithRequest. | 527 // child tabs. See RenderWidget::createWebViewWithRequest. |
515 // | 528 // |
516 // This ID may refer to an invalid view if that view is closed before this | 529 // This ID may refer to an invalid view if that view is closed before this |
517 // view is. | 530 // view is. |
518 int32 opener_id_; | 531 int32 opener_id_; |
519 | 532 |
520 // The position where this view should be initially shown. | 533 // The position where this view should be initially shown. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 bool overscroll_notifications_enabled_; | 715 bool overscroll_notifications_enabled_; |
703 | 716 |
704 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 717 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
705 | 718 |
706 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 719 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
707 }; | 720 }; |
708 | 721 |
709 } // namespace content | 722 } // namespace content |
710 | 723 |
711 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 724 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |