| 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/prioritized_resource.h" | 5 #include "cc/resources/prioritized_resource.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/resources/prioritized_resource_manager.h" | 9 #include "cc/resources/prioritized_resource_manager.h" |
| 10 #include "cc/resources/resource.h" | 10 #include "cc/resources/resource.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 resource_provider_ = FakeResourceProvider::Create( | 32 resource_provider_ = FakeResourceProvider::Create( |
| 33 output_surface_.get(), shared_bitmap_manager_.get()); | 33 output_surface_.get(), shared_bitmap_manager_.get()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 ~PrioritizedResourceTest() override { | 36 ~PrioritizedResourceTest() override { |
| 37 DebugScopedSetImplThread impl_thread(&proxy_); | 37 DebugScopedSetImplThread impl_thread(&proxy_); |
| 38 resource_provider_ = nullptr; | 38 resource_provider_ = nullptr; |
| 39 } | 39 } |
| 40 | 40 |
| 41 size_t TexturesMemorySize(size_t texture_count) { | 41 size_t TexturesMemorySize(size_t texture_count) { |
| 42 return Resource::MemorySizeBytes(texture_size_, texture_format_) * | 42 return Resource::UncheckedMemorySizeBytes(texture_size_, texture_format_) * |
| 43 texture_count; | 43 texture_count; |
| 44 } | 44 } |
| 45 | 45 |
| 46 scoped_ptr<PrioritizedResourceManager> CreateManager(size_t max_textures) { | 46 scoped_ptr<PrioritizedResourceManager> CreateManager(size_t max_textures) { |
| 47 scoped_ptr<PrioritizedResourceManager> manager = | 47 scoped_ptr<PrioritizedResourceManager> manager = |
| 48 PrioritizedResourceManager::Create(&proxy_); | 48 PrioritizedResourceManager::Create(&proxy_); |
| 49 manager->SetMaxMemoryLimitBytes(TexturesMemorySize(max_textures)); | 49 manager->SetMaxMemoryLimitBytes(TexturesMemorySize(max_textures)); |
| 50 return manager.Pass(); | 50 return manager.Pass(); |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 resource_manager->MemoryVisibleAndNearbyBytes()); | 1104 resource_manager->MemoryVisibleAndNearbyBytes()); |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 DebugScopedSetImplThreadAndMainThreadBlocked | 1107 DebugScopedSetImplThreadAndMainThreadBlocked |
| 1108 impl_thread_and_main_thread_blocked(&proxy_); | 1108 impl_thread_and_main_thread_blocked(&proxy_); |
| 1109 resource_manager->ClearAllMemory(resource_provider()); | 1109 resource_manager->ClearAllMemory(resource_provider()); |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 } // namespace | 1112 } // namespace |
| 1113 } // namespace cc | 1113 } // namespace cc |
| OLD | NEW |