Chromium Code Reviews| 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 0c74c4b85057e97ac057420b9503bb45c1bb9ec4..8a1eb75189111cb3d7bd6db1d0ebe0d2824c0433 100644 |
| --- a/gpu/command_buffer/service/texture_manager.h |
| +++ b/gpu/command_buffer/service/texture_manager.h |
| @@ -38,13 +38,40 @@ class ErrorState; |
| class FeatureInfo; |
| class FramebufferManager; |
| class MailboxManager; |
| +class Texture; |
| class TextureManager; |
| class TextureRef; |
| +class GPU_EXPORT TextureBase { |
| + public: |
| + explicit TextureBase(GLuint service_id); |
| + virtual ~TextureBase(); |
| + |
| + // The service side OpenGL id of the texture. |
| + GLuint service_id() const { return service_id_; } |
| + |
| + // Down-cast to other texture classes |
| + virtual Texture* AsTexture(); |
|
piman
2016/09/07 17:38:31
Will we ever use more than one derived type in a g
Geoff Lang
2016/09/07 18:14:49
No, each mailbox manager will only ever use one ki
|
| + |
| + protected: |
| + // The id of the texture. |
| + GLuint service_id_; |
| + |
| + void DeleteFromMailboxManager(); |
| + |
| + private: |
| + friend class MailboxManagerSync; |
| + friend class MailboxManagerImpl; |
| + |
| + void SetMailboxManager(MailboxManager* mailbox_manager); |
| + |
| + MailboxManager* mailbox_manager_; |
| +}; |
| + |
| // Info about Textures currently in the system. |
| // This class wraps a real GL texture, keeping track of its meta-data. It is |
| // jointly owned by possibly multiple TextureRef. |
| -class GPU_EXPORT Texture { |
| +class GPU_EXPORT Texture final : public TextureBase { |
| public: |
| enum ImageState { |
| // If an image is associated with the texture and image state is UNBOUND, |
| @@ -73,6 +100,8 @@ class GPU_EXPORT Texture { |
| explicit Texture(GLuint service_id); |
| + Texture* AsTexture() final; |
| + |
| const SamplerState& sampler_state() const { |
| return sampler_state_; |
| } |
| @@ -141,11 +170,6 @@ class GPU_EXPORT Texture { |
| bool CanRenderTo(const FeatureInfo* feature_info, GLint level) const; |
| - // The service side OpenGL id of the texture. |
| - GLuint service_id() const { |
| - return service_id_; |
| - } |
| - |
| void SetServiceId(GLuint service_id) { |
| DCHECK(service_id); |
| DCHECK_EQ(owned_service_id_, service_id_); |
| @@ -289,7 +313,7 @@ class GPU_EXPORT Texture { |
| friend class TextureRef; |
| friend class TextureTestHelper; |
| - ~Texture(); |
| + ~Texture() override; |
| void AddTextureRef(TextureRef* ref); |
| void RemoveTextureRef(TextureRef* ref, bool have_context); |
| MemoryTypeTracker* GetMemTracker(); |
| @@ -480,8 +504,6 @@ class GPU_EXPORT Texture { |
| const FeatureInfo* feature_info, |
| GLenum target, GLint level, std::string* signature) const; |
| - void SetMailboxManager(MailboxManager* mailbox_manager); |
| - |
| // Updates the unsafe textures count in all the managers referencing this |
| // texture. |
| void UpdateSafeToRenderFrom(bool cleared); |
| @@ -527,8 +549,6 @@ class GPU_EXPORT Texture { |
| GLenum GetCompatibilitySwizzleForChannel(GLenum channel); |
| void SetCompatibilitySwizzle(const CompatibilitySwizzle* swizzle); |
| - MailboxManager* mailbox_manager_; |
| - |
| // Info about each face and level of texture. |
| std::vector<FaceInfo> face_infos_; |
| @@ -540,9 +560,6 @@ class GPU_EXPORT Texture { |
| // one of refs_. |
| TextureRef* memory_tracking_ref_; |
| - // The id of the texture. |
| - GLuint service_id_; |
| - |
| // The id of the texture that we are responsible for deleting. Normally, this |
| // is the same as |service_id_|, unless a GLStreamTextureImage with its own |
| // service id is bound. In that case the GLStreamTextureImage service id is |