8#ifndef GrThreadSafeCache_DEFINED
9#define GrThreadSafeCache_DEFINED
71#if defined(GR_TEST_UTILS)
74 size_t approxBytesUsedForHash()
const SK_EXCLUDES(fSpinLock);
85 skgpu::StdSteadyClock::time_point purgeTime)
SK_EXCLUDES(fSpinLock);
95 std::tuple<GrSurfaceProxyView, sk_sp<SkData>>
addWithData(
111 size_t size()
const {
return fNumVertices * fVertexSize; }
128 sk_free(
const_cast<void*
>(fVertices));
151 const void* fVertices;
197 , fTag(
Entry::kView) {
202 , fVertData(
std::move(vertData))
203 , fTag(
Entry::kVertData) {
210 bool uniquelyHeld()
const {
215 }
else if (fTag == kVertData && fVertData->unique()) {
227 SkData* getCustomData()
const {
229 return fKey.getCustomData();
234 return fKey.refCustomData();
258 }
else if (fTag == kVertData) {
267 fVertData = std::move(vertData);
272 skgpu::StdSteadyClock::time_point fLastAccess;
305 std::tuple<GrSurfaceProxyView, sk_sp<SkData>> internalFind(
307 std::tuple<GrSurfaceProxyView, sk_sp<SkData>> internalAdd(
310 std::tuple<sk_sp<VertexData>,
sk_sp<SkData>> internalFindVerts(
312 std::tuple<sk_sp<VertexData>,
sk_sp<SkData>> internalAddVerts(
315 mutable SkSpinlock fSpinLock;
322 static const int kInitialArenaSize = 64 *
sizeof(
Entry);
324 char fStorage[kInitialArenaSize];
325 SkArenaAlloc fEntryAllocator{fStorage, kInitialArenaSize, kInitialArenaSize};
326 Entry* fFreeEntryList SK_GUARDED_BY(fSpinLock);
SK_API void sk_free(void *)
#define SK_DECLARE_INTERNAL_LLIST_INTERFACE(ClassName)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
int find(T *array, int N, T item)
GrSurfaceProxy * proxy() const
sk_sp< GrTextureProxy > fProxy
size_t vertexSize() const
void setGpuBuffer(sk_sp< GrGpuBuffer > gpuBuffer)
GrGpuBuffer * gpuBuffer()
sk_sp< GrGpuBuffer > refGpuBuffer()
const void * vertices() const
bool(* IsNewerBetter)(SkData *incumbent, SkData *challenger)
static std::tuple< GrSurfaceProxyView, sk_sp< Trampoline > > CreateLazyView(GrDirectContext *, GrColorType, SkISize dimensions, GrSurfaceOrigin, SkBackingFit)
std::tuple< sk_sp< VertexData >, sk_sp< SkData > > addVertsWithData(const skgpu::UniqueKey &, sk_sp< VertexData >, IsNewerBetter) SK_EXCLUDES(fSpinLock)
SkDEBUGCODE(bool has(const skgpu::UniqueKey &) SK_EXCLUDES(fSpinLock);) GrSurfaceProxyView find(const skgpu std::tuple< GrSurfaceProxyView, sk_sp< SkData > > findWithData(const skgpu::UniqueKey &) SK_EXCLUDES(fSpinLock)
std::tuple< sk_sp< VertexData >, sk_sp< SkData > > findVertsWithData(const skgpu::UniqueKey &) SK_EXCLUDES(fSpinLock)
GrSurfaceProxyView add(const skgpu::UniqueKey &, const GrSurfaceProxyView &) SK_EXCLUDES(fSpinLock)
void dropUniqueRefsOlderThan(skgpu::StdSteadyClock::time_point purgeTime) SK_EXCLUDES(fSpinLock)
void remove(const skgpu::UniqueKey &) SK_EXCLUDES(fSpinLock)
std::tuple< GrSurfaceProxyView, sk_sp< SkData > > findOrAddWithData(const skgpu::UniqueKey &, const GrSurfaceProxyView &) SK_EXCLUDES(fSpinLock)
std::tuple< GrSurfaceProxyView, sk_sp< SkData > > addWithData(const skgpu::UniqueKey &, const GrSurfaceProxyView &) SK_EXCLUDES(fSpinLock)
GrSurfaceProxyView findOrAdd(const skgpu::UniqueKey &, const GrSurfaceProxyView &) SK_EXCLUDES(fSpinLock)
void dropUniqueRefs(GrResourceCache *resourceCache) SK_EXCLUDES(fSpinLock)
static sk_sp< VertexData > MakeVertexData(const void *vertices, int vertexCount, size_t vertexSize)
void dropAllRefs() SK_EXCLUDES(fSpinLock)
void reset(T *ptr=nullptr)
static uint32_t Hash(uint32_t key)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set