| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sky/viewer/compositor/resource_manager.h" | 5 #include "services/sky/compositor/resource_manager.h" |
| 6 | 6 |
| 7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
| 8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "gpu/GLES2/gl2chromium.h" | 13 #include "gpu/GLES2/gl2chromium.h" |
| 14 #include "gpu/GLES2/gl2extchromium.h" | 14 #include "gpu/GLES2/gl2extchromium.h" |
| 15 #include "mojo/converters/geometry/geometry_type_converters.h" | 15 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 16 #include "mojo/gpu/gl_context.h" | 16 #include "mojo/gpu/gl_context.h" |
| 17 #include "mojo/gpu/gl_texture.h" | 17 #include "mojo/gpu/gl_texture.h" |
| 18 #include "mojo/public/c/gles2/gles2.h" | 18 #include "mojo/public/c/gles2/gles2.h" |
| 19 #include "sky/viewer/compositor/layer.h" | 19 #include "services/sky/compositor/layer.h" |
| 20 | 20 |
| 21 namespace sky { | 21 namespace sky { |
| 22 | 22 |
| 23 ResourceManager::ResourceManager(base::WeakPtr<mojo::GLContext> gl_context) | 23 ResourceManager::ResourceManager(base::WeakPtr<mojo::GLContext> gl_context) |
| 24 : gl_context_(gl_context), next_resource_id_(0) { | 24 : gl_context_(gl_context), next_resource_id_(0) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 ResourceManager::~ResourceManager() { | 27 ResourceManager::~ResourceManager() { |
| 28 STLDeleteContainerPairSecondPointers(resource_to_texture_map_.begin(), | 28 STLDeleteContainerPairSecondPointers(resource_to_texture_map_.begin(), |
| 29 resource_to_texture_map_.end()); | 29 resource_to_texture_map_.end()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 continue; | 84 continue; |
| 85 scoped_ptr<mojo::GLTexture> texture(iter->second); | 85 scoped_ptr<mojo::GLTexture> texture(iter->second); |
| 86 DCHECK_NE(0u, texture->texture_id()); | 86 DCHECK_NE(0u, texture->texture_id()); |
| 87 resource_to_texture_map_.erase(iter); | 87 resource_to_texture_map_.erase(iter); |
| 88 glWaitSyncPointCHROMIUM(resource->sync_point); | 88 glWaitSyncPointCHROMIUM(resource->sync_point); |
| 89 texture_cache_.PutTexture(texture.Pass()); | 89 texture_cache_.PutTexture(texture.Pass()); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace examples | 93 } // namespace examples |
| OLD | NEW |