Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.h

Issue 11194042: Implement TextureImageTransportSurface using texture mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.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/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "content/browser/renderer_host/image_transport_factory.h" 17 #include "content/browser/renderer_host/image_transport_factory.h"
17 #include "content/browser/renderer_host/render_widget_host_view_base.h" 18 #include "content/browser/renderer_host/render_widget_host_view_base.h"
18 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
19 #include "ui/aura/client/activation_delegate.h" 20 #include "ui/aura/client/activation_delegate.h"
20 #include "ui/aura/window_delegate.h" 21 #include "ui/aura/window_delegate.h"
21 #include "ui/base/ime/text_input_client.h" 22 #include "ui/base/ime/text_input_client.h"
22 #include "ui/compositor/compositor_observer.h" 23 #include "ui/compositor/compositor_observer.h"
23 #include "ui/gfx/rect.h" 24 #include "ui/gfx/rect.h"
24 #include "webkit/glue/webcursor.h" 25 #include "webkit/glue/webcursor.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, 114 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel,
114 int gpu_host_id) OVERRIDE; 115 int gpu_host_id) OVERRIDE;
115 virtual void AcceleratedSurfacePostSubBuffer( 116 virtual void AcceleratedSurfacePostSubBuffer(
116 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, 117 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel,
117 int gpu_host_id) OVERRIDE; 118 int gpu_host_id) OVERRIDE;
118 virtual void AcceleratedSurfaceSuspend() OVERRIDE; 119 virtual void AcceleratedSurfaceSuspend() OVERRIDE;
119 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; 120 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
120 virtual void AcceleratedSurfaceNew( 121 virtual void AcceleratedSurfaceNew(
121 int32 width_in_pixel, 122 int32 width_in_pixel,
122 int32 height_in_pixel, 123 int32 height_in_pixel,
123 uint64 surface_id) OVERRIDE; 124 uint64 surface_id,
125 const std::vector<signed char>& mailbox_name) OVERRIDE;
124 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; 126 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE;
125 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; 127 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
126 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; 128 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
127 virtual void ProcessAckedTouchEvent(const WebKit::WebTouchEvent& touch, 129 virtual void ProcessAckedTouchEvent(const WebKit::WebTouchEvent& touch,
128 bool processed) OVERRIDE; 130 bool processed) OVERRIDE;
129 virtual void SetHasHorizontalScrollbar( 131 virtual void SetHasHorizontalScrollbar(
130 bool has_horizontal_scrollbar) OVERRIDE; 132 bool has_horizontal_scrollbar) OVERRIDE;
131 virtual void SetScrollOffsetPinning( 133 virtual void SetScrollOffsetPinning(
132 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; 134 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
133 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; 135 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 235
234 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty 236 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
235 // SchedulePaint() is invoked for |rect|. 237 // SchedulePaint() is invoked for |rect|.
236 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); 238 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
237 239
238 // Helper method to determine if, in mouse locked mode, the cursor should be 240 // Helper method to determine if, in mouse locked mode, the cursor should be
239 // moved to center. 241 // moved to center.
240 bool ShouldMoveToCenter(); 242 bool ShouldMoveToCenter();
241 243
242 // Run the compositing callbacks. 244 // Run the compositing callbacks.
243 void RunCompositingDidCommitCallbacks(ui::Compositor* compositor); 245 void RunCompositingDidCommitCallbacks();
244 void RunCompositingWillStartCallbacks(ui::Compositor* compositor); 246 void RunCompositingWillStartCallbacks();
245 247
246 // Insert a sync point into the compositor's command stream and acknowledge 248 // Insert a sync point into the compositor's command stream and acknowledge
247 // that we have presented the accelerated surface buffer. 249 // that we have presented the accelerated surface buffer.
248 static void InsertSyncPointAndACK(int32 route_id, 250 static void InsertSyncPointAndACK(int32 route_id,
249 int gpu_host_id, 251 int gpu_host_id,
250 ui::Compositor* compositor); 252 scoped_refptr<ui::Texture> texture);
251 253
252 // Called when window_ is removed from the window tree. 254 // Called when window_ is removed from the window tree.
253 void RemovingFromRootWindow(); 255 void RemovingFromRootWindow();
254 256
255 // After clearing |current_surface_|, and waiting for the compositor to finish 257 // Called after commit for the last reference to the texture going away
256 // using it, call this to inform the gpu process. 258 // after it was released as the frontbuffer.
257 void SetSurfaceNotInUseByCompositor(ui::Compositor* compositor); 259 void SetSurfaceNotInUseByCompositor(scoped_refptr<ui::Texture>);
258 260
259 // This is called every time |current_surface_| usage changes (by thumbnailer, 261 // Called after async thumbnailer task completes.
260 // compositor draws, and tab visibility). Every time usage of current surface 262 // Holds a reference to the texture through the bound argument.
261 // changes between "may be used" and "certain to not be used" by the ui, we
262 // inform the gpu process.
263 void AdjustSurfaceProtection();
264
265 // Called after async thumbnailer task completes. Used to call
266 // AdjustSurfaceProtection.
267 void CopyFromCompositingSurfaceFinished(base::Callback<void(bool)> callback, 263 void CopyFromCompositingSurfaceFinished(base::Callback<void(bool)> callback,
264 scoped_refptr<ui::Texture>,
268 bool result); 265 bool result);
269 266
270 ui::Compositor* GetCompositor(); 267 ui::Compositor* GetCompositor();
271 268
272 // Detaches |this| from the input method object. 269 // Detaches |this| from the input method object.
273 void DetachFromInputMethod(); 270 void DetachFromInputMethod();
274 271
275 // Converts |rect| from window coordinate to screen coordinate. 272 // Converts |rect| from window coordinate to screen coordinate.
276 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect); 273 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect);
277 274
275 void SwapBuffersBegin(const gfx::Size& surface_size);
276 void SwapBuffersCompleted(int gpu_host_id,
277 int route_id,
278 scoped_refptr<ui::Texture> pending_surface);
278 // The model object. 279 // The model object.
279 RenderWidgetHostImpl* host_; 280 RenderWidgetHostImpl* host_;
280 281
281 aura::Window* window_; 282 aura::Window* window_;
282 283
283 scoped_ptr<WindowObserver> window_observer_; 284 scoped_ptr<WindowObserver> window_observer_;
284 285
285 // Are we in the process of closing? Tracked so fullscreen views can avoid 286 // Are we in the process of closing? Tracked so fullscreen views can avoid
286 // sending a second shutdown request to the host when they lose the focus 287 // sending a second shutdown request to the host when they lose the focus
287 // after requesting shutdown for another reason (e.g. Escape key). 288 // after requesting shutdown for another reason (e.g. Escape key).
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 321
321 // Indicates if there is onging composition text. 322 // Indicates if there is onging composition text.
322 bool has_composition_text_; 323 bool has_composition_text_;
323 324
324 // Current tooltip text. 325 // Current tooltip text.
325 string16 tooltip_; 326 string16 tooltip_;
326 327
327 // The scale factor of the display the renderer is currently on. 328 // The scale factor of the display the renderer is currently on.
328 float device_scale_factor_; 329 float device_scale_factor_;
329 330
330 std::vector< base::Callback<void(ui::Compositor*)> > 331 std::vector<base::Closure> on_compositing_did_commit_callbacks_;
331 on_compositing_did_commit_callbacks_;
332 332
333 std::vector< base::Callback<void(ui::Compositor*)> > 333 std::vector<base::Closure> on_compositing_will_start_callbacks_;
334 on_compositing_will_start_callbacks_;
335 334
336 std::map<uint64, scoped_refptr<ui::Texture> > 335 // The current frontbuffer
337 image_transport_clients_; 336 scoped_refptr<ui::Texture> current_surface_;
338 337
339 uint64 current_surface_; 338 // The buffer pending to become our new frontbuffer during a swap
no sievers 2012/11/02 01:29:14 Actually this is the previous one, the one to be r
339 scoped_refptr<ui::Texture> pending_surface_;
340 340
341 // Protected means that the |current_surface_| may be in use by ui and cannot 341 std::vector<signed char> mailbox_name_;
342 // be safely discarded. Things to consider are thumbnailer, compositor draw,
343 // and tab visibility.
344 bool current_surface_is_protected_;
345 bool current_surface_in_use_by_compositor_;
346 342
347 std::vector<base::Callback<void(bool)> > pending_thumbnail_tasks_; 343 std::vector<base::Callback<void(bool)> > pending_thumbnail_tasks_;
348 344
349 // This id increments every time surface_is_protected changes. We tag IPC
350 // messages which rely on protection state with this id to stay in sync.
351 uint32 protection_state_id_;
352
353 int32 surface_route_id_;
354
355 gfx::GLSurfaceHandle shared_surface_handle_; 345 gfx::GLSurfaceHandle shared_surface_handle_;
356 346
357 // If non-NULL we're in OnPaint() and this is the supplied canvas. 347 // If non-NULL we're in OnPaint() and this is the supplied canvas.
358 gfx::Canvas* paint_canvas_; 348 gfx::Canvas* paint_canvas_;
359 349
360 // Used to record the last position of the mouse. 350 // Used to record the last position of the mouse.
361 // While the mouse is locked, they store the last known position just as mouse 351 // While the mouse is locked, they store the last known position just as mouse
362 // lock was entered. 352 // lock was entered.
363 // Relative to the upper-left corner of the view. 353 // Relative to the upper-left corner of the view.
364 gfx::Point unlocked_mouse_position_; 354 gfx::Point unlocked_mouse_position_;
(...skipping 26 matching lines...) Expand all
391 // Used to track the state of the window we're created from. Only used when 381 // Used to track the state of the window we're created from. Only used when
392 // created fullscreen. 382 // created fullscreen.
393 scoped_ptr<aura::WindowTracker> host_tracker_; 383 scoped_ptr<aura::WindowTracker> host_tracker_;
394 384
395 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); 385 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
396 }; 386 };
397 387
398 } // namespace content 388 } // namespace content
399 389
400 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ 390 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698