| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef IDBDatabase_h | 26 #ifndef IDBDatabase_h |
| 27 #define IDBDatabase_h | 27 #define IDBDatabase_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ActiveScriptWrappable.h" | 29 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 30 #include "bindings/core/v8/ScriptState.h" | 30 #include "bindings/core/v8/ScriptState.h" |
| 31 #include "bindings/modules/v8/StringOrStringSequenceOrDOMStringList.h" | 31 #include "bindings/modules/v8/StringOrStringSequenceOrDOMStringList.h" |
| 32 #include "core/dom/ActiveDOMObject.h" | |
| 33 #include "core/dom/DOMStringList.h" | 32 #include "core/dom/DOMStringList.h" |
| 33 #include "core/dom/SuspendableObject.h" |
| 34 #include "modules/EventModules.h" | 34 #include "modules/EventModules.h" |
| 35 #include "modules/EventTargetModules.h" | 35 #include "modules/EventTargetModules.h" |
| 36 #include "modules/ModulesExport.h" | 36 #include "modules/ModulesExport.h" |
| 37 #include "modules/indexeddb/IDBDatabaseCallbacks.h" | 37 #include "modules/indexeddb/IDBDatabaseCallbacks.h" |
| 38 #include "modules/indexeddb/IDBHistograms.h" | 38 #include "modules/indexeddb/IDBHistograms.h" |
| 39 #include "modules/indexeddb/IDBMetadata.h" | 39 #include "modules/indexeddb/IDBMetadata.h" |
| 40 #include "modules/indexeddb/IDBObjectStore.h" | 40 #include "modules/indexeddb/IDBObjectStore.h" |
| 41 #include "modules/indexeddb/IDBObjectStoreParameters.h" | 41 #include "modules/indexeddb/IDBObjectStoreParameters.h" |
| 42 #include "modules/indexeddb/IDBTransaction.h" | 42 #include "modules/indexeddb/IDBTransaction.h" |
| 43 #include "modules/indexeddb/IndexedDB.h" | 43 #include "modules/indexeddb/IndexedDB.h" |
| 44 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
| 45 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" | 45 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" |
| 46 #include "wtf/PassRefPtr.h" | 46 #include "wtf/PassRefPtr.h" |
| 47 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
| 48 #include <memory> | 48 #include <memory> |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 class DOMException; | 52 class DOMException; |
| 53 class ExceptionState; | 53 class ExceptionState; |
| 54 class ExecutionContext; | 54 class ExecutionContext; |
| 55 class IDBObserver; | 55 class IDBObserver; |
| 56 struct WebIDBObservation; | 56 struct WebIDBObservation; |
| 57 | 57 |
| 58 class MODULES_EXPORT IDBDatabase final : public EventTargetWithInlineData, | 58 class MODULES_EXPORT IDBDatabase final : public EventTargetWithInlineData, |
| 59 public ActiveScriptWrappable, | 59 public ActiveScriptWrappable, |
| 60 public ActiveDOMObject { | 60 public SuspendableObject { |
| 61 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 61 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
| 62 DEFINE_WRAPPERTYPEINFO(); | 62 DEFINE_WRAPPERTYPEINFO(); |
| 63 | 63 |
| 64 public: | 64 public: |
| 65 static IDBDatabase* create(ExecutionContext*, | 65 static IDBDatabase* create(ExecutionContext*, |
| 66 std::unique_ptr<WebIDBDatabase>, | 66 std::unique_ptr<WebIDBDatabase>, |
| 67 IDBDatabaseCallbacks*); | 67 IDBDatabaseCallbacks*); |
| 68 ~IDBDatabase() override; | 68 ~IDBDatabase() override; |
| 69 DECLARE_VIRTUAL_TRACE(); | 69 DECLARE_VIRTUAL_TRACE(); |
| 70 | 70 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void onVersionChange(int64_t oldVersion, int64_t newVersion); | 115 void onVersionChange(int64_t oldVersion, int64_t newVersion); |
| 116 void onAbort(int64_t, DOMException*); | 116 void onAbort(int64_t, DOMException*); |
| 117 void onComplete(int64_t); | 117 void onComplete(int64_t); |
| 118 void onChanges(const std::unordered_map<int32_t, std::vector<int32_t>>& | 118 void onChanges(const std::unordered_map<int32_t, std::vector<int32_t>>& |
| 119 observation_index_map, | 119 observation_index_map, |
| 120 const WebVector<WebIDBObservation>& observations); | 120 const WebVector<WebIDBObservation>& observations); |
| 121 | 121 |
| 122 // ScriptWrappable | 122 // ScriptWrappable |
| 123 bool hasPendingActivity() const final; | 123 bool hasPendingActivity() const final; |
| 124 | 124 |
| 125 // ActiveDOMObject | 125 // SuspendableObject |
| 126 void contextDestroyed() override; | 126 void contextDestroyed() override; |
| 127 | 127 |
| 128 // EventTarget | 128 // EventTarget |
| 129 const AtomicString& interfaceName() const override; | 129 const AtomicString& interfaceName() const override; |
| 130 ExecutionContext* getExecutionContext() const override; | 130 ExecutionContext* getExecutionContext() const override; |
| 131 | 131 |
| 132 bool isClosePending() const { return m_closePending; } | 132 bool isClosePending() const { return m_closePending; } |
| 133 void forceClose(); | 133 void forceClose(); |
| 134 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 134 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
| 135 void enqueueEvent(Event*); | 135 void enqueueEvent(Event*); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Keep track of the versionchange events waiting to be fired on this | 194 // Keep track of the versionchange events waiting to be fired on this |
| 195 // database so that we can cancel them if the database closes. | 195 // database so that we can cancel them if the database closes. |
| 196 HeapVector<Member<Event>> m_enqueuedEvents; | 196 HeapVector<Member<Event>> m_enqueuedEvents; |
| 197 | 197 |
| 198 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 198 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| 202 | 202 |
| 203 #endif // IDBDatabase_h | 203 #endif // IDBDatabase_h |
| OLD | NEW |