CookieStoreNotificationWatcherWrapper.h (1296B)
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_CookieStoreNotificationWatcherWrapper_h 8 #define mozilla_dom_CookieStoreNotificationWatcherWrapper_h 9 10 #include "mozilla/OriginAttributes.h" 11 12 namespace mozilla::dom { 13 14 class Promise; 15 class CookieStore; 16 class CookieStoreNotificationWatcher; 17 18 class CookieStoreNotificationWatcherWrapper final { 19 public: 20 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CookieStoreNotificationWatcherWrapper) 21 22 static already_AddRefed<CookieStoreNotificationWatcherWrapper> Create( 23 CookieStore* aCookieStore); 24 25 void ResolvePromiseWhenNotified(const nsID& aOperationID, Promise* aPromise); 26 void ForgetOperationID(const nsID& aOperationID); 27 28 private: 29 CookieStoreNotificationWatcherWrapper() = default; 30 ~CookieStoreNotificationWatcherWrapper(); 31 32 void CreateWatcherOnMainThread(bool aPrivateBrowsing); 33 34 RefPtr<CookieStoreNotificationWatcher> mWatcherOnMainThread; 35 }; 36 37 } // namespace mozilla::dom 38 39 #endif /* mozilla_dom_CookieStoreNotificationWatcherWrapper_h */