637 {
640
641
642
644
645 buffer.setAllowSkSL(
false);
646
647 int curTypeface = 0,
648 curStrike = 0;
649
650 auto postError = [&](
int line) {
653 memorySize,
655 SkTo<uint64_t>(curTypeface),
656 SkTo<uint64_t>(curStrike),
657 SkTo<uint64_t>(0),
658 SkTo<uint64_t>(0)};
660 };
661
662
663 const int typefaceCount =
buffer.readInt();
664 for (curTypeface = 0; curTypeface < typefaceCount; ++curTypeface) {
666 if (proto) {
667 this->addTypeface(proto.value());
668 } else {
669 postError(__LINE__);
670 return false;
671 }
672 }
673
674
675 const int stirkeCount =
buffer.readInt();
676 for (curStrike = 0; curStrike < stirkeCount; ++curStrike) {
677
679 if (serverTypefaceID == 0 && !
buffer.isValid()) {
680 postError(__LINE__);
681 return false;
682 }
683
685 if (discardableHandleID == 0 && !
buffer.isValid()) {
686 postError(__LINE__);
687 return false;
688 }
689
691 if (!
buffer.validate(serverDescriptor.has_value())) {
692 postError(__LINE__);
693 return false;
694 }
695
696 const bool fontMetricsInitialized =
buffer.readBool();
697 if (!fontMetricsInitialized && !
buffer.isValid()) {
698 postError(__LINE__);
699 return false;
700 }
701
702 std::optional<SkFontMetrics> fontMetrics;
703 if (!fontMetricsInitialized) {
705 if (!fontMetrics || !
buffer.isValid()) {
706 postError(__LINE__);
707 return false;
708 }
709 }
710
711 auto* clientTypeface = fServerTypefaceIdToTypeface.
find(serverTypefaceID);
712 if (clientTypeface == nullptr) {
713 postError(__LINE__);
714 return false;
715 }
716
718 postError(__LINE__);
719 return false;
720 }
721
722 SkDescriptor* clientDescriptor = serverDescriptor->getDesc();
723 auto strike = fStrikeCache->
findStrike(*clientDescriptor);
724
725 if (strike == nullptr) {
726
727
728 if (fontMetricsInitialized) {
729 postError(__LINE__);
730 return false;
731 }
732 SkStrikeSpec strikeSpec{*clientDescriptor, *clientTypeface};
734 strikeSpec, &fontMetrics.value(),
735 std::make_unique<DiscardableStrikePinner>(
736 discardableHandleID, fDiscardableHandleManager));
737 }
738
739
741
742 if (!strike->mergeFromBuffer(
buffer)) {
743 postError(__LINE__);
744 return false;
745 }
746 }
747
748 return true;
749}
uint32_t SkDiscardableHandleId
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static std::optional< SkAutoDescriptor > MakeFromBuffer(SkReadBuffer &buffer)
static std::optional< SkFontMetrics > MakeFromBuffer(SkReadBuffer &buffer)
sk_sp< SkStrike > createStrike(const SkStrikeSpec &strikeSpec, SkFontMetrics *maybeMetrics=nullptr, std::unique_ptr< SkStrikePinner >=nullptr) SK_EXCLUDES(fLock)
sk_sp< SkStrike > findStrike(const SkDescriptor &desc) SK_EXCLUDES(fLock)
bool translateTypefaceID(SkAutoDescriptor *descriptor) const
virtual void notifyReadFailure(const ReadFailureData &data)
void verifyPinnedStrike() const
static std::optional< SkTypefaceProxyPrototype > MakeFromBuffer(SkReadBuffer &buffer)
V * find(const K &key) 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
std::shared_ptr< const fml::Mapping > data