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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | |
15 #include "content/browser/renderer_host/image_transport_factory.h" | 16 #include "content/browser/renderer_host/image_transport_factory.h" |
16 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "ui/aura/client/activation_delegate.h" | 19 #include "ui/aura/client/activation_delegate.h" |
19 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
20 #include "ui/base/ime/text_input_client.h" | 21 #include "ui/base/ime/text_input_client.h" |
21 #include "ui/compositor/compositor_observer.h" | 22 #include "ui/compositor/compositor_observer.h" |
22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
23 #include "webkit/glue/webcursor.h" | 24 #include "webkit/glue/webcursor.h" |
24 | 25 |
26 namespace aura { | |
27 class CompositorLock; | |
28 } | |
29 | |
25 namespace content { | 30 namespace content { |
26 class RenderWidgetHostImpl; | 31 class RenderWidgetHostImpl; |
27 class RenderWidgetHostView; | 32 class RenderWidgetHostView; |
28 } | 33 } |
29 | 34 |
30 namespace gfx { | 35 namespace gfx { |
31 class Canvas; | 36 class Canvas; |
32 } | 37 } |
33 | 38 |
34 namespace ui { | 39 namespace ui { |
35 class InputMethod; | 40 class InputMethod; |
36 } | 41 } |
37 | 42 |
38 namespace WebKit { | 43 namespace WebKit { |
39 class WebTouchEvent; | 44 class WebTouchEvent; |
40 } | 45 } |
41 | 46 |
42 class ImageTransportClient; | 47 class ImageTransportClient; |
43 | 48 |
44 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 49 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
45 class RenderWidgetHostViewAura | 50 class RenderWidgetHostViewAura |
46 : public content::RenderWidgetHostViewBase, | 51 : public content::RenderWidgetHostViewBase, |
47 public ui::CompositorObserver, | 52 public ui::CompositorObserver, |
48 public ui::TextInputClient, | 53 public ui::TextInputClient, |
49 public aura::WindowDelegate, | 54 public aura::WindowDelegate, |
50 public aura::client::ActivationDelegate, | 55 public aura::client::ActivationDelegate, |
51 public ImageTransportFactoryObserver { | 56 public ImageTransportFactoryObserver, |
57 public base::SupportsWeakPtr<RenderWidgetHostViewAura> { | |
52 public: | 58 public: |
53 virtual ~RenderWidgetHostViewAura(); | 59 virtual ~RenderWidgetHostViewAura(); |
54 | 60 |
55 // RenderWidgetHostView implementation. | 61 // RenderWidgetHostView implementation. |
56 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 62 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
57 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 63 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
58 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 64 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
59 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 65 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
60 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 66 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
61 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 67 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 int gpu_host_id) OVERRIDE; | 110 int gpu_host_id) OVERRIDE; |
105 virtual void AcceleratedSurfacePostSubBuffer( | 111 virtual void AcceleratedSurfacePostSubBuffer( |
106 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 112 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
107 int gpu_host_id) OVERRIDE; | 113 int gpu_host_id) OVERRIDE; |
108 virtual void AcceleratedSurfaceSuspend() OVERRIDE; | 114 virtual void AcceleratedSurfaceSuspend() OVERRIDE; |
109 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | 115 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; |
110 virtual void AcceleratedSurfaceNew( | 116 virtual void AcceleratedSurfaceNew( |
111 int32 width_in_pixel, | 117 int32 width_in_pixel, |
112 int32 height_in_pixel, | 118 int32 height_in_pixel, |
113 uint64* surface_id, | 119 uint64* surface_id, |
114 TransportDIB::Handle* surface_handle) OVERRIDE; | 120 TransportDIB::Handle* surface_handle, |
121 int32 route_id) OVERRIDE; | |
115 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; | 122 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; |
116 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; | 123 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; |
117 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; | 124 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; |
118 virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, | 125 virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, |
119 bool processed) OVERRIDE; | 126 bool processed) OVERRIDE; |
120 virtual void SetHasHorizontalScrollbar( | 127 virtual void SetHasHorizontalScrollbar( |
121 bool has_horizontal_scrollbar) OVERRIDE; | 128 bool has_horizontal_scrollbar) OVERRIDE; |
122 virtual void SetScrollOffsetPinning( | 129 virtual void SetScrollOffsetPinning( |
123 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 130 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; |
124 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 131 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 // Helper method to determine if, in mouse locked mode, the cursor should be | 221 // Helper method to determine if, in mouse locked mode, the cursor should be |
215 // moved to center. | 222 // moved to center. |
216 bool ShouldMoveToCenter(); | 223 bool ShouldMoveToCenter(); |
217 | 224 |
218 // Run the compositing callbacks. | 225 // Run the compositing callbacks. |
219 void RunCompositingCallbacks(); | 226 void RunCompositingCallbacks(); |
220 | 227 |
221 // Called when window_ is removed from the window tree. | 228 // Called when window_ is removed from the window tree. |
222 void RemovingFromRootWindow(); | 229 void RemovingFromRootWindow(); |
223 | 230 |
231 void SetSurfaceNotInUseByCompositor(uint32 expected_visibility_state_id); | |
232 void AdjustSurfaceProtection(); | |
233 | |
234 void CopyFromCompositingSurfaceFinished(base::Callback<void(bool)> callback, | |
235 bool result); | |
236 | |
224 ui::Compositor* GetCompositor(); | 237 ui::Compositor* GetCompositor(); |
225 | 238 |
226 // The model object. | 239 // The model object. |
227 content::RenderWidgetHostImpl* host_; | 240 content::RenderWidgetHostImpl* host_; |
228 | 241 |
229 aura::Window* window_; | 242 aura::Window* window_; |
230 | 243 |
231 scoped_ptr<WindowObserver> window_observer_; | 244 scoped_ptr<WindowObserver> window_observer_; |
232 | 245 |
233 // Are we in the process of closing? Tracked so fullscreen views can avoid | 246 // Are we in the process of closing? Tracked so fullscreen views can avoid |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 // Current tooltip text. | 282 // Current tooltip text. |
270 string16 tooltip_; | 283 string16 tooltip_; |
271 | 284 |
272 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; | 285 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; |
273 | 286 |
274 std::map<uint64, scoped_refptr<ImageTransportClient> > | 287 std::map<uint64, scoped_refptr<ImageTransportClient> > |
275 image_transport_clients_; | 288 image_transport_clients_; |
276 | 289 |
277 uint64 current_surface_; | 290 uint64 current_surface_; |
278 | 291 |
292 // protected means that the current_surface_ may be in use by ui and cannot | |
piman
2012/06/12 20:59:48
nit: Protected (cap 1st letter)
| |
293 // be safely discarded. Things to consider are thumbnailerm compositor draw | |
piman
2012/06/12 20:59:48
typo: thumbnailer,
| |
294 // pending, and tab visibility. | |
295 bool current_surface_is_protected_; | |
296 bool current_surface_in_use_by_compositor_; | |
297 | |
298 int pending_thumbnail_tasks_; | |
299 | |
300 // This id increments every time visibility changes. Keeps gpu/browser IPC | |
301 // IPC messages relying on visibility state tagged and in sync. | |
302 uint32 visibility_state_id_; | |
303 | |
304 int32 route_id_; | |
piman
2012/06/12 20:59:48
nit: maybe rename this as "surface_route_id_" to m
| |
305 | |
279 gfx::GLSurfaceHandle shared_surface_handle_; | 306 gfx::GLSurfaceHandle shared_surface_handle_; |
280 | 307 |
281 // If non-NULL we're in OnPaint() and this is the supplied canvas. | 308 // If non-NULL we're in OnPaint() and this is the supplied canvas. |
282 gfx::Canvas* paint_canvas_; | 309 gfx::Canvas* paint_canvas_; |
283 | 310 |
284 // Used to record the last position of the mouse. | 311 // Used to record the last position of the mouse. |
285 // While the mouse is locked, they store the last known position just as mouse | 312 // While the mouse is locked, they store the last known position just as mouse |
286 // lock was entered. | 313 // lock was entered. |
287 // Relative to the upper-left corner of the view. | 314 // Relative to the upper-left corner of the view. |
288 gfx::Point unlocked_mouse_position_; | 315 gfx::Point unlocked_mouse_position_; |
(...skipping 12 matching lines...) Expand all Loading... | |
301 bool needs_update_texture_; | 328 bool needs_update_texture_; |
302 | 329 |
303 // Used to prevent further resizes while a resize is pending. | 330 // Used to prevent further resizes while a resize is pending. |
304 class ResizeLock; | 331 class ResizeLock; |
305 // These locks are the ones waiting for a texture of the right size to come | 332 // These locks are the ones waiting for a texture of the right size to come |
306 // back from the renderer/GPU process. | 333 // back from the renderer/GPU process. |
307 std::vector<linked_ptr<ResizeLock> > resize_locks_; | 334 std::vector<linked_ptr<ResizeLock> > resize_locks_; |
308 // These locks are the ones waiting for a frame to be drawn. | 335 // These locks are the ones waiting for a frame to be drawn. |
309 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; | 336 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; |
310 | 337 |
338 // This lock is for waiting for a front surface to become available to draw. | |
339 scoped_refptr<aura::CompositorLock> released_front_lock_; | |
340 | |
311 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 341 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
312 }; | 342 }; |
313 | 343 |
314 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 344 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |