| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef StorageNamespaceController_h | 5 #ifndef StorageNamespaceController_h |
| 6 #define StorageNamespaceController_h | 6 #define StorageNamespaceController_h |
| 7 | 7 |
| 8 #include "core/page/Page.h" | 8 #include "core/page/Page.h" |
| 9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
| 10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class StorageClient; | 14 class StorageClient; |
| 15 class StorageNamespace; | 15 class StorageNamespace; |
| 16 | 16 |
| 17 class StorageNamespaceController final : public NoBaseWillBeGarbageCollected<Sto
rageNamespaceController>, public WillBeHeapSupplement<Page> { | 17 class StorageNamespaceController final : public NoBaseWillBeGarbageCollectedFina
lized<StorageNamespaceController>, public WillBeHeapSupplement<Page> { |
| 18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(StorageNamespaceController); | 18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(StorageNamespaceController); |
| 19 public: | 19 public: |
| 20 StorageNamespace* sessionStorage(bool optionalCreate = true); | 20 StorageNamespace* sessionStorage(bool optionalCreate = true); |
| 21 ~StorageNamespaceController(); |
| 21 | 22 |
| 22 static void provideStorageNamespaceTo(Page&, StorageClient*); | 23 static void provideStorageNamespaceTo(Page&, StorageClient*); |
| 23 static StorageNamespaceController* from(Page* page) { return static_cast<Sto
rageNamespaceController*>(WillBeHeapSupplement<Page>::from(page, supplementName(
))); } | 24 static StorageNamespaceController* from(Page* page) { return static_cast<Sto
rageNamespaceController*>(WillBeHeapSupplement<Page>::from(page, supplementName(
))); } |
| 24 | 25 |
| 25 virtual void trace(Visitor* visitor) override { WillBeHeapSupplement<Page>::
trace(visitor); } | 26 virtual void trace(Visitor* visitor) override { WillBeHeapSupplement<Page>::
trace(visitor); } |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 explicit StorageNamespaceController(StorageClient*); | 29 explicit StorageNamespaceController(StorageClient*); |
| 29 static const char* supplementName(); | 30 static const char* supplementName(); |
| 30 OwnPtr<StorageNamespace> m_sessionStorage; | 31 OwnPtr<StorageNamespace> m_sessionStorage; |
| 31 StorageClient* m_client; | 32 StorageClient* m_client; |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 } // namespace blink | 35 } // namespace blink |
| 35 | 36 |
| 36 #endif // StorageNamespaceController_h | 37 #endif // StorageNamespaceController_h |
| 37 | |
| OLD | NEW |