tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SessionStorageService.h (1518B)


      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 file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef DOM_STORAGE_SESSIONSTORAGESERVICE_H_
      8 #define DOM_STORAGE_SESSIONSTORAGESERVICE_H_
      9 
     10 #include "mozilla/Result.h"
     11 #include "mozilla/dom/FlippedOnce.h"
     12 #include "mozilla/dom/PBackgroundSessionStorageServiceChild.h"
     13 #include "nsISessionStorageService.h"
     14 
     15 namespace mozilla {
     16 
     17 struct CreateIfNonExistent;
     18 
     19 namespace dom {
     20 
     21 class SessionStorageService final
     22    : public nsISessionStorageService,
     23      public PBackgroundSessionStorageServiceChild {
     24 public:
     25  NS_DECL_ISUPPORTS
     26  NS_DECL_NSISESSIONSTORAGESERVICE
     27 
     28  SessionStorageService();
     29 
     30  // Singleton Boilerplate
     31  static mozilla::Result<RefPtr<SessionStorageService>, nsresult> Acquire(
     32      const CreateIfNonExistent&);
     33 
     34  // Can return null if the service hasn't be created yet or after
     35  // XPCOMShutdown.
     36  static RefPtr<SessionStorageService> Acquire();
     37 
     38 private:
     39  ~SessionStorageService();
     40 
     41  mozilla::Result<Ok, nsresult> Init();
     42 
     43  void Shutdown();
     44 
     45  // IPDL methods are only called by IPDL.
     46  void ActorDestroy(ActorDestroyReason aWhy) override;
     47 
     48  FlippedOnce<false> mInitialized;
     49  FlippedOnce<false> mActorDestroyed;
     50 };
     51 
     52 }  // namespace dom
     53 }  // namespace mozilla
     54 
     55 #endif /* DOM_STORAGE_SESSIONSTORAGESERVICE_H_ */