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"
16 SessionStorageObserver
* gSessionStorageObserver
= nullptr;
20 SessionStorageObserver::SessionStorageObserver() : mActor(nullptr) {
21 AssertIsOnOwningThread();
22 MOZ_ASSERT(NextGenLocalStorageEnabled());
24 MOZ_ASSERT(!gSessionStorageObserver
);
25 gSessionStorageObserver
= this;
28 SessionStorageObserver::~SessionStorageObserver() {
29 AssertIsOnOwningThread();
32 mActor
->SendDeleteMeInternal();
33 MOZ_ASSERT(!mActor
, "SendDeleteMeInternal should have cleared!");
36 MOZ_ASSERT(gSessionStorageObserver
);
37 gSessionStorageObserver
= nullptr;
41 SessionStorageObserver
* SessionStorageObserver::Get() {
42 MOZ_ASSERT(NS_IsMainThread());
43 MOZ_ASSERT(NextGenLocalStorageEnabled());
45 return gSessionStorageObserver
;
48 void SessionStorageObserver::SetActor(SessionStorageObserverChild
* aActor
) {
49 AssertIsOnOwningThread();
57 } // namespace mozilla