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 29de185b9eb359735e7b826cf9fc95a1f8ebf61d..7c94e2e7b53a6f559e661ce83f49c0786e6836db 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.h |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h |
@@ -11,6 +11,7 @@ |
#include "base/callback.h" |
#include "base/memory/linked_ptr.h" |
#include "base/memory/ref_counted.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" |
@@ -49,7 +50,8 @@ class RenderWidgetHostViewAura |
public ui::TextInputClient, |
public aura::WindowDelegate, |
public aura::client::ActivationDelegate, |
- public ImageTransportFactoryObserver { |
+ public ImageTransportFactoryObserver, |
+ public base::SupportsWeakPtr<RenderWidgetHostViewAura> { |
public: |
// RenderWidgetHostView implementation. |
virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
@@ -238,6 +240,21 @@ 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 async thumbnailer task completes. Used to call |
+ // AdjustSurfaceProtection. |
+ void CopyFromCompositingSurfaceFinished(base::Callback<void(bool)> callback, |
+ bool result); |
+ |
ui::Compositor* GetCompositor(); |
// Detaches |this| from the input method object. |
@@ -306,6 +323,20 @@ class RenderWidgetHostViewAura |
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_; |
+ |
+ int pending_thumbnail_tasks_; |
+ |
+ // 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_; |
+ |
+ int32 surface_route_id_; |
+ |
gfx::GLSurfaceHandle shared_surface_handle_; |
// If non-NULL we're in OnPaint() and this is the supplied canvas. |