Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
TestResource Class Reference
Inheritance diagram for TestResource:
GrGpuResource GrIORef< GrGpuResource > SkNoncopyable

Public Types

enum  SimulatedProperty { kA_SimulatedProperty , kB_SimulatedProperty }
 
- Public Types inherited from GrIORef< GrGpuResource >
enum  LastRemovedRef
 

Public Member Functions

 TestResource (GrGpu *gpu, std::string_view label, skgpu::Budgeted budgeted=skgpu::Budgeted::kYes, size_t size=kDefaultSize)
 
 ~TestResource () override
 
void setUnrefWhenDestroyed (sk_sp< TestResource > resource)
 
- Public Member Functions inherited from GrGpuResource
bool wasDestroyed () const
 
const GrDirectContextgetContext () const
 
GrDirectContextgetContext ()
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
const skgpu::UniqueKeygetUniqueKey () const
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
CacheAccess cacheAccess ()
 
const CacheAccess cacheAccess () const
 
ProxyAccess proxyAccess ()
 
ResourcePriv resourcePriv ()
 
const ResourcePriv resourcePriv () const
 
virtual void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual const char * getResourceType () const =0
 
- Public Member Functions inherited from GrIORef< GrGpuResource >
bool unique () const
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Static Public Member Functions

static TestResourceCreateScratch (GrGpu *gpu, skgpu::Budgeted budgeted, SimulatedProperty property, size_t size=kDefaultSize)
 
static TestResourceCreateWrapped (GrGpu *gpu, GrWrapCacheable cacheable, size_t size=kDefaultSize)
 
static int NumAlive ()
 
static void ComputeScratchKey (SimulatedProperty property, skgpu::ScratchKey *key)
 
static size_t ExpectedScratchKeySize ()
 
- Static Public Member Functions inherited from GrGpuResource
static uint32_t CreateUniqueID ()
 

Static Public Attributes

static const size_t kDefaultSize = 100
 

Additional Inherited Members

- Protected Member Functions inherited from GrGpuResource
void registerWithCache (skgpu::Budgeted)
 
void registerWithCacheWrapped (GrWrapCacheable)
 
 GrGpuResource (GrGpu *, std::string_view label)
 
virtual ~GrGpuResource ()
 
GrGpugetGpu () const
 
virtual void onRelease ()
 
virtual void onAbandon ()
 
virtual void setMemoryBacking (SkTraceMemoryDump *, const SkString &) const
 
SkString getResourceName () const
 
void dumpMemoryStatisticsPriv (SkTraceMemoryDump *traceMemoryDump, const SkString &resourceName, const char *type, size_t size) const
 
- Protected Member Functions inherited from GrIORef< GrGpuResource >
 GrIORef ()
 
bool internalHasRef () const
 
bool internalHasNoCommandBufferUsages () const
 
void addInitialRef () const
 

Detailed Description

Definition at line 293 of file ResourceCacheTest.cpp.

Member Enumeration Documentation

◆ SimulatedProperty

Property that distinctly categorizes the resource. For example, textures have width, height, ...

Enumerator
kA_SimulatedProperty 
kB_SimulatedProperty 

Definition at line 300 of file ResourceCacheTest.cpp.

Constructor & Destructor Documentation

◆ TestResource()

TestResource::TestResource ( GrGpu gpu,
std::string_view  label,
skgpu::Budgeted  budgeted = skgpu::Budgeted::kYes,
size_t  size = kDefaultSize 
)
inline

Definition at line 302 of file ResourceCacheTest.cpp.

306 : INHERITED(gpu, label)
307 , fToDelete(nullptr)
308 , fSize(size)
309 , fProperty(kA_SimulatedProperty)
310 , fIsScratch(false) {
311 ++fNumAlive;
312 this->registerWithCache(budgeted);
313 }
void registerWithCache(skgpu::Budgeted)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ ~TestResource()

TestResource::~TestResource ( )
inlineoverride

Definition at line 327 of file ResourceCacheTest.cpp.

327 {
328 --fNumAlive;
329 }

Member Function Documentation

◆ ComputeScratchKey()

static void TestResource::ComputeScratchKey ( SimulatedProperty  property,
skgpu::ScratchKey key 
)
inlinestatic

Definition at line 337 of file ResourceCacheTest.cpp.

337 {
339 skgpu::ScratchKey::Builder builder(key, t, kScratchKeyFieldCnt);
340 for (int i = 0; i < kScratchKeyFieldCnt; ++i) {
341 builder[i] = static_cast<uint32_t>(i + property);
342 }
343 }
static ResourceType GenerateResourceType()
Definition: ResourceKey.cpp:16
uint32_t ResourceType
Definition: ResourceKey.h:200

◆ CreateScratch()

static TestResource * TestResource::CreateScratch ( GrGpu gpu,
skgpu::Budgeted  budgeted,
SimulatedProperty  property,
size_t  size = kDefaultSize 
)
inlinestatic

Definition at line 315 of file ResourceCacheTest.cpp.

318 {
319 return new TestResource(gpu, budgeted, property, kScratchConstructor, /*label=*/{}, size);
320 }
TestResource(GrGpu *gpu, std::string_view label, skgpu::Budgeted budgeted=skgpu::Budgeted::kYes, size_t size=kDefaultSize)

◆ CreateWrapped()

static TestResource * TestResource::CreateWrapped ( GrGpu gpu,
GrWrapCacheable  cacheable,
size_t  size = kDefaultSize 
)
inlinestatic

Definition at line 321 of file ResourceCacheTest.cpp.

323 {
324 return new TestResource(gpu, cacheable, size, /*label=*/{});
325 }

◆ ExpectedScratchKeySize()

static size_t TestResource::ExpectedScratchKeySize ( )
inlinestatic

Definition at line 345 of file ResourceCacheTest.cpp.

345 {
346 return sizeof(uint32_t) * (kScratchKeyFieldCnt + skgpu::ScratchKey::kMetaDataCnt);
347 }

◆ NumAlive()

static int TestResource::NumAlive ( )
inlinestatic

Definition at line 331 of file ResourceCacheTest.cpp.

331{ return fNumAlive; }

◆ setUnrefWhenDestroyed()

void TestResource::setUnrefWhenDestroyed ( sk_sp< TestResource resource)
inline

Definition at line 333 of file ResourceCacheTest.cpp.

333 {
334 fToDelete = std::move(resource);
335 }
static SkString resource(SkPDFResourceType type, int index)

Member Data Documentation

◆ kDefaultSize

const size_t TestResource::kDefaultSize = 100
static

Definition at line 296 of file ResourceCacheTest.cpp.


The documentation for this class was generated from the following file: