Bug 1733673 [wpt PR 31066] - Annotate CSS Transforms WPT reftests as fuzzy where...
[gecko.git] / dom / locks / LockManager.h
bloba750150ad6f081762b84c8982c32d70adefced28
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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_LockManager_h
8 #define mozilla_dom_LockManager_h
10 #include "js/TypeDecls.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/ErrorResult.h"
13 #include "mozilla/dom/BindingDeclarations.h"
14 #include "mozilla/dom/Lock.h"
15 #include "mozilla/dom/LockManagerBinding.h"
16 #include "mozilla/dom/WorkerRef.h"
17 #include "nsCycleCollectionParticipant.h"
18 #include "nsHashKeys.h"
19 #include "nsTHashMap.h"
20 #include "nsTHashSet.h"
21 #include "nsWrapperCache.h"
23 class nsIGlobalObject;
25 namespace mozilla::dom {
27 class LockGrantedCallback;
28 struct LockOptions;
30 namespace locks {
31 class LockManagerChild;
34 class LockManager final : public nsISupports, public nsWrapperCache {
35 public:
36 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
37 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(LockManager)
39 explicit LockManager(nsIGlobalObject* aGlobal);
41 nsIGlobalObject* GetParentObject() const { return mOwner; }
43 JSObject* WrapObject(JSContext* aCx,
44 JS::Handle<JSObject*> aGivenProto) override;
46 already_AddRefed<Promise> Request(const nsAString& aName,
47 LockGrantedCallback& aCallback,
48 ErrorResult& aRv);
49 already_AddRefed<Promise> Request(const nsAString& aName,
50 const LockOptions& aOptions,
51 LockGrantedCallback& aCallback,
52 ErrorResult& aRv);
54 already_AddRefed<Promise> Query(ErrorResult& aRv);
56 void Shutdown();
58 private:
59 ~LockManager() = default;
61 nsCOMPtr<nsIGlobalObject> mOwner;
62 RefPtr<locks::LockManagerChild> mActor;
64 RefPtr<WeakWorkerRef> mWorkerRef;
67 } // namespace mozilla::dom
69 #endif // mozilla_dom_LockManager_h