| 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 "cc/resources/prioritized_resource_manager.h" | 7 #include "cc/resources/prioritized_resource_manager.h" |
| 8 #include "cc/resources/resource.h" | 8 #include "cc/resources/resource.h" |
| 9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
| 10 #include "cc/test/fake_proxy.h" | 10 #include "cc/test/fake_proxy.h" |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 resource_manager->CreateTexture(texture_size_, texture_format_); | 616 resource_manager->CreateTexture(texture_size_, texture_format_); |
| 617 | 617 |
| 618 // Set equal priorities, and allocate backings for all textures. | 618 // Set equal priorities, and allocate backings for all textures. |
| 619 for (size_t i = 0; i < max_textures; ++i) | 619 for (size_t i = 0; i < max_textures; ++i) |
| 620 textures[i]->set_request_priority(100); | 620 textures[i]->set_request_priority(100); |
| 621 PrioritizeTexturesAndBackings(resource_manager.get()); | 621 PrioritizeTexturesAndBackings(resource_manager.get()); |
| 622 for (unsigned i = 0; i < max_textures; ++i) | 622 for (unsigned i = 0; i < max_textures; ++i) |
| 623 EXPECT_TRUE(ValidateTexture(textures[i], false)); | 623 EXPECT_TRUE(ValidateTexture(textures[i], false)); |
| 624 | 624 |
| 625 // Drop the memory limit and prioritize (none will be above the threshold, | 625 // Drop the memory limit and prioritize (none will be above the threshold, |
| 626 // but they still have backings because reduceMemory hasn't been called). | 626 // but they still have backings because ReduceMemory hasn't been called). |
| 627 resource_manager->SetMaxMemoryLimitBytes( | 627 resource_manager->SetMaxMemoryLimitBytes( |
| 628 TexturesMemorySize(max_textures / 2)); | 628 TexturesMemorySize(max_textures / 2)); |
| 629 PrioritizeTexturesAndBackings(resource_manager.get()); | 629 PrioritizeTexturesAndBackings(resource_manager.get()); |
| 630 | 630 |
| 631 // Push half of them back over the limit. | 631 // Push half of them back over the limit. |
| 632 for (size_t i = 0; i < max_textures; i += 2) | 632 for (size_t i = 0; i < max_textures; i += 2) |
| 633 EXPECT_TRUE(textures[i]->RequestLate()); | 633 EXPECT_TRUE(textures[i]->RequestLate()); |
| 634 | 634 |
| 635 // Push the priorities to the backings array and sort the backings array | 635 // Push the priorities to the backings array and sort the backings array |
| 636 ResourceManagerUpdateBackingsPriorities(resource_manager.get()); | 636 ResourceManagerUpdateBackingsPriorities(resource_manager.get()); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 resource_manager->MemoryVisibleAndNearbyBytes()); | 780 resource_manager->MemoryVisibleAndNearbyBytes()); |
| 781 } | 781 } |
| 782 | 782 |
| 783 DebugScopedSetImplThreadAndMainThreadBlocked | 783 DebugScopedSetImplThreadAndMainThreadBlocked |
| 784 impl_thread_and_main_thread_blocked (& proxy_); | 784 impl_thread_and_main_thread_blocked (& proxy_); |
| 785 resource_manager->ClearAllMemory(ResourceProvider()); | 785 resource_manager->ClearAllMemory(ResourceProvider()); |
| 786 } | 786 } |
| 787 | 787 |
| 788 } // namespace | 788 } // namespace |
| 789 } // namespace cc | 789 } // namespace cc |
| OLD | NEW |