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

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

Issue 7529015: Allow the renderer process to map textures from one context into another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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.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);
}
}

Powered by Google App Engine
This is Rietveld 408576698