34 return (sharedID << 32) | bitmapGenID;
46 return { imageID, subset };
55static unsigned gBitmapKeyNamespaceLabel;
71 pr->setImmutableWithID(
id);
77 std::unique_ptr<SkDiscardableMemory> dm,
void* block)
93 if (fDM && fDiscardableIsLocked) {
106 return fExternalCounter == 0;
118 Rec* rec =
static_cast<Rec*
>(ctx);
121 SkASSERT(rec->fExternalCounter > 0);
122 rec->fExternalCounter -= 1;
125 if (rec->fExternalCounter == 0) {
127 rec->fDiscardableIsLocked =
false;
137 if (!fDM && !fMalloc) {
142 if (!fDiscardableIsLocked) {
148 fDiscardableIsLocked =
true;
153 bitmap->installPixels(fInfo, fDM ? fDM->data() : fMalloc, fRowBytes,
ReleaseProc,
this);
161 Rec* rec =
const_cast<Rec*
>(
static_cast<const Rec*
>(&baseRec));
172 std::unique_ptr<SkDiscardableMemory> fDM;
177 uint32_t fPrUniqueID;
181 int fExternalCounter = 0;
182 bool fDiscardableIsLocked =
true;
185void SkBitmapCache::PrivateDeleteRec(Rec* rec) {
delete rec; }
193 const size_t rb =
info.minRowBytes();
194 size_t size =
info.computeByteSize(rb);
199 std::unique_ptr<SkDiscardableMemory> dm;
200 void* block =
nullptr;
204 dm.reset(factory(
size));
227#define CHECK_LOCAL(localCache, localName, globalName, ...) \
228 ((localCache) ? localCache->localName(__VA_ARGS__) : SkResourceCache::globalName(__VA_ARGS__))
231static unsigned gMipMapKeyNamespaceLabel;
248 fMipMap->attachToCacheAndRef();
251 ~MipMapRec()
override {
252 fMipMap->detachFromCacheAndUnref();
255 const Key&
getKey()
const override {
return fKey; }
256 size_t bytesUsed()
const override {
return sizeof(fKey) + fMipMap->size(); }
257 const char*
getCategory()
const override {
return "mipmap"; }
259 return fMipMap->diagnostic_only_getDiscardable();
263 const MipMapRec& rec =
static_cast<const MipMapRec&
>(baseRec);
267 if (
nullptr == mm->
data()) {
300 if (!
image->getROPixels(
nullptr, &
src)) {
308 image->notifyAddedToRasterCache();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
uint64_t SkMakeResourceCacheSharedIDForBitmap(uint32_t bitmapGenID)
void SkBitmapCache_setImmutableWithID(SkPixelRef *pr, uint32_t id)
void SkNotifyBitmapGenIDIsStale(uint32_t bitmapGenID)
#define CHECK_LOCAL(localCache, localName, globalName,...)
static SkResourceCache::DiscardableFactory get_fact(SkResourceCache *localCache)
SK_API void sk_free(void *)
static void * sk_malloc_canfail(size_t size)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
int find(T *array, int N, T item)
bool canBePurged() override
void postAddInstall(void *payload) override
SkDiscardableMemory * diagnostic_only_getDiscardable() const override
const Key & getKey() const override
static void ReleaseProc(void *addr, void *ctx)
size_t bytesUsed() const override
static bool Finder(const SkResourceCache::Rec &baseRec, void *contextBitmap)
const char * getCategory() const override
bool install(SkBitmap *bitmap)
Rec(const SkBitmapCacheDesc &desc, const SkImageInfo &info, size_t rowBytes, std::unique_ptr< SkDiscardableMemory > dm, void *block)
std::unique_ptr< Rec, RecDeleter > RecPtr
static RecPtr Alloc(const SkBitmapCacheDesc &, const SkImageInfo &, SkPixmap *)
static bool Find(const SkBitmapCacheDesc &, SkBitmap *result)
static void Add(RecPtr, SkBitmap *)
const void * data() const
uint32_t uniqueID() const
static const SkMipmap * AddAndRef(const SkImage_Base *, SkResourceCache *localCache=nullptr)
static const SkMipmap * FindAndRef(const SkBitmapCacheDesc &, SkResourceCache *localCache=nullptr)
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
static uint32_t ImageID()
static void Add(Rec *, void *payload=nullptr)
DiscardableFactory discardableFactory() const
static void PostPurgeSharedID(uint64_t sharedID)
static DiscardableFactory GetDiscardableFactory()
static bool Find(const Key &key, FindVisitor, void *context)
SkDiscardableMemory *(* DiscardableFactory)(size_t bytes)
Optional< SkRect > bounds
sk_sp< const SkImage > image
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
static SkBitmapCacheDesc Make(const SkImage *)
constexpr int32_t height() const
constexpr int32_t width() const
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static bool ByteSizeOverflowed(size_t byteSize)
size_t computeByteSize(size_t rowBytes) const
void init(void *nameSpace, uint64_t sharedID, size_t dataSize)
virtual const char * getCategory() const =0
virtual SkDiscardableMemory * diagnostic_only_getDiscardable() const
virtual size_t bytesUsed() const =0
virtual const Key & getKey() const =0