| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/prioritized_texture.h" | 7 #include "cc/prioritized_texture.h" |
| 8 | 8 |
| 9 #include "cc/prioritized_texture_manager.h" | 9 #include "cc/prioritized_texture_manager.h" |
| 10 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 10 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 for (size_t i = 0; i < maxTextures; ++i) | 609 for (size_t i = 0; i < maxTextures; ++i) |
| 610 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); | 610 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); |
| 611 | 611 |
| 612 // Set equal priorities, and allocate backings for all textures. | 612 // Set equal priorities, and allocate backings for all textures. |
| 613 for (size_t i = 0; i < maxTextures; ++i) | 613 for (size_t i = 0; i < maxTextures; ++i) |
| 614 textures[i]->setRequestPriority(100); | 614 textures[i]->setRequestPriority(100); |
| 615 prioritizeTexturesAndBackings(textureManager.get()); | 615 prioritizeTexturesAndBackings(textureManager.get()); |
| 616 for (unsigned i = 0; i < maxTextures; ++i) | 616 for (unsigned i = 0; i < maxTextures; ++i) |
| 617 EXPECT_TRUE(validateTexture(textures[i], false)); | 617 EXPECT_TRUE(validateTexture(textures[i], false)); |
| 618 | 618 |
| 619 TextureUpdateQueue queue; | 619 ResourceUpdateQueue queue; |
| 620 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 620 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 621 for (size_t i = 0; i < maxTextures; ++i) { | 621 for (size_t i = 0; i < maxTextures; ++i) { |
| 622 const ResourceUpdate upload = ResourceUpdate::Create( | 622 const ResourceUpdate upload = ResourceUpdate::Create( |
| 623 textures[i].get(), NULL, IntRect(), IntRect(), IntSize()); | 623 textures[i].get(), NULL, IntRect(), IntRect(), IntSize()); |
| 624 queue.appendFullUpload(upload); | 624 queue.appendFullUpload(upload); |
| 625 } | 625 } |
| 626 | 626 |
| 627 // Make sure that we have backings for all of the textures. | 627 // Make sure that we have backings for all of the textures. |
| 628 for (size_t i = 0; i < maxTextures; ++i) | 628 for (size_t i = 0; i < maxTextures; ++i) |
| 629 EXPECT_TRUE(textures[i]->haveBackingTexture()); | 629 EXPECT_TRUE(textures[i]->haveBackingTexture()); |
| 630 | 630 |
| 631 queue.clearUploadsToEvictedResources(); | 631 queue.clearUploadsToEvictedResources(); |
| 632 EXPECT_EQ(4, queue.fullUploadSize()); | 632 EXPECT_EQ(4, queue.fullUploadSize()); |
| 633 | 633 |
| 634 textureManager->reduceMemoryOnImplThread( | 634 textureManager->reduceMemoryOnImplThread( |
| 635 texturesMemorySize(1), PriorityCalculator::allowEverythingCutoff(), reso
urceProvider()); | 635 texturesMemorySize(1), PriorityCalculator::allowEverythingCutoff(), reso
urceProvider()); |
| 636 queue.clearUploadsToEvictedResources(); | 636 queue.clearUploadsToEvictedResources(); |
| 637 EXPECT_EQ(1, queue.fullUploadSize()); | 637 EXPECT_EQ(1, queue.fullUploadSize()); |
| 638 | 638 |
| 639 textureManager->reduceMemoryOnImplThread(0, PriorityCalculator::allowEveryt
hingCutoff(), resourceProvider()); | 639 textureManager->reduceMemoryOnImplThread(0, PriorityCalculator::allowEveryt
hingCutoff(), resourceProvider()); |
| 640 queue.clearUploadsToEvictedResources(); | 640 queue.clearUploadsToEvictedResources(); |
| 641 EXPECT_EQ(0, queue.fullUploadSize()); | 641 EXPECT_EQ(0, queue.fullUploadSize()); |
| 642 | 642 |
| 643 } | 643 } |
| 644 | 644 |
| 645 } // namespace | 645 } // namespace |
| OLD | NEW |