Chromium Code Reviews| Index: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.h |
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.h b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.h |
| index 9349f10380237c95024c5baf0788d9d093d8318c..0bc4ab1ca37fb3cead3e7efe1a0b934ef014b85e 100644 |
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.h |
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.h |
| @@ -59,14 +59,17 @@ public: |
| ~IDBObjectStore() { } |
| DECLARE_TRACE(); |
| + const IDBObjectStoreMetadata& metadata() const { return m_metadata; } |
| + const IDBKeyPath& idbKeyPath() const { return metadata().keyPath; } |
|
cmumford
2016/09/19 23:26:48
IDBObjectStore *is* an "idb" thing, so idbKeyPath
pwnall
2016/09/20 09:11:14
There's a keyPath() accessor in the WebIDL interfa
cmumford
2016/09/23 22:21:11
I'm fine with that - thx for pointing it out.
|
| + |
| // Implement the IDBObjectStore IDL |
| - int64_t id() const { return m_metadata.id; } |
| - const String& name() const { return m_metadata.name; } |
| + int64_t id() const { return metadata().id; } |
| + const String& name() const { return metadata().name; } |
| void setName(const String& name, ExceptionState&); |
| ScriptValue keyPath(ScriptState*) const; |
| DOMStringList* indexNames() const; |
| IDBTransaction* transaction() const { return m_transaction.get(); } |
| - bool autoIncrement() const { return m_metadata.autoIncrement; } |
| + bool autoIncrement() const { return metadata().autoIncrement; } |
|
cmumford
2016/09/19 23:26:48
What is the rationale for switching m_metadata to
pwnall
2016/09/20 09:11:14
The idea is that we can switch the metadata repres
cmumford
2016/09/23 22:21:11
So you'd be switching from a before that is one of
pwnall
2016/09/23 22:33:04
Sorry I wasn't clear earlier. metadata() would alw
|
| IDBRequest* openCursor(ScriptState*, const ScriptValue& range, const String& direction, ExceptionState&); |
| IDBRequest* openKeyCursor(ScriptState*, const ScriptValue& range, const String& direction, ExceptionState&); |
| @@ -96,16 +99,13 @@ public: |
| // Used internally and by InspectorIndexedDBAgent: |
| IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection, WebIDBTaskType = WebIDBTaskTypeNormal); |
| - void markDeleted() { m_deleted = true; } |
| + void markDeleted(); |
| bool isDeleted() const { return m_deleted; } |
| void abort(); |
| void transactionFinished(); |
| - const IDBObjectStoreMetadata& metadata() const { return m_metadata; } |
| void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = metadata; } |
| - typedef HeapVector<Member<IDBKey>> IndexKeys; |
| - |
| // Used by IDBIndex::setName: |
| bool containsIndex(const String& name) const |
| { |
| @@ -127,7 +127,14 @@ private: |
| Member<IDBTransaction> m_transaction; |
| bool m_deleted = false; |
| - typedef HeapHashMap<String, Member<IDBIndex>> IDBIndexMap; |
| + // Caches the IDBIndex instances returned by the index() method. |
| + // The spec requires that an object store's index() returns the same |
| + // IDBIndex instance for a specific index, so this cache is necessary |
| + // for correctness. |
| + // |
| + // index() throws for completed/aborted transactions, so this is not used |
| + // after a transaction is finished, and can be cleared. |
| + using IDBIndexMap = HeapHashMap<String, Member<IDBIndex>>; |
| IDBIndexMap m_indexMap; |
| // Used to mark indexes created in an aborted upgrade transaction as |