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

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: Rebase 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
« no previous file with comments | « cc/resources/image_layer_updater.cc ('k') | cc/resources/resource_update_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 PrioritizeTexturesAndBackings(resource_manager.get()); 674 PrioritizeTexturesAndBackings(resource_manager.get());
675 for (unsigned i = 0; i < max_textures; ++i) 675 for (unsigned i = 0; i < max_textures; ++i)
676 EXPECT_TRUE(ValidateTexture(textures[i], false)); 676 EXPECT_TRUE(ValidateTexture(textures[i], false));
677 677
678 ResourceUpdateQueue queue; 678 ResourceUpdateQueue queue;
679 DebugScopedSetImplThreadAndMainThreadBlocked 679 DebugScopedSetImplThreadAndMainThreadBlocked
680 impl_thread_and_main_thread_blocked(&proxy_); 680 impl_thread_and_main_thread_blocked(&proxy_);
681 for (size_t i = 0; i < max_textures; ++i) { 681 for (size_t i = 0; i < max_textures; ++i) {
682 const ResourceUpdate upload = ResourceUpdate::Create( 682 const ResourceUpdate upload = ResourceUpdate::Create(
683 textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d()); 683 textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d());
684 queue.appendFullUpload(upload); 684 queue.AppendFullUpload(upload);
685 } 685 }
686 686
687 // Make sure that we have backings for all of the textures. 687 // Make sure that we have backings for all of the textures.
688 for (size_t i = 0; i < max_textures; ++i) 688 for (size_t i = 0; i < max_textures; ++i)
689 EXPECT_TRUE(textures[i]->have_backing_texture()); 689 EXPECT_TRUE(textures[i]->have_backing_texture());
690 690
691 queue.clearUploadsToEvictedResources(); 691 queue.ClearUploadsToEvictedResources();
692 EXPECT_EQ(4, queue.fullUploadSize()); 692 EXPECT_EQ(4, queue.FullUploadSize());
693 693
694 resource_manager->ReduceMemoryOnImplThread( 694 resource_manager->ReduceMemoryOnImplThread(
695 TexturesMemorySize(1), 695 TexturesMemorySize(1),
696 PriorityCalculator::AllowEverythingCutoff(), 696 PriorityCalculator::AllowEverythingCutoff(),
697 ResourceProvider()); 697 ResourceProvider());
698 queue.clearUploadsToEvictedResources(); 698 queue.ClearUploadsToEvictedResources();
699 EXPECT_EQ(1, queue.fullUploadSize()); 699 EXPECT_EQ(1, queue.FullUploadSize());
700 700
701 resource_manager->ReduceMemoryOnImplThread( 701 resource_manager->ReduceMemoryOnImplThread(
702 0, PriorityCalculator::AllowEverythingCutoff(), ResourceProvider()); 702 0, PriorityCalculator::AllowEverythingCutoff(), ResourceProvider());
703 queue.clearUploadsToEvictedResources(); 703 queue.ClearUploadsToEvictedResources();
704 EXPECT_EQ(0, queue.fullUploadSize()); 704 EXPECT_EQ(0, queue.FullUploadSize());
705
706 } 705 }
707 706
708 TEST_F(PrioritizedResourceTest, UsageStatistics) { 707 TEST_F(PrioritizedResourceTest, UsageStatistics) {
709 const size_t max_textures = 5; 708 const size_t max_textures = 5;
710 scoped_ptr<PrioritizedResourceManager> resource_manager = 709 scoped_ptr<PrioritizedResourceManager> resource_manager =
711 CreateManager(max_textures); 710 CreateManager(max_textures);
712 scoped_ptr<PrioritizedResource> textures[max_textures]; 711 scoped_ptr<PrioritizedResource> textures[max_textures];
713 712
714 for (size_t i = 0; i < max_textures; ++i) 713 for (size_t i = 0; i < max_textures; ++i)
715 textures[i] = 714 textures[i] =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 resource_manager->MemoryVisibleAndNearbyBytes()); 780 resource_manager->MemoryVisibleAndNearbyBytes());
782 } 781 }
783 782
784 DebugScopedSetImplThreadAndMainThreadBlocked 783 DebugScopedSetImplThreadAndMainThreadBlocked
785 impl_thread_and_main_thread_blocked (& proxy_); 784 impl_thread_and_main_thread_blocked (& proxy_);
786 resource_manager->ClearAllMemory(ResourceProvider()); 785 resource_manager->ClearAllMemory(ResourceProvider());
787 } 786 }
788 787
789 } // namespace 788 } // namespace
790 } // namespace cc 789 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/image_layer_updater.cc ('k') | cc/resources/resource_update_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698