Chromium Code Reviews| 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..62376144955d4c513c3b82f54f99313a483fe450 100644 |
| --- a/gpu/command_buffer/service/texture_manager.cc |
| +++ b/gpu/command_buffer/service/texture_manager.cc |
| @@ -353,10 +353,33 @@ 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_); |
|
piman
2016/09/07 17:38:31
nit: use chromium style for indents and {} below (
Geoff Lang
2016/09/07 18:14:49
Done.
|
| +} |
| + |
| +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* TextureBase::AsTexture() { |
| + return nullptr; |
| +} |
| + |
| 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 +408,11 @@ Texture::Texture(GLuint service_id) |
| emulating_rgb_(false) {} |
| Texture::~Texture() { |
| - if (mailbox_manager_) |
| - mailbox_manager_->TextureDeleted(this); |
| + DeleteFromMailboxManager(); |
| +} |
| + |
| +Texture* Texture::AsTexture() { |
| + return this; |
| } |
| void Texture::AddTextureRef(TextureRef* ref) { |
| @@ -601,11 +627,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]; |