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

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 nits 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 | « components/exo/BUILD.gn ('k') | components/exo/buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/buffer.h
diff --git a/components/exo/buffer.h b/components/exo/buffer.h
index 6502cdfa2efae22697c71370cfbf7748e942be4f..5108c57cc86c3cbd08dd31b3675266a780b32646 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();
+
+ // 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698