Home | History | Annotate | Download | only in tests

Lines Matching defs:TestResource

241 class TestResource : public GrGpuResource {
250 TestResource(GrGpu* gpu, size_t size, GrGpuResource::LifeCycle lifeCycle)
259 TestResource(GrGpu* gpu, GrGpuResource::LifeCycle lifeCycle)
268 TestResource(GrGpu* gpu)
277 static TestResource* CreateScratch(GrGpu* gpu, SimulatedProperty property, bool cached = true) {
278 return new TestResource(gpu, property, cached, kScratchConstructor);
281 ~TestResource() {
293 void setUnrefWhenDestroyed(TestResource* resource) {
312 TestResource(GrGpu* gpu, SimulatedProperty property, bool cached, ScratchConstructor)
326 TestResource* fToDelete;
332 int TestResource::fNumAlive = 0;
359 TestResource* a = new TestResource(context->getGpu());
360 TestResource* b = new TestResource(context->getGpu());
361 TestResource* c = new TestResource(context->getGpu());
362 TestResource* d = new TestResource(context->getGpu());
368 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive());
375 REPORTER_ASSERT(reporter, 4 == TestResource::NumAlive());
380 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive());
386 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
392 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
397 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
418 TestResource* scratch =
419 TestResource::CreateScratch(context->getGpu(), TestResource::kB_SimulatedProperty);
421 TestResource* unique = new TestResource(context->getGpu());
424 TestResource* wrapped = new TestResource
426 TestResource* unbudgeted =
427 new TestResource(context->getGpu(), GrGpuResource::kUncached_LifeCycle);
462 wrapped = new TestResource(context->getGpu(), GrGpuResource::kBorrowed_LifeCycle);
501 TestResource* scratch;
502 TestResource* unique;
503 TestResource* wrapped;
504 TestResource* unbudgeted;
507 scratch = TestResource::CreateScratch(context->getGpu(), TestResource::kB_SimulatedProperty);
515 unique = new TestResource(context->getGpu());
525 unbudgeted = new TestResource(context->getGpu(), large, GrGpuResource::kUncached_LifeCycle);
537 wrapped = new TestResource(context->getGpu(), large, GrGpuResource::kBorrowed_LifeCycle);
563 TestResource* resource =
564 TestResource::CreateScratch(context->getGpu(), TestResource::kA_SimulatedProperty, false);
566 TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &key);
574 REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0));
586 resource = static_cast<TestResource*>(cache->findAndRefScratchResource(key, TestResource::kDefaultSize, 0));
623 TestResource* a = TestResource::CreateScratch(context->getGpu(),
624 TestResource::kB_SimulatedProperty);
625 TestResource* b = TestResource::CreateScratch(context->getGpu(),
626 TestResource::kB_SimulatedProperty);
630 TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey1);
632 REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(scratchKey1, TestResource::kDefaultSize, 0));
635 TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey);
638 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
646 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
652 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
657 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
668 TestResource* a = TestResource::CreateScratch(context->getGpu(),
669 TestResource::kB_SimulatedProperty);
670 TestResource* b = TestResource::CreateScratch(context->getGpu(),
671 TestResource::kB_SimulatedProperty);
677 TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey);
679 REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == nullptr);
682 TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey);
683 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
689 find = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0);
692 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
698 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
703 find = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0);
705 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
711 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
716 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
727 TestResource* a = TestResource::CreateScratch(context->getGpu(),
728 TestResource::kB_SimulatedProperty);
729 TestResource* b = TestResource::CreateScratch(context->getGpu(),
730 TestResource::kB_SimulatedProperty);
737 TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey1);
739 TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey2);
740 TestResource::ExpectedScratchKeySize());
744 REPORTER_ASSERT(reporter, scratchKey.size() == TestResource::ExpectedScratchKeySize());
750 REPORTER_ASSERT(reporter, scratchKey.size() == TestResource::ExpectedScratchKeySize());
757 TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey);
759 REPORTER_ASSERT(reporter, cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0) == nullptr);
762 TestResource::ComputeScratchKey(TestResource::kB_SimulatedProperty, &scratchKey);
763 GrGpuResource* find = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0);
768 find = cache->findAndRefScratchResource(scratchKey2, TestResource::kDefaultSize, 0);
772 GrGpuResource* find2 = cache->findAndRefScratchResource(scratchKey2, TestResource::kDefaultSize, 0);
789 TestResource* a = new TestResource(context->getGpu());
803 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
806 TestResource* b = new TestResource(context->getGpu());
815 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
821 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
826 TestResource* c = new TestResource(context->getGpu());
833 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
838 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
844 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
850 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
858 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
863 SkAutoTUnref<TestResource> d(new TestResource(context->getGpu()));
887 TestResource* a = new TestResource(context->getGpu());
888 TestResource* b = new TestResource(context->getGpu());
889 TestResource* c = TestResource::CreateScratch(context->getGpu(),
890 TestResource::kA_SimulatedProperty);
901 REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive());
913 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
920 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
925 REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
929 TestResource::ComputeScratchKey(TestResource::kA_SimulatedProperty, &scratchKey);
930 GrGpuResource* scratch = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0);
936 scratch = cache->findAndRefScratchResource(scratchKey, TestResource::kDefaultSize, 0);
937 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
953 TestResource* a = new TestResource(context->getGpu());
954 TestResource* b = new TestResource(context->getGpu());
962 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
967 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
970 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
974 REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
977 REPORTER_ASSERT(reporter, 0 == TestResource::NumAlive());
991 TestResource* a = new TestResource(context->getGpu());
995 TestResource* b = new TestResource(context->getGpu());
1002 SkAutoTUnref<TestResource> find2(
1003 static_cast<TestResource*>(cache->findAndRefUniqueResource(key2)));
1005 SkAutoTUnref<TestResource> find1(
1006 static_cast<TestResource*>(cache->findAndRefUniqueResource(key1)));
1020 TestResource* a = new TestResource(context->getGpu());
1025 TestResource* b = new TestResource(context->getGpu());
1034 SkAutoTUnref<TestResource> find2(static_cast<TestResource*>(
1074 TestResource* r = new TestResource(context->getGpu());
1123 TestResource* r = new TestResource(context->getGpu());
1154 TestResource* r = new TestResource(context->getGpu());
1207 TestResource* resource;
1209 resource = new TestResource(context->getGpu());
1214 resource = new TestResource(context->getGpu());
1220 REPORTER_ASSERT(reporter, TestResource::NumAlive() == 2 * kResourceCnt);
1235 REPORTER_ASSERT(reporter, TestResource::NumAlive() == 0);
1269 SkAutoTUnref<GrGpuResource> resource(new TestResource(context->getGpu()));