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

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

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
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 2a3d4aed6970daaed4985b05e6a0fda83d6dc11a..8899aaee3edf69bcbeb6604863f993b21afe53bc 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -353,10 +353,28 @@ void TextureManager::Destroy(bool have_context) {
DCHECK_EQ(0u, memory_type_tracker_->GetMemRepresented());
}
+TextureBase::TextureBase(GLuint service_id)
+ : service_id_(service_id), mailbox_manager_(nullptr) {}
+
+TextureBase::~TextureBase() {
+ DCHECK_EQ(nullptr, mailbox_manager_);
+}
+
+void TextureBase::DeleteFromMailboxManager() {
+ if (mailbox_manager_) {
+ mailbox_manager_->TextureDeleted(this);
+ mailbox_manager_ = nullptr;
+ }
+}
+
+void TextureBase::SetMailboxManager(MailboxManager* mailbox_manager) {
+ DCHECK(!mailbox_manager_ || mailbox_manager_ == mailbox_manager);
+ mailbox_manager_ = mailbox_manager;
+}
+
Texture::Texture(GLuint service_id)
- : mailbox_manager_(NULL),
+ : TextureBase(service_id),
memory_tracking_ref_(NULL),
- service_id_(service_id),
owned_service_id_(service_id),
cleared_(true),
num_uncleared_mips_(0),
@@ -385,8 +403,7 @@ Texture::Texture(GLuint service_id)
emulating_rgb_(false) {}
Texture::~Texture() {
- if (mailbox_manager_)
- mailbox_manager_->TextureDeleted(this);
+ DeleteFromMailboxManager();
}
void Texture::AddTextureRef(TextureRef* ref) {
@@ -601,11 +618,6 @@ void Texture::AddToSignature(
sizeof(signature_data));
}
-void Texture::SetMailboxManager(MailboxManager* mailbox_manager) {
- DCHECK(!mailbox_manager_ || mailbox_manager_ == mailbox_manager);
- mailbox_manager_ = mailbox_manager;
-}
-
void Texture::MarkMipmapsGenerated() {
for (size_t ii = 0; ii < face_infos_.size(); ++ii) {
const Texture::FaceInfo& face_info = face_infos_[ii];
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698