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_intl_l10n_FluentResource_h
8 #define mozilla_intl_l10n_FluentResource_h
10 #include "mozilla/dom/BindingDeclarations.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsWrapperCache.h"
13 #include "mozilla/dom/FluentBinding.h"
14 #include "mozilla/intl/FluentBindings.h"
19 class FluentResource
: public nsWrapperCache
{
21 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(FluentResource
)
22 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(FluentResource
)
24 FluentResource(nsISupports
* aParent
, const ffi::FluentResource
* aRaw
);
25 FluentResource(nsISupports
* aParent
, const nsACString
& aSource
);
27 static already_AddRefed
<FluentResource
> Constructor(
28 const dom::GlobalObject
& aGlobal
, const nsACString
& aSource
);
30 JSObject
* WrapObject(JSContext
* aCx
,
31 JS::Handle
<JSObject
*> aGivenProto
) override
;
32 nsISupports
* GetParentObject() const { return mParent
; }
34 const ffi::FluentResource
* Raw() const { return mRaw
; }
37 virtual ~FluentResource() = default;
39 nsCOMPtr
<nsISupports
> mParent
;
40 RefPtr
<const ffi::FluentResource
> mRaw
;
45 } // namespace mozilla