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"
14 SessionStorageObserver
* gSessionStorageObserver
= nullptr;
18 SessionStorageObserver::SessionStorageObserver() : mActor(nullptr) {
19 AssertIsOnOwningThread();
20 MOZ_ASSERT(NextGenLocalStorageEnabled());
22 MOZ_ASSERT(!gSessionStorageObserver
);
23 gSessionStorageObserver
= this;
26 SessionStorageObserver::~SessionStorageObserver() {
27 AssertIsOnOwningThread();
30 mActor
->SendDeleteMeInternal();
31 MOZ_ASSERT(!mActor
, "SendDeleteMeInternal should have cleared!");
34 MOZ_ASSERT(gSessionStorageObserver
);
35 gSessionStorageObserver
= nullptr;
39 SessionStorageObserver
* SessionStorageObserver::Get() {
40 MOZ_ASSERT(NS_IsMainThread());
41 MOZ_ASSERT(NextGenLocalStorageEnabled());
43 return gSessionStorageObserver
;
46 void SessionStorageObserver::SetActor(SessionStorageObserverChild
* aActor
) {
47 AssertIsOnOwningThread();
55 } // namespace mozilla