Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
SkFontRequestCache Class Reference

Classes

struct  Request
 

Public Member Functions

 SkFontRequestCache (size_t maxSize)
 
void add (sk_sp< SkTypeface > face, Request *request)
 
sk_sp< SkTypefacefindAndRef (Request *request)
 

Detailed Description

Definition at line 58 of file SkFontMgr_FontConfigInterface.cpp.

Constructor & Destructor Documentation

◆ SkFontRequestCache()

SkFontRequestCache::SkFontRequestCache ( size_t  maxSize)
inline

Definition at line 113 of file SkFontMgr_FontConfigInterface.cpp.

113: fCachedResults(maxSize) {}

Member Function Documentation

◆ add()

void SkFontRequestCache::add ( sk_sp< SkTypeface face,
Request request 
)
inline

Takes ownership of request. It will be deleted when no longer needed.

Definition at line 116 of file SkFontMgr_FontConfigInterface.cpp.

116 {
117 fCachedResults.add(new Result(request, std::move(face)));
118 }
void add(Rec *, void *payload=nullptr)

◆ findAndRef()

sk_sp< SkTypeface > SkFontRequestCache::findAndRef ( Request request)
inline

Does not take ownership of request.

Definition at line 120 of file SkFontMgr_FontConfigInterface.cpp.

120 {
122 fCachedResults.find(*request, [](const SkResourceCache::Rec& rec, void* context) -> bool {
123 const Result& result = static_cast<const Result&>(rec);
124 sk_sp<SkTypeface>* face = static_cast<sk_sp<SkTypeface>*>(context);
125
126 *face = result.fFace;
127 return true;
128 }, &face);
129 return face;
130 }
bool find(const Key &, FindVisitor, void *context)
GAsyncResult * result

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