Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.h |
| diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h |
| index 58f06b217d83e9bf5fd51db714867055057861c1..fa9b7cec95a8a9c0bd89b1360e6d347a2fe62c3e 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.h |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.h |
| @@ -12,13 +12,16 @@ |
| #include "base/gtest_prod_util.h" |
| #include "base/memory/linked_ptr.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| #include "content/browser/renderer_host/image_transport_factory.h" |
| #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| #include "content/common/content_export.h" |
| +#include "third_party/skia/include/core/SkRegion.h" |
| #include "ui/aura/client/activation_delegate.h" |
| #include "ui/aura/window_delegate.h" |
| #include "ui/base/ime/text_input_client.h" |
| +#include "ui/compositor/compositor.h" |
| #include "ui/compositor/compositor_observer.h" |
| #include "ui/gfx/display_observer.h" |
| #include "ui/gfx/rect.h" |
| @@ -121,10 +124,10 @@ class RenderWidgetHostViewAura |
| int gpu_host_id) OVERRIDE; |
| virtual void AcceleratedSurfaceSuspend() OVERRIDE; |
| virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; |
| - virtual void AcceleratedSurfaceNew( |
| - int32 width_in_pixel, |
| - int32 height_in_pixel, |
| - uint64 surface_id) OVERRIDE; |
| + virtual void AcceleratedSurfaceNew(int32 width_in_pixel, |
| + int32 height_in_pixel, |
| + uint64 surface_id, |
| + const std::string& mailbox_name) OVERRIDE; |
| virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; |
| virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; |
| virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; |
| @@ -231,7 +234,7 @@ class RenderWidgetHostViewAura |
| virtual ~RenderWidgetHostViewAura(); |
| void UpdateCursorIfOverSelf(); |
| - bool ShouldFastACK(uint64 surface_id); |
| + bool ShouldSkipFrame(const gfx::Size& size); |
| void UpdateExternalTexture(); |
| ui::InputMethod* GetInputMethod() const; |
| @@ -255,14 +258,23 @@ class RenderWidgetHostViewAura |
| bool ShouldMoveToCenter(); |
| // Run the compositing callbacks. |
| - void RunCompositingDidCommitCallbacks(ui::Compositor* compositor); |
| + void RunCompositingDidCommitCallbacks(); |
| + |
| + struct BufferPresentedParams { |
| + BufferPresentedParams(int route_id, |
| + int gpu_host_id, |
| + uint64 surface_handle); |
| + ~BufferPresentedParams(); |
| + |
| + int32 route_id; |
| + int gpu_host_id; |
| + uint64 surface_handle; |
| + scoped_refptr<ui::Texture> texture_to_produce; |
| + }; |
| // Insert a sync point into the compositor's command stream and acknowledge |
| // that we have presented the accelerated surface buffer. |
| - static void InsertSyncPointAndACK(int32 route_id, |
| - int gpu_host_id, |
| - bool presented, |
| - ui::Compositor* compositor); |
| + static void InsertSyncPointAndACK(const BufferPresentedParams& params); |
|
jonathan.backer
2012/12/04 19:15:13
nit: Maybe this should be in the anonymous namespa
no sievers
2012/12/05 22:02:34
I left it here for now, because if I moved it to t
|
| // Called when window_ gets added to a new window tree. |
| void AddingToRootWindow(); |
| @@ -270,15 +282,9 @@ class RenderWidgetHostViewAura |
| // Called when window_ is removed from the window tree. |
| void RemovingFromRootWindow(); |
| - // After clearing |current_surface_|, and waiting for the compositor to finish |
| - // using it, call this to inform the gpu process. |
| - void SetSurfaceNotInUseByCompositor(ui::Compositor* compositor); |
| - |
| - // This is called every time |current_surface_| usage changes (by thumbnailer, |
| - // compositor draws, and tab visibility). Every time usage of current surface |
| - // changes between "may be used" and "certain to not be used" by the ui, we |
| - // inform the gpu process. |
| - void AdjustSurfaceProtection(); |
| + // Called after commit for the last reference to the texture going away |
| + // after it was released as the frontbuffer. |
| + void SetSurfaceNotInUseByCompositor(scoped_refptr<ui::Texture>); |
| // Called after async thumbnailer task completes. Used to call |
| // AdjustSurfaceProtection. |
| @@ -295,6 +301,12 @@ class RenderWidgetHostViewAura |
| // Converts |rect| from window coordinate to screen coordinate. |
| gfx::Rect ConvertRectToScreen(const gfx::Rect& rect); |
| + bool SwapBuffersPrepare(const gfx::Rect& surface_rect, |
| + const gfx::Rect& damage_rect, |
| + BufferPresentedParams* params); |
| + |
| + void SwapBuffersCompleted(const BufferPresentedParams& params); |
| + |
| // The model object. |
| RenderWidgetHostImpl* host_; |
| @@ -347,27 +359,23 @@ class RenderWidgetHostViewAura |
| // The scale factor of the display the renderer is currently on. |
| float device_scale_factor_; |
| - std::vector< base::Callback<void(ui::Compositor*)> > |
| - on_compositing_did_commit_callbacks_; |
| + std::vector<base::Closure> on_compositing_did_commit_callbacks_; |
| - std::map<uint64, scoped_refptr<ui::Texture> > |
| - image_transport_clients_; |
| + std::map<uint64, scoped_refptr<ui::Texture> > image_transport_clients_; |
| + // The identifier of the current frontbuffer. |
| uint64 current_surface_; |
| - // Protected means that the |current_surface_| may be in use by ui and cannot |
| - // be safely discarded. Things to consider are thumbnailer, compositor draw, |
| - // and tab visibility. |
| - bool current_surface_is_protected_; |
| - bool current_surface_in_use_by_compositor_; |
| + // The damage in the previous buffer. |
|
jonathan.backer
2012/12/04 19:15:13
nit: |previous_damage_| and |previous_surface_size
no sievers
2012/12/05 22:02:34
Done.
|
| + SkRegion previous_damage_; |
| - int pending_thumbnail_tasks_; |
| + // Pending damage from previous frames that we skipped. |
| + SkRegion skipped_damage_; |
| - // This id increments every time surface_is_protected changes. We tag IPC |
| - // messages which rely on protection state with this id to stay in sync. |
| - uint32 protection_state_id_; |
| + // The size of the previously received frame. |
| + gfx::Size previous_surface_size_; |
| - int32 surface_route_id_; |
| + int pending_thumbnail_tasks_; |
| gfx::GLSurfaceHandle shared_surface_handle_; |