Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBIndex.h

Issue 2314933005: Align IndexedDB metadata rollback on transaction abort to spec. (Closed)
Patch Set: Rebased past the big reformat. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())
+ << "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;

Powered by Google App Engine
This is Rietveld 408576698