| 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 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 void ResourceProvider::CleanUpGLIfNeeded() { | 1314 void ResourceProvider::CleanUpGLIfNeeded() { |
| 1315 GLES2Interface* gl = ContextGL(); | 1315 GLES2Interface* gl = ContextGL(); |
| 1316 if (default_resource_type_ != GLTexture) { | 1316 if (default_resource_type_ != GLTexture) { |
| 1317 // We are not in GL mode, but double check before returning. | 1317 // We are not in GL mode, but double check before returning. |
| 1318 DCHECK(!gl); | 1318 DCHECK(!gl); |
| 1319 DCHECK(!texture_uploader_); | 1319 DCHECK(!texture_uploader_); |
| 1320 return; | 1320 return; |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 DCHECK(gl); | 1323 DCHECK(gl); |
| 1324 #if DCHECK_IS_ON |
| 1325 // Check that all GL resources has been deleted. |
| 1326 for (ResourceMap::const_iterator itr = resources_.begin(); |
| 1327 itr != resources_.end(); |
| 1328 ++itr) { |
| 1329 DCHECK_NE(GLTexture, itr->second.type); |
| 1330 } |
| 1331 #endif // DCHECK_IS_ON |
| 1332 |
| 1324 texture_uploader_.reset(); | 1333 texture_uploader_.reset(); |
| 1325 texture_id_allocator_.reset(); | 1334 texture_id_allocator_.reset(); |
| 1326 buffer_id_allocator_.reset(); | 1335 buffer_id_allocator_.reset(); |
| 1327 Finish(); | 1336 Finish(); |
| 1328 } | 1337 } |
| 1329 | 1338 |
| 1330 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { | 1339 int ResourceProvider::CreateChild(const ReturnCallback& return_callback) { |
| 1331 DCHECK(thread_checker_.CalledOnValidThread()); | 1340 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1332 | 1341 |
| 1333 Child child_info; | 1342 Child child_info; |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 ContextProvider* context_provider = output_surface_->context_provider(); | 2278 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2270 return context_provider ? context_provider->ContextGL() : NULL; | 2279 return context_provider ? context_provider->ContextGL() : NULL; |
| 2271 } | 2280 } |
| 2272 | 2281 |
| 2273 class GrContext* ResourceProvider::GrContext() const { | 2282 class GrContext* ResourceProvider::GrContext() const { |
| 2274 ContextProvider* context_provider = output_surface_->context_provider(); | 2283 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2275 return context_provider ? context_provider->GrContext() : NULL; | 2284 return context_provider ? context_provider->GrContext() : NULL; |
| 2276 } | 2285 } |
| 2277 | 2286 |
| 2278 } // namespace cc | 2287 } // namespace cc |
| OLD | NEW |