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

Unified Diff: components/exo/buffer.h

Issue 2083853002: exo: Recreate Surface resources on context lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix deps 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
Index: components/exo/buffer.h
diff --git a/components/exo/buffer.h b/components/exo/buffer.h
index 6502cdfa2efae22697c71370cfbf7748e942be4f..d1d47d4f5b5a31d9b296f72757dfbfa10ad8e79a 100644
--- a/components/exo/buffer.h
+++ b/components/exo/buffer.h
@@ -62,6 +62,12 @@ class Buffer : public base::SupportsWeakPtr<Buffer> {
bool secure_output_only,
bool client_usage);
+ // This should be called when the buffer is attached to a Surface.
+ void OnAttach() { ++attach_count_; }
reveman 2016/06/23 00:44:38 Can you move this to .cc file and add a DLOG(WARNI
+
+ // This should be called when the buffer is detached from a surface.
+ void OnDetach();
+
// Returns the size of the buffer.
gfx::Size GetSize() const;
@@ -75,6 +81,9 @@ class Buffer : public base::SupportsWeakPtr<Buffer> {
// as been released if it reached 0.
void Release();
+ // Runs the release callback if the buffer isn't attached or in use.
+ void CheckReleaseCallback();
+
// This is used by ProduceTextureMailbox() to produce a release callback
// that releases a texture so it can be destroyed or reused.
void ReleaseTexture(std::unique_ptr<Texture> texture);
@@ -104,6 +113,9 @@ class Buffer : public base::SupportsWeakPtr<Buffer> {
// notify the client that buffer has been released.
unsigned use_count_;
+ // This keeps track of how many Surfaces the buffer is attached to.
+ unsigned attach_count_ = 0;
+
// The last used texture. ProduceTextureMailbox() will use this
// instead of creating a new texture when possible.
std::unique_ptr<Texture> texture_;
« no previous file with comments | « components/exo/BUILD.gn ('k') | components/exo/buffer.cc » ('j') | components/exo/surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698