Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
sktext::SkStrikePromise Class Reference

#include <StrikeForGPU.h>

Public Member Functions

 SkStrikePromise ()=delete
 
 SkStrikePromise (const SkStrikePromise &)=delete
 
SkStrikePromiseoperator= (const SkStrikePromise &)=delete
 
 SkStrikePromise (SkStrikePromise &&)
 
SkStrikePromiseoperator= (SkStrikePromise &&)
 
 SkStrikePromise (sk_sp< SkStrike > &&strike)
 
 SkStrikePromise (const SkStrikeSpec &spec)
 
void flatten (SkWriteBuffer &buffer) const
 
SkStrikestrike ()
 
void resetStrike ()
 
const SkDescriptordescriptor () const
 

Static Public Member Functions

static std::optional< SkStrikePromiseMakeFromBuffer (SkReadBuffer &buffer, const SkStrikeClient *client, SkStrikeCache *strikeCache)
 

Detailed Description

Definition at line 39 of file StrikeForGPU.h.

Constructor & Destructor Documentation

◆ SkStrikePromise() [1/5]

sktext::SkStrikePromise::SkStrikePromise ( )
delete

◆ SkStrikePromise() [2/5]

sktext::SkStrikePromise::SkStrikePromise ( const SkStrikePromise )
delete

◆ SkStrikePromise() [3/5]

sktext::SkStrikePromise::SkStrikePromise ( SkStrikePromise &&  )
default

◆ SkStrikePromise() [4/5]

sktext::SkStrikePromise::SkStrikePromise ( sk_sp< SkStrike > &&  strike)
explicit

Definition at line 22 of file StrikeForGPU.cpp.

23 : fStrikeOrSpec{std::move(strike)} {}

◆ SkStrikePromise() [5/5]

sktext::SkStrikePromise::SkStrikePromise ( const SkStrikeSpec spec)
explicit

Definition at line 24 of file StrikeForGPU.cpp.

25 : fStrikeOrSpec{std::make_unique<SkStrikeSpec>(spec)} {}

Member Function Documentation

◆ descriptor()

const SkDescriptor & sktext::SkStrikePromise::descriptor ( ) const

Definition at line 42 of file StrikeForGPU.cpp.

42 {
43 if (std::holds_alternative<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec)) {
44 return std::get<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec)->descriptor();
45 }
46
47 return std::get<sk_sp<SkStrike>>(fStrikeOrSpec)->getDescriptor();
48}
const SkDescriptor & descriptor() const

◆ flatten()

void sktext::SkStrikePromise::flatten ( SkWriteBuffer buffer) const

Definition at line 50 of file StrikeForGPU.cpp.

50 {
51 this->descriptor().flatten(buffer);
52}
void flatten(SkWriteBuffer &buffer) const

◆ MakeFromBuffer()

std::optional< SkStrikePromise > sktext::SkStrikePromise::MakeFromBuffer ( SkReadBuffer buffer,
const SkStrikeClient client,
SkStrikeCache strikeCache 
)
static

Definition at line 77 of file StrikeCache.cpp.

78 {
79 std::optional<SkAutoDescriptor> descriptor = SkAutoDescriptor::MakeFromBuffer(buffer);
80 if (!buffer.validate(descriptor.has_value())) {
81 return std::nullopt;
82 }
83
84 // If there is a client, then this from a different process. Translate the SkTypefaceID from
85 // the strike server (Renderer) process to strike client (GPU) process.
86 if (client != nullptr) {
87 if (!client->translateTypefaceID(&descriptor.value())) {
88 return std::nullopt;
89 }
90 }
91
92 sk_sp<SkStrike> strike = strikeCache->findStrike(*descriptor->getDesc());
93 SkASSERT(strike != nullptr);
94 if (!buffer.validate(strike != nullptr)) {
95 return std::nullopt;
96 }
97
98 return SkStrikePromise{std::move(strike)};
99}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static std::optional< SkAutoDescriptor > MakeFromBuffer(SkReadBuffer &buffer)
sk_sp< SkStrike > findStrike(const SkDescriptor &desc) SK_EXCLUDES(fLock)
SK_SPI bool translateTypefaceID(SkAutoDescriptor *descriptor) const
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

◆ operator=() [1/2]

SkStrikePromise & sktext::SkStrikePromise::operator= ( const SkStrikePromise )
delete

◆ operator=() [2/2]

SkStrikePromise & sktext::SkStrikePromise::operator= ( SkStrikePromise &&  )
default

◆ resetStrike()

void sktext::SkStrikePromise::resetStrike ( )

Definition at line 38 of file StrikeForGPU.cpp.

38 {
39 fStrikeOrSpec = sk_sp<SkStrike>();
40}

◆ strike()

SkStrike * sktext::SkStrikePromise::strike ( )

Definition at line 27 of file StrikeForGPU.cpp.

27 {
28 if (std::holds_alternative<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec)) {
29 // Turn the strike spec into a strike.
30 std::unique_ptr<SkStrikeSpec> spec =
31 std::exchange(std::get<std::unique_ptr<SkStrikeSpec>>(fStrikeOrSpec), nullptr);
32
34 }
35 return std::get<sk_sp<SkStrike>>(fStrikeOrSpec).get();
36}
sk_sp< SkStrike > findOrCreateStrike(const SkStrikeSpec &strikeSpec) SK_EXCLUDES(fLock)
static SkStrikeCache * GlobalStrikeCache()
const myers::Point & get(const myers::Segment &)

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