| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
| 6 #include "base/bits.h" | 6 #include "base/bits.h" |
| 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 8 #include "gpu/command_buffer/service/feature_info.h" | 8 #include "gpu/command_buffer/service/feature_info.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 10 #include "gpu/GLES2/gles2_command_buffer.h" | 10 #include "gpu/GLES2/gles2_command_buffer.h" |
| 11 | 11 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 TextureManager::~TextureManager() { | 62 TextureManager::~TextureManager() { |
| 63 DCHECK(texture_infos_.empty()); | 63 DCHECK(texture_infos_.empty()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void TextureManager::Destroy(bool have_context) { | 66 void TextureManager::Destroy(bool have_context) { |
| 67 while (!texture_infos_.empty()) { | 67 while (!texture_infos_.empty()) { |
| 68 if (have_context) { | 68 if (have_context) { |
| 69 TextureInfo* info = texture_infos_.begin()->second; | 69 TextureInfo* info = texture_infos_.begin()->second; |
| 70 if (!info->IsDeleted()) { | 70 if (!info->IsDeleted() && info->owned_) { |
| 71 GLuint service_id = info->service_id(); | 71 GLuint service_id = info->service_id(); |
| 72 glDeleteTextures(1, &service_id); | 72 glDeleteTextures(1, &service_id); |
| 73 info->MarkAsDeleted(); | 73 info->MarkAsDeleted(); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 texture_infos_.erase(texture_infos_.begin()); | 76 texture_infos_.erase(texture_infos_.begin()); |
| 77 } | 77 } |
| 78 if (have_context) { | 78 if (have_context) { |
| 79 GLuint ids[] = { | 79 GLuint ids[] = { |
| 80 black_2d_texture_id_, | 80 black_2d_texture_id_, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 return true; | 524 return true; |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 return false; | 527 return false; |
| 528 } | 528 } |
| 529 | 529 |
| 530 } // namespace gles2 | 530 } // namespace gles2 |
| 531 } // namespace gpu | 531 } // namespace gpu |
| 532 | 532 |
| 533 | 533 |
| OLD | NEW |