Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: cc/resources/prioritized_resource_unittest.cc

Issue 12962007: cc: Chromify resource_update_queue (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 textures[i]->set_request_priority(100); 613 textures[i]->set_request_priority(100);
614 prioritizeTexturesAndBackings(resourceManager.get()); 614 prioritizeTexturesAndBackings(resourceManager.get());
615 for (unsigned i = 0; i < maxTextures; ++i) 615 for (unsigned i = 0; i < maxTextures; ++i)
616 EXPECT_TRUE(validateTexture(textures[i], false)); 616 EXPECT_TRUE(validateTexture(textures[i], false));
617 617
618 ResourceUpdateQueue queue; 618 ResourceUpdateQueue queue;
619 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked( &m_proxy); 619 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked( &m_proxy);
620 for (size_t i = 0; i < maxTextures; ++i) { 620 for (size_t i = 0; i < maxTextures; ++i) {
621 const ResourceUpdate upload = ResourceUpdate::Create( 621 const ResourceUpdate upload = ResourceUpdate::Create(
622 textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d()); 622 textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d());
623 queue.appendFullUpload(upload); 623 queue.AppendFullUpload(upload);
624 } 624 }
625 625
626 // Make sure that we have backings for all of the textures. 626 // Make sure that we have backings for all of the textures.
627 for (size_t i = 0; i < maxTextures; ++i) 627 for (size_t i = 0; i < maxTextures; ++i)
628 EXPECT_TRUE(textures[i]->have_backing_texture()); 628 EXPECT_TRUE(textures[i]->have_backing_texture());
629 629
630 queue.clearUploadsToEvictedResources(); 630 queue.ClearUploadsToEvictedResources();
631 EXPECT_EQ(4, queue.fullUploadSize()); 631 EXPECT_EQ(4, queue.FullUploadSize());
632 632
633 resourceManager->reduceMemoryOnImplThread( 633 resourceManager->reduceMemoryOnImplThread(
634 texturesMemorySize(1), PriorityCalculator::AllowEverythingCutoff(), reso urceProvider()); 634 texturesMemorySize(1), PriorityCalculator::AllowEverythingCutoff(), reso urceProvider());
635 queue.clearUploadsToEvictedResources(); 635 queue.ClearUploadsToEvictedResources();
636 EXPECT_EQ(1, queue.fullUploadSize()); 636 EXPECT_EQ(1, queue.FullUploadSize());
637 637
638 resourceManager->reduceMemoryOnImplThread(0, PriorityCalculator::AllowEvery thingCutoff(), resourceProvider()); 638 resourceManager->reduceMemoryOnImplThread(0, PriorityCalculator::AllowEvery thingCutoff(), resourceProvider());
639 queue.clearUploadsToEvictedResources(); 639 queue.ClearUploadsToEvictedResources();
640 EXPECT_EQ(0, queue.fullUploadSize()); 640 EXPECT_EQ(0, queue.FullUploadSize());
641 641
642 } 642 }
643 643
644 TEST_F(PrioritizedResourceTest, usageStatistics) 644 TEST_F(PrioritizedResourceTest, usageStatistics)
645 { 645 {
646 const size_t maxTextures = 5; 646 const size_t maxTextures = 5;
647 scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTe xtures); 647 scoped_ptr<PrioritizedResourceManager> resourceManager = createManager(maxTe xtures);
648 scoped_ptr<PrioritizedResource> textures[maxTextures]; 648 scoped_ptr<PrioritizedResource> textures[maxTextures];
649 649
650 for (size_t i = 0; i < maxTextures; ++i) 650 for (size_t i = 0; i < maxTextures; ++i)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes()); 698 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes());
699 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby Bytes()); 699 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby Bytes());
700 } 700 }
701 701
702 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked( &m_proxy); 702 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked( &m_proxy);
703 resourceManager->clearAllMemory(resourceProvider()); 703 resourceManager->clearAllMemory(resourceProvider());
704 } 704 }
705 705
706 } // namespace 706 } // namespace
707 } // namespace cc 707 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698