| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 void ResourceProvider::CleanUpGLIfNeeded() { | 1252 void ResourceProvider::CleanUpGLIfNeeded() { |
| 1253 GLES2Interface* gl = ContextGL(); | 1253 GLES2Interface* gl = ContextGL(); |
| 1254 if (default_resource_type_ != GLTexture) { | 1254 if (default_resource_type_ != GLTexture) { |
| 1255 // We are not in GL mode, but double check before returning. | 1255 // We are not in GL mode, but double check before returning. |
| 1256 DCHECK(!gl); | 1256 DCHECK(!gl); |
| 1257 DCHECK(!texture_uploader_); | 1257 DCHECK(!texture_uploader_); |
| 1258 return; | 1258 return; |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 DCHECK(gl); | 1261 DCHECK(gl); |
| 1262 #if DCHECK_IS_ON | 1262 #if DCHECK_IS_ON() |
| 1263 // Check that all GL resources has been deleted. | 1263 // Check that all GL resources has been deleted. |
| 1264 for (ResourceMap::const_iterator itr = resources_.begin(); | 1264 for (ResourceMap::const_iterator itr = resources_.begin(); |
| 1265 itr != resources_.end(); | 1265 itr != resources_.end(); |
| 1266 ++itr) { | 1266 ++itr) { |
| 1267 DCHECK_NE(GLTexture, itr->second.type); | 1267 DCHECK_NE(GLTexture, itr->second.type); |
| 1268 } | 1268 } |
| 1269 #endif // DCHECK_IS_ON | 1269 #endif // DCHECK_IS_ON() |
| 1270 | 1270 |
| 1271 texture_uploader_ = nullptr; | 1271 texture_uploader_ = nullptr; |
| 1272 texture_id_allocator_ = nullptr; | 1272 texture_id_allocator_ = nullptr; |
| 1273 buffer_id_allocator_ = nullptr; | 1273 buffer_id_allocator_ = nullptr; |
| 1274 gl->Finish(); | 1274 gl->Finish(); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { | 1277 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { |
| 1278 DCHECK(thread_checker_.CalledOnValidThread()); | 1278 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1279 | 1279 |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 ContextProvider* context_provider = output_surface_->context_provider(); | 2133 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2134 return context_provider ? context_provider->ContextGL() : NULL; | 2134 return context_provider ? context_provider->ContextGL() : NULL; |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 class GrContext* ResourceProvider::GrContext() const { | 2137 class GrContext* ResourceProvider::GrContext() const { |
| 2138 ContextProvider* context_provider = output_surface_->context_provider(); | 2138 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2139 return context_provider ? context_provider->GrContext() : NULL; | 2139 return context_provider ? context_provider->GrContext() : NULL; |
| 2140 } | 2140 } |
| 2141 | 2141 |
| 2142 } // namespace cc | 2142 } // namespace cc |
| OLD | NEW |