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

Unified Diff: components/exo/surface.h

Issue 2083853002: exo: Recreate Surface resources on context lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix browser test Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/exo/surface.cc » ('j') | components/exo/surface.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface.h
diff --git a/components/exo/surface.h b/components/exo/surface.h
index 45395e955a494fc394d52eda077c809ebbf545e3..ae8a9af21f84b5176fd1a014086c58a528ff8fb8 100644
--- a/components/exo/surface.h
+++ b/components/exo/surface.h
@@ -20,6 +20,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 +87,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 +208,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 +270,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);
+
+ // 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,6 +352,8 @@ 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_;
« no previous file with comments | « no previous file | components/exo/surface.cc » ('j') | components/exo/surface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698