Chromium Code Reviews| Index: components/exo/surface.h |
| diff --git a/components/exo/surface.h b/components/exo/surface.h |
| index 45395e955a494fc394d52eda077c809ebbf545e3..5cf95fbfdfccc6b92182540676bef3874139f476 100644 |
| --- a/components/exo/surface.h |
| +++ b/components/exo/surface.h |
| @@ -11,6 +11,7 @@ |
| #include <utility> |
| #include "base/callback.h" |
| +#include "base/callback_helpers.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| @@ -20,6 +21,7 @@ |
| #include "third_party/skia/include/core/SkRegion.h" |
| #include "third_party/skia/include/core/SkXfermode.h" |
| #include "ui/aura/window.h" |
| +#include "ui/compositor/compositor.h" |
| #include "ui/compositor/layer_owner_delegate.h" |
| #include "ui/gfx/geometry/rect.h" |
| @@ -86,7 +88,8 @@ class SurfaceFactoryOwner : public base::RefCounted<SurfaceFactoryOwner>, |
| // This class represents a rectangular area that is displayed on the screen. |
| // It has a location, size and pixel contents. |
| -class Surface : public ui::LayerOwnerDelegate { |
| +class Surface : public ui::LayerOwnerDelegate, |
| + public ui::ContextFactoryObserver { |
| public: |
| typedef void (*PropertyDeallocator)(int64_t value); |
| @@ -206,6 +209,9 @@ class Surface : public ui::LayerOwnerDelegate { |
| // Overridden from ui::LayerOwnerDelegate: |
| void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; |
| + // Overridden from ui::ContextFactoryObserver. |
| + void OnLostResources() override; |
| + |
| void WillDraw(cc::SurfaceId surface_id); |
| // Check whether this Surface and its children need to create new cc::Surface |
| @@ -265,6 +271,16 @@ class Surface : public ui::LayerOwnerDelegate { |
| // Set SurfaceLayer contents to the current buffer. |
| void SetSurfaceLayerContents(ui::Layer* layer); |
| + // Updates current_resource_ with a new resource id corresponding to the |
| + // contents of the attached buffer (or id 0, if no buffer is attached). |
| + // UpdateSurface must be called afterwards to ensure the release callback |
| + // will be called. |
| + void CreateResource(bool for_commit); |
|
reveman
2016/06/22 17:15:26
nit: UpdateResource?
jbauman
2016/06/22 23:45:48
Done.
|
| + |
| + // Updates the current Surface with a new frame referring to the resource in |
| + // current_resource_. |
| + void UpdateSurface(bool for_commit); |
| + |
| int64_t SetPropertyInternal(const void* key, |
| const char* name, |
| PropertyDeallocator deallocator, |
| @@ -337,9 +353,14 @@ class Surface : public ui::LayerOwnerDelegate { |
| // The buffer that is currently set as content of surface. |
| base::WeakPtr<Buffer> current_buffer_; |
| + bool frame_is_opaque_ = false; |
| + |
| // The last resource that was sent to a surface. |
| cc::TransferableResource current_resource_; |
| + // This holds onto the release callback for the current buffer. |
| + base::ScopedClosureRunner current_buffer_release_runner_; |
| + |
| // This is true if a call to Commit() as been made but |
| // CommitSurfaceHierarchy() has not yet been called. |
| bool needs_commit_surface_hierarchy_; |