Chromium Code Reviews| Index: sky/compositor/resource_manager.cc |
| diff --git a/sky/compositor/resource_manager.cc b/sky/compositor/resource_manager.cc |
| index 5fee461b75e37324385baee94f0fe2a8ae6fb7cc..38c7cca342f3174e0bf813b4ae632ca2196f859e 100644 |
| --- a/sky/compositor/resource_manager.cc |
| +++ b/sky/compositor/resource_manager.cc |
| @@ -9,6 +9,7 @@ |
| #endif |
| #include "base/logging.h" |
| +#include "base/stl_util.h" |
| #include "gpu/GLES2/gl2chromium.h" |
| #include "gpu/GLES2/gl2extchromium.h" |
| #include "mojo/converters/geometry/geometry_type_converters.h" |
| @@ -24,6 +25,8 @@ ResourceManager::ResourceManager(base::WeakPtr<mojo::GLContext> gl_context) |
| } |
| ResourceManager::~ResourceManager() { |
| + STLDeleteContainerPairSecondPointers(resource_to_texture_map_.begin(), |
| + resource_to_texture_map_.end()); |
|
ojan
2014/11/25 19:27:47
git cl format plz
|
| } |
| scoped_ptr<mojo::GLTexture> ResourceManager::CreateTexture( |
| @@ -73,11 +76,14 @@ void ResourceManager::ReturnResources( |
| for (size_t i = 0u; i < resources.size(); ++i) { |
| mojo::ReturnedResourcePtr resource = resources[i].Pass(); |
| DCHECK_EQ(1, resource->count); |
| - glWaitSyncPointCHROMIUM(resource->sync_point); |
| - mojo::GLTexture* texture = resource_to_texture_map_[resource->id]; |
| + auto iter = resource_to_texture_map_.find(resource->id); |
| + if (iter == resource_to_texture_map_.end()) |
| + continue; |
| + mojo::GLTexture* texture = iter->second; |
| DCHECK_NE(0u, texture->texture_id()); |
| - resource_to_texture_map_.erase(resource->id); |
| + resource_to_texture_map_.erase(iter); |
| // TODO(abarth): Consider recycling the texture. |
| + glWaitSyncPointCHROMIUM(resource->sync_point); |
| delete texture; |
| } |
| } |