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

Unified Diff: gpu/command_buffer/service/texture_manager.h

Issue 2315313003: Add a base class of Texture for interfacing with the mailbox manager. (Closed)
Patch Set: Address piman's comments Created 4 years, 3 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
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..1614c72a225d0fe0acff42a0d77e9f4f38ae8117 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -38,13 +38,37 @@ 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_; }
+
+ 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,
@@ -141,11 +165,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 +308,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 +499,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 +544,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 +555,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
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_unittest.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698