Chromium Code Reviews| 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_; |