Lines Matching defs:resource_manager
59 ResourceManagerAssertInvariants(texture->resource_manager());
62 ResourceManagerAssertInvariants(texture->resource_manager());
72 PrioritizedResourceManager* resource_manager) {
73 resource_manager->PrioritizeTextures();
74 ResourceManagerUpdateBackingsPriorities(resource_manager);
78 PrioritizedResourceManager* resource_manager) {
81 resource_manager->PushTexturePrioritiesToBackings();
87 PrioritizedResourceManager* resource_manager) {
90 resource_manager->AssertInvariants();
98 size_t EvictedBackingCount(PrioritizedResourceManager* resource_manager) {
99 return resource_manager->evicted_backings_.size();
103 PrioritizedResourceManager* resource_manager) {
106 resource_manager->backings_.begin();
107 it != resource_manager->backings_.end();
127 scoped_ptr<PrioritizedResourceManager> resource_manager =
135 resource_manager->CreateTexture(texture_size_, texture_format_);
142 PrioritizeTexturesAndBackings(resource_manager.get());
153 PrioritizeTexturesAndBackings(resource_manager.get());
160 resource_manager->MemoryAboveCutoffBytes());
161 EXPECT_LE(resource_manager->MemoryUseBytes(),
162 resource_manager->MemoryAboveCutoffBytes());
164 resource_manager->MaxMemoryNeededBytes());
168 resource_manager->ClearAllMemory(resource_provider());
173 scoped_ptr<PrioritizedResourceManager> resource_manager =
179 resource_manager->CreateTexture(texture_size_, texture_format_);
185 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(8));
186 PrioritizeTexturesAndBackings(resource_manager.get());
192 resource_manager->ReduceMemory(resource_provider());
195 EXPECT_EQ(TexturesMemorySize(8), resource_manager->MemoryAboveCutoffBytes());
196 EXPECT_LE(resource_manager->MemoryUseBytes(),
197 resource_manager->MemoryAboveCutoffBytes());
200 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(5));
201 PrioritizeTexturesAndBackings(resource_manager.get());
207 resource_manager->ReduceMemory(resource_provider());
210 EXPECT_EQ(TexturesMemorySize(5), resource_manager->MemoryAboveCutoffBytes());
211 EXPECT_LE(resource_manager->MemoryUseBytes(),
212 resource_manager->MemoryAboveCutoffBytes());
214 resource_manager->MaxMemoryNeededBytes());
217 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(4));
218 PrioritizeTexturesAndBackings(resource_manager.get());
224 resource_manager->ReduceMemory(resource_provider());
227 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryAboveCutoffBytes());
228 EXPECT_LE(resource_manager->MemoryUseBytes(),
229 resource_manager->MemoryAboveCutoffBytes());
231 resource_manager->MaxMemoryNeededBytes());
235 resource_manager->ClearAllMemory(resource_provider());
240 scoped_ptr<PrioritizedResourceManager> resource_manager =
246 resource_manager->CreateTexture(texture_size_, texture_format_);
252 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(kMaxTextures));
253 PrioritizeTexturesAndBackings(resource_manager.get());
273 resource_manager->ReduceMemory(resource_provider());
277 EXPECT_EQ(TexturesMemorySize(20), resource_manager->MemoryUseBytes());
281 PrioritizeTexturesAndBackings(resource_manager.get());
285 resource_manager->UpdateBackingsState(resource_provider());
286 resource_manager->ReduceWastedMemory(resource_provider());
288 EXPECT_EQ(TexturesMemorySize(20), resource_manager->MemoryUseBytes());
294 PrioritizeTexturesAndBackings(resource_manager.get());
298 resource_manager->UpdateBackingsState(resource_provider());
299 resource_manager->ReduceWastedMemory(resource_provider());
301 EXPECT_GT(TexturesMemorySize(20), resource_manager->MemoryUseBytes());
305 resource_manager->ClearAllMemory(resource_provider());
310 scoped_ptr<PrioritizedResourceManager> resource_manager =
316 resource_manager->CreateTexture(texture_size_, texture_format_);
322 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(kMaxTextures));
323 PrioritizeTexturesAndBackings(resource_manager.get());
343 resource_manager->ReduceMemory(resource_provider());
347 EXPECT_EQ(TexturesMemorySize(20), resource_manager->MemoryUseBytes());
361 PrioritizeTexturesAndBackings(resource_manager.get());
365 resource_manager->UpdateBackingsState(resource_provider());
366 resource_manager->ReduceWastedMemory(resource_provider());
368 EXPECT_EQ(TexturesMemorySize(20), resource_manager->MemoryUseBytes());
378 resource_manager->UpdateBackingsState(resource_provider());
379 resource_manager->ReduceWastedMemory(resource_provider());
381 EXPECT_GT(TexturesMemorySize(20), resource_manager->MemoryUseBytes());
385 resource_manager->ClearAllMemory(resource_provider());
390 scoped_ptr<PrioritizedResourceManager> resource_manager =
396 resource_manager->CreateTexture(texture_size_, texture_format_);
404 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(8));
405 resource_manager->SetExternalPriorityCutoff(106);
406 PrioritizeTexturesAndBackings(resource_manager.get());
412 resource_manager->ReduceMemory(resource_provider());
414 EXPECT_EQ(TexturesMemorySize(6), resource_manager->MemoryAboveCutoffBytes());
415 EXPECT_LE(resource_manager->MemoryUseBytes(),
416 resource_manager->MemoryAboveCutoffBytes());
419 resource_manager->SetExternalPriorityCutoff(104);
420 PrioritizeTexturesAndBackings(resource_manager.get());
426 resource_manager->ReduceMemory(resource_provider());
428 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryAboveCutoffBytes());
431 resource_manager->UnlinkAndClearEvictedBackings();
435 resource_manager->ReduceMemoryOnImplThread(
437 EXPECT_EQ(0u, EvictedBackingCount(resource_manager.get()));
438 resource_manager->ReduceMemoryOnImplThread(
440 EXPECT_EQ(1u, EvictedBackingCount(resource_manager.get()));
442 resource_manager->UnlinkAndClearEvictedBackings();
443 EXPECT_EQ(TexturesMemorySize(3), resource_manager->MemoryUseBytes());
446 PrioritizeTexturesAndBackings(resource_manager.get());
452 resource_manager->ReduceMemory(resource_provider());
454 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryAboveCutoffBytes());
458 resource_manager->ClearAllMemory(resource_provider());
463 scoped_ptr<PrioritizedResourceManager> resource_manager =
470 resource_manager->CreateTexture(texture_size_, texture_format_);
474 PrioritizeTexturesAndBackings(resource_manager.get());
492 resource_manager->ReduceMemory(resource_provider());
494 EXPECT_EQ(TexturesMemorySize(8), resource_manager->MemoryAboveCutoffBytes());
503 resource_manager->ReduceMemoryOnImplThread(
506 EXPECT_EQ(4u, EvictedBackingCount(resource_manager.get()));
509 std::vector<unsigned> remaining = BackingResources(resource_manager.get());
523 resource_manager->UnlinkAndClearEvictedBackings();
524 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryUseBytes());
527 PrioritizeTexturesAndBackings(resource_manager.get());
545 resource_manager->ReduceMemory(resource_provider());
547 EXPECT_EQ(TexturesMemorySize(8), resource_manager->MemoryAboveCutoffBytes());
569 PrioritizeTexturesAndBackings(resource_manager.get());
575 resource_manager->UpdateBackingsState(resource_provider());
583 resource_manager->ReduceMemoryOnImplThread(
586 EXPECT_EQ(4u, EvictedBackingCount(resource_manager.get()));
588 std::vector<unsigned> remaining = BackingResources(resource_manager.get());
596 resource_manager->UnlinkAndClearEvictedBackings();
597 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryUseBytes());
601 resource_manager->ClearAllMemory(resource_provider());
607 scoped_ptr<PrioritizedResourceManager> resource_manager =
614 resource_manager->CreateTexture(texture_size_, texture_format_);
616 resource_manager->CreateTexture(texture_size_, texture_format_);
621 PrioritizeTexturesAndBackings(resource_manager.get());
636 PrioritizeTexturesAndBackings(resource_manager.get());
664 resource_manager->ClearAllMemory(resource_provider());
669 scoped_ptr<PrioritizedResourceManager> resource_manager =
675 resource_manager->CreateTexture(texture_size_, texture_format_);
685 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(8));
686 PrioritizeTexturesAndBackings(resource_manager.get());
693 EXPECT_EQ(TexturesMemorySize(2), resource_manager->MemoryAboveCutoffBytes());
694 EXPECT_LE(resource_manager->MemoryUseBytes(),
695 resource_manager->MemoryAboveCutoffBytes());
703 EXPECT_EQ(TexturesMemorySize(8), resource_manager->MemoryAboveCutoffBytes());
704 EXPECT_LE(resource_manager->MemoryUseBytes(),
705 resource_manager->MemoryAboveCutoffBytes());
709 resource_manager->ClearAllMemory(resource_provider());
713 scoped_ptr<PrioritizedResourceManager> resource_manager = CreateManager(1);
715 resource_manager->CreateTexture(texture_size_, texture_format_);
721 PrioritizeTexturesAndBackings(resource_manager.get());
729 resource_manager->ClearAllMemory(resource_provider());
731 resource_manager.reset();
782 scoped_ptr<PrioritizedResourceManager> resource_manager =
787 resource_manager->CreateTexture(texture_size_, texture_format_);
798 resource_manager->CreateTexture(texture_size_, texture_format_);
806 PrioritizeTexturesAndBackings(resource_manager.get());
817 PrioritizeTexturesAndBackings(resource_manager.get());
823 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryAboveCutoffBytes());
825 resource_manager->MemoryForSelfManagedTextures());
826 EXPECT_LE(resource_manager->MemoryUseBytes(),
827 resource_manager->MemoryAboveCutoffBytes());
829 resource_manager->MaxMemoryNeededBytes());
833 resource_manager->ClearAllMemory(resource_provider());
839 scoped_ptr<PrioritizedResourceManager> resource_manager =
844 resource_manager->CreateTexture(texture_size_, texture_format_);
855 resource_manager->CreateTexture(texture_size_, texture_format_);
863 PrioritizeTexturesAndBackings(resource_manager.get());
871 EXPECT_EQ(TexturesMemorySize(4), resource_manager->MemoryAboveCutoffBytes());
873 resource_manager->MemoryForSelfManagedTextures());
874 EXPECT_LE(resource_manager->MemoryUseBytes(),
875 resource_manager->MemoryAboveCutoffBytes());
877 resource_manager->MaxMemoryNeededBytes());
881 resource_manager->ClearAllMemory(resource_provider());
887 scoped_ptr<PrioritizedResourceManager> resource_manager =
892 resource_manager->CreateTexture(texture_size_, texture_format_);
903 resource_manager->CreateTexture(texture_size_, texture_format_);
915 PrioritizeTexturesAndBackings(resource_manager.get());
925 EXPECT_EQ(TexturesMemorySize(6), resource_manager->MemoryAboveCutoffBytes());
927 resource_manager->MemoryForSelfManagedTextures());
928 EXPECT_LE(resource_manager->MemoryUseBytes(),
929 resource_manager->MemoryAboveCutoffBytes());
933 resource_manager->ClearAllMemory(resource_provider());
938 scoped_ptr<PrioritizedResourceManager> resource_manager =
940 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(kMaxTextures));
946 resource_manager->CreateTexture(texture_size_, texture_format_);
951 PrioritizeTexturesAndBackings(resource_manager.get());
957 resource_manager->SetMaxMemoryLimitBytes(
959 PrioritizeTexturesAndBackings(resource_manager.get());
966 ResourceManagerUpdateBackingsPriorities(resource_manager.get());
970 ResourceManagerAssertInvariants(resource_manager.get());
985 resource_manager->ClearAllMemory(resource_provider());
990 scoped_ptr<PrioritizedResourceManager> resource_manager =
992 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(kMaxTextures));
999 resource_manager->CreateTexture(texture_size_, texture_format_);
1004 PrioritizeTexturesAndBackings(resource_manager.get());
1024 resource_manager->ReduceMemoryOnImplThread(
1031 resource_manager->ReduceMemoryOnImplThread(
1039 scoped_ptr<PrioritizedResourceManager> resource_manager =
1045 resource_manager->CreateTexture(texture_size_, texture_format_);
1060 resource_manager->SetMaxMemoryLimitBytes(TexturesMemorySize(2));
1061 PrioritizeTexturesAndBackings(resource_manager.get());
1072 EXPECT_EQ(TexturesMemorySize(2), resource_manager->MemoryUseBytes());
1073 EXPECT_EQ(TexturesMemorySize(1), resource_manager->MemoryVisibleBytes());
1075 resource_manager->MemoryVisibleAndNearbyBytes());
1089 resource_manager->PrioritizeTextures();
1094 EXPECT_EQ(TexturesMemorySize(2), resource_manager->MemoryUseBytes());
1095 EXPECT_EQ(TexturesMemorySize(1), resource_manager->MemoryVisibleBytes());
1097 resource_manager->MemoryVisibleAndNearbyBytes());
1104 resource_manager->PushTexturePrioritiesToBackings();
1105 EXPECT_EQ(TexturesMemorySize(2), resource_manager->MemoryUseBytes());
1106 EXPECT_EQ(TexturesMemorySize(3), resource_manager->MemoryVisibleBytes());
1108 resource_manager->MemoryVisibleAndNearbyBytes());
1113 resource_manager->ClearAllMemory(resource_provider());