1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=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/. */
7 #include "SessionStorageObserver.h"
8 #include "StorageIPC.h"
9 #include "mozilla/dom/LocalStorageCommon.h"
11 namespace mozilla::dom
{
15 SessionStorageObserver
* gSessionStorageObserver
= nullptr;
19 SessionStorageObserver::SessionStorageObserver() : mActor(nullptr) {
20 AssertIsOnOwningThread();
21 MOZ_ASSERT(NextGenLocalStorageEnabled());
23 MOZ_ASSERT(!gSessionStorageObserver
);
24 gSessionStorageObserver
= this;
27 SessionStorageObserver::~SessionStorageObserver() {
28 AssertIsOnOwningThread();
31 mActor
->SendDeleteMeInternal();
32 MOZ_ASSERT(!mActor
, "SendDeleteMeInternal should have cleared!");
35 MOZ_ASSERT(gSessionStorageObserver
);
36 gSessionStorageObserver
= nullptr;
40 SessionStorageObserver
* SessionStorageObserver::Get() {
41 MOZ_ASSERT(NS_IsMainThread());
42 MOZ_ASSERT(NextGenLocalStorageEnabled());
44 return gSessionStorageObserver
;
47 void SessionStorageObserver::SetActor(SessionStorageObserverChild
* aActor
) {
48 AssertIsOnOwningThread();
55 } // namespace mozilla::dom