| Index: gpu/command_buffer/service/texture_manager.cc
|
| ===================================================================
|
| --- gpu/command_buffer/service/texture_manager.cc (revision 94701)
|
| +++ gpu/command_buffer/service/texture_manager.cc (working copy)
|
| @@ -68,7 +68,7 @@
|
| while (!texture_infos_.empty()) {
|
| if (have_context) {
|
| TextureInfo* info = texture_infos_.begin()->second;
|
| - if (!info->IsDeleted() && info->owned_) {
|
| + if (!info->IsDeleted() && info->owner_.get() == this) {
|
| GLuint service_id = info->service_id();
|
| glDeleteTextures(1, &service_id);
|
| info->MarkAsDeleted();
|
| @@ -556,14 +556,10 @@
|
| TextureManager::TextureInfo* TextureManager::CreateTextureInfo(
|
| const FeatureInfo* feature_info,
|
| GLuint client_id, GLuint service_id) {
|
| - TextureInfo::Ref info(new TextureInfo(service_id));
|
| - std::pair<TextureInfoMap::iterator, bool> result =
|
| - texture_infos_.insert(std::make_pair(client_id, info));
|
| - DCHECK(result.second);
|
| - if (!info->CanRender(feature_info)) {
|
| - ++num_unrenderable_textures_;
|
| - }
|
| - return info.get();
|
| + TextureInfo* texture_info = new TextureInfo(service_id);
|
| + texture_info->owner_ = AsWeakPtr();
|
| + AddTextureInfo(feature_info, client_id, texture_info);
|
| + return texture_info;
|
| }
|
|
|
| TextureManager::TextureInfo* TextureManager::GetTextureInfo(
|
| @@ -572,15 +568,26 @@
|
| return it != texture_infos_.end() ? it->second : NULL;
|
| }
|
|
|
| +void TextureManager::AddTextureInfo(
|
| + const FeatureInfo* feature_info,
|
| + GLuint client_id, TextureInfo* texture_info) {
|
| + std::pair<TextureInfoMap::iterator, bool> result =
|
| + texture_infos_.insert(std::make_pair(client_id, texture_info));
|
| + DCHECK(result.second);
|
| + if (!texture_info->CanRender(feature_info)) {
|
| + ++num_unrenderable_textures_;
|
| + }
|
| +}
|
| +
|
| void TextureManager::RemoveTextureInfo(
|
| const FeatureInfo* feature_info, GLuint client_id) {
|
| TextureInfoMap::iterator it = texture_infos_.find(client_id);
|
| if (it != texture_infos_.end()) {
|
| TextureInfo* info = it->second;
|
| - if (!info->CanRender(feature_info)) {
|
| + if (!info->CanRender(feature_info))
|
| --num_unrenderable_textures_;
|
| - }
|
| - info->MarkAsDeleted();
|
| + if (info->owner_.get() == this)
|
| + info->MarkAsDeleted();
|
| texture_infos_.erase(it);
|
| }
|
| }
|
|
|