| 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/ContextLifecycleObserver.h" |
| 32 #include "core/dom/DOMStringList.h" | 33 #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 | 58 class MODULES_EXPORT IDBDatabase final |
| 59 : public EventTargetWithInlineData, | 59 : public EventTargetWithInlineData, |
| 60 public ActiveScriptWrappable<IDBDatabase>, | 60 public ActiveScriptWrappable<IDBDatabase>, |
| 61 public SuspendableObject { | 61 public ContextLifecycleObserver { |
| 62 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 62 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
| 63 DEFINE_WRAPPERTYPEINFO(); | 63 DEFINE_WRAPPERTYPEINFO(); |
| 64 | 64 |
| 65 public: | 65 public: |
| 66 static IDBDatabase* create(ExecutionContext*, | 66 static IDBDatabase* create(ExecutionContext*, |
| 67 std::unique_ptr<WebIDBDatabase>, | 67 std::unique_ptr<WebIDBDatabase>, |
| 68 IDBDatabaseCallbacks*); | 68 IDBDatabaseCallbacks*); |
| 69 ~IDBDatabase() override; | 69 ~IDBDatabase() override; |
| 70 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
| 71 | 71 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void onVersionChange(int64_t oldVersion, int64_t newVersion); | 116 void onVersionChange(int64_t oldVersion, int64_t newVersion); |
| 117 void onAbort(int64_t, DOMException*); | 117 void onAbort(int64_t, DOMException*); |
| 118 void onComplete(int64_t); | 118 void onComplete(int64_t); |
| 119 void onChanges(const std::unordered_map<int32_t, std::vector<int32_t>>& | 119 void onChanges(const std::unordered_map<int32_t, std::vector<int32_t>>& |
| 120 observation_index_map, | 120 observation_index_map, |
| 121 const WebVector<WebIDBObservation>& observations); | 121 const WebVector<WebIDBObservation>& observations); |
| 122 | 122 |
| 123 // ScriptWrappable | 123 // ScriptWrappable |
| 124 bool hasPendingActivity() const final; | 124 bool hasPendingActivity() const final; |
| 125 | 125 |
| 126 // SuspendableObject | 126 // ContextLifecycleObserver |
| 127 void contextDestroyed() override; | 127 void contextDestroyed() override; |
| 128 | 128 |
| 129 // EventTarget | 129 // EventTarget |
| 130 const AtomicString& interfaceName() const override; | 130 const AtomicString& interfaceName() const override; |
| 131 ExecutionContext* getExecutionContext() const override; | 131 ExecutionContext* getExecutionContext() const override; |
| 132 | 132 |
| 133 bool isClosePending() const { return m_closePending; } | 133 bool isClosePending() const { return m_closePending; } |
| 134 void forceClose(); | 134 void forceClose(); |
| 135 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 135 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
| 136 void enqueueEvent(Event*); | 136 void enqueueEvent(Event*); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Keep track of the versionchange events waiting to be fired on this | 195 // Keep track of the versionchange events waiting to be fired on this |
| 196 // database so that we can cancel them if the database closes. | 196 // database so that we can cancel them if the database closes. |
| 197 HeapVector<Member<Event>> m_enqueuedEvents; | 197 HeapVector<Member<Event>> m_enqueuedEvents; |
| 198 | 198 |
| 199 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 199 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 } // namespace blink | 202 } // namespace blink |
| 203 | 203 |
| 204 #endif // IDBDatabase_h | 204 #endif // IDBDatabase_h |
| OLD | NEW |