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/. */
7 #ifndef mozilla_dom_FontFaceSetWorkerImpl_h
8 #define mozilla_dom_FontFaceSetWorkerImpl_h
10 #include "mozilla/dom/FontFaceSetImpl.h"
12 namespace mozilla::dom
{
13 class ThreadSafeWorkerRef
;
16 class FontFaceSetWorkerImpl final
: public FontFaceSetImpl
{
17 NS_DECL_ISUPPORTS_INHERITED
20 explicit FontFaceSetWorkerImpl(FontFaceSet
* aOwner
);
22 bool Initialize(WorkerPrivate
* aWorkerPrivate
);
23 void Destroy() override
;
25 bool IsOnOwningThread() override
;
27 void AssertIsOnOwningThread() override
;
29 void DispatchToOwningThread(const char* aName
,
30 std::function
<void()>&& aFunc
) override
;
32 already_AddRefed
<URLExtraData
> GetURLExtraData() override
;
34 void FlushUserFontSet() override
;
38 already_AddRefed
<gfxUserFontFamily
> LookupFamily(
39 const nsACString
& aName
) const override
;
41 nsresult
StartLoad(gfxUserFontEntry
* aUserFontEntry
,
42 uint32_t aSrcIndex
) override
;
44 bool IsFontLoadAllowed(const gfxFontFaceSrc
&) override
;
46 nsPresContext
* GetPresContext() const override
;
49 ~FontFaceSetWorkerImpl() override
;
51 void InitializeOnMainThread();
53 uint64_t GetInnerWindowID() override
;
55 nsresult
CreateChannelForSyncLoadFontData(
56 nsIChannel
** aOutChannel
, gfxUserFontEntry
* aFontToLoad
,
57 const gfxFontFaceSrc
* aFontFaceSrc
) override
;
59 TimeStamp
GetNavigationStartTimeStamp() override
;
61 RefPtr
<ThreadSafeWorkerRef
> mWorkerRef
MOZ_GUARDED_BY(mMutex
);
63 RefPtr
<URLExtraData
> mURLExtraData
MOZ_GUARDED_BY(mMutex
);
66 } // namespace mozilla::dom
68 #endif // !defined(mozilla_dom_FontFaceSetWorkerImpl_h)