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 27 matching lines...) Expand all Loading... |
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 |
48 #include <memory> | 49 #include <memory> |
49 | 50 |
50 namespace blink { | 51 namespace blink { |
51 | 52 |
52 class DOMException; | 53 class DOMException; |
53 class ExceptionState; | 54 class ExceptionState; |
54 class ExecutionContext; | 55 class ExecutionContext; |
55 class IDBObserver; | 56 class IDBObserver; |
56 struct WebIDBObservation; | 57 struct WebIDBObservation; |
57 | 58 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 111 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
111 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 112 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
112 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 113 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
113 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); | 114 DEFINE_ATTRIBUTE_EVENT_LISTENER(versionchange); |
114 | 115 |
115 // IDBDatabaseCallbacks | 116 // IDBDatabaseCallbacks |
116 void onVersionChange(int64_t oldVersion, int64_t newVersion); | 117 void onVersionChange(int64_t oldVersion, int64_t newVersion); |
117 void onAbort(int64_t, DOMException*); | 118 void onAbort(int64_t, DOMException*); |
118 void onComplete(int64_t); | 119 void onComplete(int64_t); |
119 void onChanges(const std::unordered_map<int32_t, std::vector<int32_t>>& | 120 void onChanges( |
120 observation_index_map, | 121 const std::unordered_map<int32_t, std::vector<int32_t>>& |
121 const WebVector<WebIDBObservation>& observations); | 122 observation_index_map, |
| 123 const WebVector<WebIDBObservation>& observations, |
| 124 const std::unordered_map<int32_t, |
| 125 std::pair<int64_t, std::vector<int64_t>>>& |
| 126 transactions); |
122 | 127 |
123 // ScriptWrappable | 128 // ScriptWrappable |
124 bool hasPendingActivity() const final; | 129 bool hasPendingActivity() const final; |
125 | 130 |
126 // ContextLifecycleObserver | 131 // ContextLifecycleObserver |
127 void contextDestroyed() override; | 132 void contextDestroyed() override; |
128 | 133 |
129 // EventTarget | 134 // EventTarget |
130 const AtomicString& interfaceName() const override; | 135 const AtomicString& interfaceName() const override; |
131 ExecutionContext* getExecutionContext() const override; | 136 ExecutionContext* getExecutionContext() const override; |
(...skipping 10 matching lines...) Expand all Loading... |
142 void renameObjectStore(int64_t storeId, const String& newName); | 147 void renameObjectStore(int64_t storeId, const String& newName); |
143 void revertObjectStoreCreation(int64_t objectStoreId); | 148 void revertObjectStoreCreation(int64_t objectStoreId); |
144 void revertObjectStoreMetadata(RefPtr<IDBObjectStoreMetadata> oldMetadata); | 149 void revertObjectStoreMetadata(RefPtr<IDBObjectStoreMetadata> oldMetadata); |
145 | 150 |
146 // Will return nullptr if this database is stopped. | 151 // Will return nullptr if this database is stopped. |
147 WebIDBDatabase* backend() const { return m_backend.get(); } | 152 WebIDBDatabase* backend() const { return m_backend.get(); } |
148 | 153 |
149 static int64_t nextTransactionId(); | 154 static int64_t nextTransactionId(); |
150 static int32_t nextObserverId(); | 155 static int32_t nextObserverId(); |
151 | 156 |
| 157 static const char cannotObserveVersionChangeTransaction[]; |
152 static const char indexDeletedErrorMessage[]; | 158 static const char indexDeletedErrorMessage[]; |
153 static const char indexNameTakenErrorMessage[]; | 159 static const char indexNameTakenErrorMessage[]; |
154 static const char isKeyCursorErrorMessage[]; | 160 static const char isKeyCursorErrorMessage[]; |
155 static const char noKeyOrKeyRangeErrorMessage[]; | 161 static const char noKeyOrKeyRangeErrorMessage[]; |
156 static const char noSuchIndexErrorMessage[]; | 162 static const char noSuchIndexErrorMessage[]; |
157 static const char noSuchObjectStoreErrorMessage[]; | 163 static const char noSuchObjectStoreErrorMessage[]; |
158 static const char noValueErrorMessage[]; | 164 static const char noValueErrorMessage[]; |
159 static const char notValidKeyErrorMessage[]; | 165 static const char notValidKeyErrorMessage[]; |
160 static const char notVersionChangeTransactionErrorMessage[]; | 166 static const char notVersionChangeTransactionErrorMessage[]; |
161 static const char objectStoreDeletedErrorMessage[]; | 167 static const char objectStoreDeletedErrorMessage[]; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Keep track of the versionchange events waiting to be fired on this | 201 // Keep track of the versionchange events waiting to be fired on this |
196 // database so that we can cancel them if the database closes. | 202 // database so that we can cancel them if the database closes. |
197 HeapVector<Member<Event>> m_enqueuedEvents; | 203 HeapVector<Member<Event>> m_enqueuedEvents; |
198 | 204 |
199 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 205 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
200 }; | 206 }; |
201 | 207 |
202 } // namespace blink | 208 } // namespace blink |
203 | 209 |
204 #endif // IDBDatabase_h | 210 #endif // IDBDatabase_h |
OLD | NEW |