Chromium Code Reviews| 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 7177a8b86ba262595d51bc22f53223ac92858574..64392ea418981e1823220ddc357067cf583faffa 100644 |
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.h |
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.h |
| @@ -48,10 +48,10 @@ class IDBIndex final : public GarbageCollectedFinalized<IDBIndex>, |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - static IDBIndex* create(const IDBIndexMetadata& metadata, |
| + 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(); |
| @@ -88,9 +88,14 @@ class IDBIndex final : public GarbageCollectedFinalized<IDBIndex>, |
| uint32_t maxCount, |
| ExceptionState&); |
| - void markDeleted() { m_deleted = true; } |
| - bool isDeleted() const; |
| + void markDeleted() { |
| + DCHECK(m_transaction->isVersionChange()) |
|
jsbell
2016/10/06 20:01:31
This should probably move into .cpp file. (Otherwi
pwnall
2016/10/06 22:15:22
Isn't that an acceptable tradeoff in return for sm
|
| + << "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); |
| @@ -98,9 +103,9 @@ class IDBIndex final : public GarbageCollectedFinalized<IDBIndex>, |
| 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, |
| @@ -112,7 +117,7 @@ class IDBIndex final : public GarbageCollectedFinalized<IDBIndex>, |
| ExceptionState&, |
| bool keyOnly); |
| - IDBIndexMetadata m_metadata; |
| + RefPtr<IDBIndexMetadata> m_metadata; |
| Member<IDBObjectStore> m_objectStore; |
| Member<IDBTransaction> m_transaction; |
| bool m_deleted = false; |