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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 451 |
452 ResourceProvider::~ResourceProvider() { | 452 ResourceProvider::~ResourceProvider() { |
453 while (!children_.empty()) | 453 while (!children_.empty()) |
454 DestroyChildInternal(children_.begin(), ForShutdown); | 454 DestroyChildInternal(children_.begin(), ForShutdown); |
455 while (!resources_.empty()) | 455 while (!resources_.empty()) |
456 DeleteResourceInternal(resources_.begin(), ForShutdown); | 456 DeleteResourceInternal(resources_.begin(), ForShutdown); |
457 | 457 |
458 CleanUpGLIfNeeded(); | 458 CleanUpGLIfNeeded(); |
459 } | 459 } |
460 | 460 |
| 461 ResourceFormat ResourceProvider::memory_efficient_texture_format( |
| 462 ResourceFormatUsage usage) const { |
| 463 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; |
| 464 } |
| 465 |
461 bool ResourceProvider::InUseByConsumer(ResourceId id) { | 466 bool ResourceProvider::InUseByConsumer(ResourceId id) { |
462 Resource* resource = GetResource(id); | 467 Resource* resource = GetResource(id); |
463 return resource->lock_for_read_count > 0 || resource->exported_count > 0 || | 468 return resource->lock_for_read_count > 0 || resource->exported_count > 0 || |
464 resource->lost; | 469 resource->lost; |
465 } | 470 } |
466 | 471 |
467 bool ResourceProvider::IsLost(ResourceId id) { | 472 bool ResourceProvider::IsLost(ResourceId id) { |
468 Resource* resource = GetResource(id); | 473 Resource* resource = GetResource(id); |
469 return resource->lost; | 474 return resource->lost; |
470 } | 475 } |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 ContextProvider* context_provider = output_surface_->context_provider(); | 2138 ContextProvider* context_provider = output_surface_->context_provider(); |
2134 return context_provider ? context_provider->ContextGL() : NULL; | 2139 return context_provider ? context_provider->ContextGL() : NULL; |
2135 } | 2140 } |
2136 | 2141 |
2137 class GrContext* ResourceProvider::GrContext() const { | 2142 class GrContext* ResourceProvider::GrContext() const { |
2138 ContextProvider* context_provider = output_surface_->context_provider(); | 2143 ContextProvider* context_provider = output_surface_->context_provider(); |
2139 return context_provider ? context_provider->GrContext() : NULL; | 2144 return context_provider ? context_provider->GrContext() : NULL; |
2140 } | 2145 } |
2141 | 2146 |
2142 } // namespace cc | 2147 } // namespace cc |
OLD | NEW |