Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
SkStrikeServerImpl Class Referencefinal
Inheritance diagram for SkStrikeServerImpl:
sktext::StrikeForGPUCacheInterface

Public Member Functions

 SkStrikeServerImpl (SkStrikeServer::DiscardableHandleManager *discardableHandleManager)
 
void writeStrikeData (std::vector< uint8_t > *memory)
 
sk_sp< sktext::StrikeForGPUfindOrCreateScopedStrike (const SkStrikeSpec &strikeSpec) override
 
void setMaxEntriesInDescriptorMapForTesting (size_t count)
 
size_t remoteStrikeMapSizeForTesting () const
 
- Public Member Functions inherited from sktext::StrikeForGPUCacheInterface
virtual ~StrikeForGPUCacheInterface ()=default
 
virtual sk_sp< StrikeForGPUfindOrCreateScopedStrike (const SkStrikeSpec &strikeSpec)=0
 

Detailed Description

Definition at line 265 of file SkChromeRemoteGlyphCache.cpp.

Constructor & Destructor Documentation

◆ SkStrikeServerImpl()

SkStrikeServerImpl::SkStrikeServerImpl ( SkStrikeServer::DiscardableHandleManager discardableHandleManager)
explicit

Definition at line 308 of file SkChromeRemoteGlyphCache.cpp.

309 : fDiscardableHandleManager(dhm) {
310 SkASSERT(fDiscardableHandleManager);
311}
#define SkASSERT(cond)
Definition: SkAssert.h:116

Member Function Documentation

◆ findOrCreateScopedStrike()

sk_sp< StrikeForGPU > SkStrikeServerImpl::findOrCreateScopedStrike ( const SkStrikeSpec strikeSpec)
overridevirtual

Implements sktext::StrikeForGPUCacheInterface.

Definition at line 366 of file SkChromeRemoteGlyphCache.cpp.

367 {
368 return this->getOrCreateCache(strikeSpec);
369}

◆ remoteStrikeMapSizeForTesting()

size_t SkStrikeServerImpl::remoteStrikeMapSizeForTesting ( ) const

Definition at line 316 of file SkChromeRemoteGlyphCache.cpp.

316 {
317 return fDescToRemoteStrike.size();
318}

◆ setMaxEntriesInDescriptorMapForTesting()

void SkStrikeServerImpl::setMaxEntriesInDescriptorMapForTesting ( size_t  count)

Definition at line 313 of file SkChromeRemoteGlyphCache.cpp.

313 {
314 fMaxEntriesInDescriptorMap = count;
315}
int count
Definition: FontMgrTest.cpp:50

◆ writeStrikeData()

void SkStrikeServerImpl::writeStrikeData ( std::vector< uint8_t > *  memory)

Definition at line 320 of file SkChromeRemoteGlyphCache.cpp.

320 {
321 // We can use the default SkSerialProcs because we do not currently need to encode any SkImages.
322 SkBinaryWriteBuffer buffer{nullptr, 0, {}};
323
324 // Gather statistics about what needs to be sent.
325 size_t strikesToSend = 0;
326 fRemoteStrikesToSend.foreach([&](RemoteStrike* strike) {
327 if (strike->hasPendingGlyphs()) {
328 strikesToSend++;
329 } else {
330 // This strike has nothing to send, so drop its scaler context to reduce memory.
331 strike->resetScalerContext();
332 }
333 });
334
335 // If there are no strikes or typefaces to send, then cleanup and return.
336 if (strikesToSend == 0 && fTypefacesToSend.empty()) {
337 fRemoteStrikesToSend.reset();
338 return;
339 }
340
341 // Send newly seen typefaces.
342 SkASSERT_RELEASE(SkTFitsIn<int>(fTypefacesToSend.size()));
343 buffer.writeInt(fTypefacesToSend.size());
344 for (const auto& typeface: fTypefacesToSend) {
345 SkTypefaceProxyPrototype proto{typeface};
346 proto.flatten(buffer);
347 }
348 fTypefacesToSend.clear();
349
350 buffer.writeInt(strikesToSend);
351 fRemoteStrikesToSend.foreach(
352 [&](RemoteStrike* strike) {
353 if (strike->hasPendingGlyphs()) {
354 strike->writePendingGlyphs(buffer);
355 strike->resetScalerContext();
356 }
357 }
358 );
359 fRemoteStrikesToSend.reset();
360
361 // Copy data into the vector.
362 auto data = buffer.snapshotAsData();
363 memory->assign(data->bytes(), data->bytes() + data->size());
364}
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
void flatten(SkWriteBuffer &buffer) const
void foreach(Fn &&fn) const
Definition: SkTHash.h:609
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
Definition: switches.h:126
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

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