blob: 440037ef2a1a1c793dcf9bf71165ac66cbeee8fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DOMWindowStorage_h
#define DOMWindowStorage_h
#include "core/frame/DOMWindowProperty.h"
#include "platform/Supplementable.h"
#include "platform/heap/Handle.h"
namespace blink {
class DOMWindow;
class ExceptionState;
class Storage;
class DOMWindowStorage final : public NoBaseWillBeGarbageCollected<DOMWindowStorage>, public WillBeHeapSupplement<LocalDOMWindow>, public DOMWindowProperty {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMWindowStorage);
DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowStorage);
public:
static DOMWindowStorage& from(LocalDOMWindow&);
static Storage* sessionStorage(DOMWindow&, ExceptionState&);
static Storage* localStorage(DOMWindow&, ExceptionState&);
Storage* sessionStorage(ExceptionState&) const;
Storage* localStorage(ExceptionState&) const;
Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
Storage* optionalLocalStorage() const { return m_localStorage.get(); }
DECLARE_TRACE();
private:
explicit DOMWindowStorage(LocalDOMWindow&);
static const char* supplementName();
RawPtrWillBeMember<LocalDOMWindow> m_window;
mutable PersistentWillBeMember<Storage> m_sessionStorage;
mutable PersistentWillBeMember<Storage> m_localStorage;
};
} // namespace blink
#endif // DOMWindowStorage_h
|