Bug 1946787 - Avoid creating redundant GradientCache::OnMaxEntriesBreached tasks...
[gecko.git] / dom / clients / api / Clients.h
blob481b066655f112fcb76cf4a168d7ffec6e9d7557
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 #ifndef _mozilla_dom_Clients_h
7 #define _mozilla_dom_Clients_h
9 #include "nsCOMPtr.h"
10 #include "nsISupports.h"
11 #include "nsWrapperCache.h"
13 class nsIGlobalObject;
15 namespace mozilla {
17 class ErrorResult;
19 namespace dom {
21 struct ClientQueryOptions;
22 class Promise;
24 class Clients final : public nsISupports, public nsWrapperCache {
25 nsCOMPtr<nsIGlobalObject> mGlobal;
27 ~Clients() = default;
29 public:
30 explicit Clients(nsIGlobalObject* aGlobal);
32 // nsWrapperCache interface methods
33 JSObject* WrapObject(JSContext* aCx,
34 JS::Handle<JSObject*> aGivenProto) override;
36 // DOM bindings methods
37 nsIGlobalObject* GetParentObject() const;
39 already_AddRefed<Promise> Get(const nsAString& aClientID, ErrorResult& aRv);
41 already_AddRefed<Promise> MatchAll(const ClientQueryOptions& aOptions,
42 ErrorResult& aRv);
44 already_AddRefed<Promise> OpenWindow(const nsAString& aURL, ErrorResult& aRv);
46 already_AddRefed<Promise> Claim(ErrorResult& aRv);
48 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
49 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(Clients)
52 } // namespace dom
53 } // namespace mozilla
55 #endif // _mozilla_dom_Clients_h