Index: gpu/command_buffer/service/texture_manager.h |
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h |
index 6b7ff12bd7846b3e1847abe4735331e871738559..2fc1cb9d381b588ca3191bfd8e905de34c8bd9a0 100644 |
--- a/gpu/command_buffer/service/texture_manager.h |
+++ b/gpu/command_buffer/service/texture_manager.h |
@@ -42,6 +42,7 @@ class TextureManager { |
cube_complete_(false), |
npot_(false), |
has_been_bound_(false), |
+ framebuffer_attachment_count_(0), |
owned_(true) { |
} |
@@ -131,6 +132,19 @@ class TextureManager { |
owned_ = false; |
} |
+ bool IsAttachedToFramebuffer() const { |
+ return framebuffer_attachment_count_ != 0; |
+ } |
+ |
+ void AttachToFramebuffer() { |
+ ++framebuffer_attachment_count_; |
+ } |
+ |
+ void DetachFromFramebuffer() { |
+ DCHECK(framebuffer_attachment_count_ > 0); |
+ --framebuffer_attachment_count_; |
+ } |
+ |
private: |
friend class TextureManager; |
friend class base::RefCounted<TextureInfo>; |
@@ -240,6 +254,9 @@ class TextureManager { |
// Whether this texture has ever been bound. |
bool has_been_bound_; |
+ // The number of framebuffers this texture is attached to. |
+ int framebuffer_attachment_count_; |
+ |
// Whether the associated context group owns this texture and should delete |
// it. |
bool owned_; |