Index: gpu/command_buffer/service/texture_manager.h |
=================================================================== |
--- gpu/command_buffer/service/texture_manager.h (revision 94701) |
+++ gpu/command_buffer/service/texture_manager.h (working copy) |
@@ -10,6 +10,7 @@ |
#include "base/hash_tables.h" |
#include "base/logging.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "gpu/command_buffer/service/gl_utils.h" |
namespace gpu { |
@@ -22,7 +23,7 @@ |
// |
// NOTE: To support shared resources an instance of this class will need to be |
// shared by multiple GLES2Decoders. |
-class TextureManager { |
+class TextureManager : public base::SupportsWeakPtr<TextureManager> { |
public: |
// Info about Textures currently in the system. |
class TextureInfo : public base::RefCounted<TextureInfo> { |
@@ -42,8 +43,7 @@ |
cube_complete_(false), |
npot_(false), |
has_been_bound_(false), |
- framebuffer_attachment_count_(0), |
- owned_(true) { |
+ framebuffer_attachment_count_(0) { |
} |
GLenum min_filter() const { |
@@ -96,6 +96,10 @@ |
return npot_; |
} |
+ TextureManager* owner() const { |
+ return owner_.get(); |
+ } |
+ |
// Returns true if mipmaps can be generated by GL. |
bool CanGenerateMipmaps(const FeatureInfo* feature_info) const; |
@@ -128,10 +132,6 @@ |
return target() && !IsDeleted(); |
} |
- void SetNotOwned() { |
- owned_ = false; |
- } |
- |
bool IsAttachedToFramebuffer() const { |
return framebuffer_attachment_count_ != 0; |
} |
@@ -250,9 +250,9 @@ |
// 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_; |
+ // The framebuffer manager that controls the lifetime of this framebuffer |
+ // or NULL if it has been deleted. |
+ base::WeakPtr<TextureManager> owner_; |
DISALLOW_COPY_AND_ASSIGN(TextureInfo); |
}; |
@@ -338,6 +338,12 @@ |
// Gets the texture info for the given texture. |
TextureInfo* GetTextureInfo(GLuint client_id); |
+ // Adds a texture info for a texture owned by another texture |
+ // manager. |
+ void AddTextureInfo(const FeatureInfo* feature_info, |
+ GLuint client_id, |
+ TextureInfo* info); |
+ |
// Removes a texture info. |
void RemoveTextureInfo(const FeatureInfo* feature_info, GLuint client_id); |