Index: third_party/WebKit/Source/modules/indexeddb/IDBIndex.h |
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.h b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.h |
index 041080d529e2b88f50ba00f69004cadb6ad38c75..9cad7f0cb8e0955f88469ff4d868d49fb1da69d1 100644 |
--- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.h |
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.h |
@@ -46,9 +46,9 @@ class IDBObjectStore; |
class IDBIndex final : public GarbageCollectedFinalized<IDBIndex>, public ScriptWrappable { |
DEFINE_WRAPPERTYPEINFO(); |
public: |
- static IDBIndex* create(const IDBIndexMetadata& metadata, IDBObjectStore* objectStore, IDBTransaction* transaction) |
+ static IDBIndex* create(RefPtr<IDBIndexMetadata> metadata, IDBObjectStore* objectStore, IDBTransaction* transaction) |
{ |
- return new IDBIndex(metadata, objectStore, transaction); |
+ return new IDBIndex(std::move(metadata), objectStore, transaction); |
} |
~IDBIndex(); |
DECLARE_TRACE(); |
@@ -71,9 +71,14 @@ public: |
IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, ExceptionState&); |
IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, uint32_t maxCount, ExceptionState&); |
- void markDeleted() { m_deleted = true; } |
- bool isDeleted() const; |
+ void markDeleted() |
+ { |
+ DCHECK(m_transaction->isVersionChange()) << "Index deleted outside versionchange transaction."; |
+ m_deleted = true; |
+ } |
+ bool isDeleted() const { return m_deleted; } |
int64_t id() const { return metadata().id; } |
+ void revertMetadata(RefPtr<IDBIndexMetadata> oldMetadata); |
// Used internally and by InspectorIndexedDBAgent: |
IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection); |
@@ -81,14 +86,14 @@ public: |
WebIDBDatabase* backendDB() const; |
private: |
- IDBIndex(const IDBIndexMetadata&, IDBObjectStore*, IDBTransaction*); |
+ IDBIndex(RefPtr<IDBIndexMetadata>, IDBObjectStore*, IDBTransaction*); |
- const IDBIndexMetadata& metadata() const { return m_metadata; } |
+ const IDBIndexMetadata& metadata() const { return *m_metadata; } |
IDBRequest* getInternal(ScriptState*, const ScriptValue& key, ExceptionState&, bool keyOnly); |
IDBRequest* getAllInternal(ScriptState*, const ScriptValue& range, unsigned long maxCount, ExceptionState&, bool keyOnly); |
- IDBIndexMetadata m_metadata; |
+ RefPtr<IDBIndexMetadata> m_metadata; |
Member<IDBObjectStore> m_objectStore; |
Member<IDBTransaction> m_transaction; |
bool m_deleted = false; |