Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | 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
 
- 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
 

Private Member Functions

void computeScratchKey (skgpu::ScratchKey *key) const override
 
size_t onGpuMemorySize () const override
 
void onSetLabel () override
 
const char * getResourceType () const override
 

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)

◆ ~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()
uint32_t ResourceType

◆ computeScratchKey()

void TestResource::computeScratchKey ( skgpu::ScratchKey ) const
inlineoverrideprivatevirtual

Called by the registerWithCache if the resource is available to be used as scratch. Resource subclasses should override this if the instances should be recycled as scratch resources and populate the scratchKey with the key. By default resources are not recycled as scratch.

Reimplemented from GrGpuResource.

Definition at line 377 of file ResourceCacheTest.cpp.

377 {
378 if (fIsScratch) {
379 ComputeScratchKey(fProperty, key);
380 }
381 }
static void ComputeScratchKey(SimulatedProperty property, skgpu::ScratchKey *key)

◆ 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 }
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

◆ 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 }

◆ getResourceType()

const char * TestResource::getResourceType ( ) const
inlineoverrideprivatevirtual

Describes the type of gpu resource that is represented by the implementing class (e.g. texture, buffer object, stencil). This data is used for diagnostic purposes by dumpMemoryStatistics().

The value returned is expected to be long lived and will not be copied by the caller.

Implements GrGpuResource.

Definition at line 385 of file ResourceCacheTest.cpp.

385{ return "Test"; }

◆ NumAlive()

static int TestResource::NumAlive ( )
inlinestatic

Definition at line 331 of file ResourceCacheTest.cpp.

331{ return fNumAlive; }

◆ onGpuMemorySize()

size_t TestResource::onGpuMemorySize ( ) const
inlineoverrideprivatevirtual

Implements GrGpuResource.

Definition at line 383 of file ResourceCacheTest.cpp.

383{ return fSize; }

◆ onSetLabel()

void TestResource::onSetLabel ( )
inlineoverrideprivatevirtual

Implements GrGpuResource.

Definition at line 384 of file ResourceCacheTest.cpp.

384{}

◆ setUnrefWhenDestroyed()

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

Definition at line 333 of file ResourceCacheTest.cpp.

333 {
334 fToDelete = std::move(resource);
335 }

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: