| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "modules/indexeddb/GlobalIndexedDB.h" | 5 #include "modules/indexeddb/GlobalIndexedDB.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalDOMWindow.h" | 7 #include "core/frame/LocalDOMWindow.h" |
| 8 #include "core/workers/WorkerGlobalScope.h" | 8 #include "core/workers/WorkerGlobalScope.h" |
| 9 #include "modules/indexeddb/IDBFactory.h" | 9 #include "modules/indexeddb/IDBFactory.h" |
| 10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 template <typename T> | 17 template <typename T> |
| 18 class GlobalIndexedDBImpl final : public GarbageCollectedFinalized<GlobalIndexed
DBImpl<T>>, public Supplement<T> { | 18 class GlobalIndexedDBImpl final : public GarbageCollected<GlobalIndexedDBImpl<T>
>, public Supplement<T> { |
| 19 USING_GARBAGE_COLLECTED_MIXIN(GlobalIndexedDBImpl); | 19 USING_GARBAGE_COLLECTED_MIXIN(GlobalIndexedDBImpl); |
| 20 public: | 20 public: |
| 21 static GlobalIndexedDBImpl& from(T& supplementable) | 21 static GlobalIndexedDBImpl& from(T& supplementable) |
| 22 { | 22 { |
| 23 GlobalIndexedDBImpl* supplement = static_cast<GlobalIndexedDBImpl*>(Supp
lement<T>::from(supplementable, name())); | 23 GlobalIndexedDBImpl* supplement = static_cast<GlobalIndexedDBImpl*>(Supp
lement<T>::from(supplementable, name())); |
| 24 if (!supplement) { | 24 if (!supplement) { |
| 25 supplement = new GlobalIndexedDBImpl; | 25 supplement = new GlobalIndexedDBImpl; |
| 26 Supplement<T>::provideTo(supplementable, name(), supplement); | 26 Supplement<T>::provideTo(supplementable, name(), supplement); |
| 27 } | 27 } |
| 28 return *supplement; | 28 return *supplement; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 57 { | 57 { |
| 58 return GlobalIndexedDBImpl<LocalDOMWindow>::from(toLocalDOMWindow(window)).i
dbFactory(toLocalDOMWindow(window)); | 58 return GlobalIndexedDBImpl<LocalDOMWindow>::from(toLocalDOMWindow(window)).i
dbFactory(toLocalDOMWindow(window)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 IDBFactory* GlobalIndexedDB::indexedDB(WorkerGlobalScope& worker) | 61 IDBFactory* GlobalIndexedDB::indexedDB(WorkerGlobalScope& worker) |
| 62 { | 62 { |
| 63 return GlobalIndexedDBImpl<WorkerGlobalScope>::from(worker).idbFactory(worke
r); | 63 return GlobalIndexedDBImpl<WorkerGlobalScope>::from(worker).idbFactory(worke
r); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |