1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_ANDROID_FONT_UNIQUE_NAME_LOOKUP_ANDROID_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_ANDROID_FONT_UNIQUE_NAME_LOOKUP_ANDROID_H_ 7 8 #include "mojo/public/cpp/bindings/remote.h" 9 #include "third_party/blink/public/common/font_unique_name_lookup/font_table_matcher.h" 10 #include "third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom-blink.h" 11 #include "third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h" 12 #include "third_party/blink/renderer/platform/wtf/deque.h" 13 14 #include <memory> 15 16 namespace blink { 17 18 class FontUniqueNameLookupAndroid : public FontUniqueNameLookup { 19 public: 20 FontUniqueNameLookupAndroid() = default; 21 ~FontUniqueNameLookupAndroid() override; 22 23 bool IsFontUniqueNameLookupReadyForSyncLookup() override; 24 25 void PrepareFontUniqueNameLookup( 26 NotifyFontUniqueNameLookupReady callback) override; 27 28 sk_sp<SkTypeface> MatchUniqueName(const String& font_unique_name) override; 29 30 private: 31 void EnsureServiceConnected(); 32 33 void ReceiveReadOnlySharedMemoryRegion( 34 base::ReadOnlySharedMemoryRegion shared_memory_region); 35 36 mojo::Remote<mojom::blink::FontUniqueNameLookup> service_; 37 WTF::Deque<NotifyFontUniqueNameLookupReady> pending_callbacks_; 38 base::Optional<bool> sync_available_; 39 40 DISALLOW_COPY_AND_ASSIGN(FontUniqueNameLookupAndroid); 41 }; 42 43 } // namespace blink 44 45 #endif 46