FontFaceSetWorkerImpl.h (1998B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_FontFaceSetWorkerImpl_h 8 #define mozilla_dom_FontFaceSetWorkerImpl_h 9 10 #include "mozilla/dom/FontFaceSetImpl.h" 11 12 namespace mozilla::dom { 13 class ThreadSafeWorkerRef; 14 class WorkerPrivate; 15 16 class FontFaceSetWorkerImpl final : public FontFaceSetImpl { 17 NS_DECL_ISUPPORTS_INHERITED 18 19 public: 20 explicit FontFaceSetWorkerImpl(FontFaceSet* aOwner); 21 22 bool Initialize(WorkerPrivate* aWorkerPrivate); 23 void Destroy() override; 24 25 bool IsOnOwningThread() override; 26 #ifdef DEBUG 27 void AssertIsOnOwningThread() override; 28 #endif 29 void DispatchToOwningThread(const char* aName, 30 std::function<void()>&& aFunc) override; 31 32 already_AddRefed<URLExtraData> GetURLExtraData() override; 33 34 void FlushUserFontSet() override; 35 36 // gfxUserFontSet 37 38 already_AddRefed<gfxUserFontFamily> LookupFamily( 39 const nsACString& aName) const override; 40 41 nsresult StartLoad(gfxUserFontEntry* aUserFontEntry, 42 uint32_t aSrcIndex) override; 43 44 bool IsFontLoadAllowed(const gfxFontFaceSrc&) override; 45 46 FontVisibilityProvider* GetFontVisibilityProvider() const override; 47 48 private: 49 ~FontFaceSetWorkerImpl() override; 50 51 void InitializeOnMainThread(); 52 53 uint64_t GetInnerWindowID() override; 54 55 nsresult CreateChannelForSyncLoadFontData( 56 nsIChannel** aOutChannel, gfxUserFontEntry* aFontToLoad, 57 const gfxFontFaceSrc* aFontFaceSrc) override; 58 59 TimeStamp GetNavigationStartTimeStamp() override; 60 61 RefPtr<ThreadSafeWorkerRef> mWorkerRef MOZ_GUARDED_BY(mMutex); 62 63 RefPtr<URLExtraData> mURLExtraData MOZ_GUARDED_BY(mMutex); 64 }; 65 66 } // namespace mozilla::dom 67 68 #endif // !defined(mozilla_dom_FontFaceSetWorkerImpl_h)