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 18 matching lines...) Expand all Loading... |
29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
30 #include "bindings/core/v8/SerializedScriptValue.h" | 30 #include "bindings/core/v8/SerializedScriptValue.h" |
31 #include "modules/indexeddb/IDBCursor.h" | 31 #include "modules/indexeddb/IDBCursor.h" |
32 #include "modules/indexeddb/IDBIndex.h" | 32 #include "modules/indexeddb/IDBIndex.h" |
33 #include "modules/indexeddb/IDBIndexParameters.h" | 33 #include "modules/indexeddb/IDBIndexParameters.h" |
34 #include "modules/indexeddb/IDBKey.h" | 34 #include "modules/indexeddb/IDBKey.h" |
35 #include "modules/indexeddb/IDBKeyRange.h" | 35 #include "modules/indexeddb/IDBKeyRange.h" |
36 #include "modules/indexeddb/IDBMetadata.h" | 36 #include "modules/indexeddb/IDBMetadata.h" |
37 #include "modules/indexeddb/IDBRequest.h" | 37 #include "modules/indexeddb/IDBRequest.h" |
38 #include "modules/indexeddb/IDBTransaction.h" | 38 #include "modules/indexeddb/IDBTransaction.h" |
39 #include "public/platform/modules/indexeddb/WebIDBCursor.h" | |
40 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" | |
41 #include "public/platform/modules/indexeddb/WebIDBTypes.h" | 39 #include "public/platform/modules/indexeddb/WebIDBTypes.h" |
42 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
43 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
44 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
45 | 43 |
46 namespace blink { | 44 namespace blink { |
47 | 45 |
48 class DOMStringList; | 46 class DOMStringList; |
49 class IDBAny; | 47 class IDBAny; |
50 class ExceptionState; | 48 class ExceptionState; |
(...skipping 21 matching lines...) Expand all Loading... |
72 IDBRequest* get(ScriptState*, const ScriptValue& key, ExceptionState&); | 70 IDBRequest* get(ScriptState*, const ScriptValue& key, ExceptionState&); |
73 IDBRequest* getAll(ScriptState*, const ScriptValue& range, unsigned long max
Count, ExceptionState&); | 71 IDBRequest* getAll(ScriptState*, const ScriptValue& range, unsigned long max
Count, ExceptionState&); |
74 IDBRequest* getAll(ScriptState*, const ScriptValue& range, ExceptionState&); | 72 IDBRequest* getAll(ScriptState*, const ScriptValue& range, ExceptionState&); |
75 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, unsigned long
maxCount, ExceptionState&); | 73 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, unsigned long
maxCount, ExceptionState&); |
76 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, ExceptionStat
e&); | 74 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, ExceptionStat
e&); |
77 IDBRequest* add(ScriptState*, const ScriptValue&, const ScriptValue& key, Ex
ceptionState&); | 75 IDBRequest* add(ScriptState*, const ScriptValue&, const ScriptValue& key, Ex
ceptionState&); |
78 IDBRequest* put(ScriptState*, const ScriptValue&, const ScriptValue& key, Ex
ceptionState&); | 76 IDBRequest* put(ScriptState*, const ScriptValue&, const ScriptValue& key, Ex
ceptionState&); |
79 IDBRequest* deleteFunction(ScriptState*, const ScriptValue& key, ExceptionSt
ate&); | 77 IDBRequest* deleteFunction(ScriptState*, const ScriptValue& key, ExceptionSt
ate&); |
80 IDBRequest* clear(ScriptState*, ExceptionState&); | 78 IDBRequest* clear(ScriptState*, ExceptionState&); |
81 | 79 |
82 IDBIndex* createIndex(ScriptState* scriptState, const String& name, const St
ringOrStringSequence& keyPath, const IDBIndexParameters& options, ExceptionState
& exceptionState) | 80 IDBIndex* createIndex(ScriptState*, const String& name, const StringOrString
Sequence& keyPath, const IDBIndexParameters& options, ExceptionState&); |
83 { | |
84 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce
ptionState); | |
85 } | |
86 IDBIndex* index(const String& name, ExceptionState&); | 81 IDBIndex* index(const String& name, ExceptionState&); |
87 void deleteIndex(const String& name, ExceptionState&); | 82 void deleteIndex(const String& name, ExceptionState&); |
88 | 83 |
89 IDBRequest* count(ScriptState*, const ScriptValue& range, ExceptionState&); | 84 IDBRequest* count(ScriptState*, const ScriptValue& range, ExceptionState&); |
90 | 85 |
91 // Used by IDBCursor::update(): | 86 // Used by IDBCursor::update(): |
92 IDBRequest* put(ScriptState*, WebIDBPutMode, IDBAny* source, const ScriptVal
ue&, IDBKey*, ExceptionState&); | 87 IDBRequest* put(ScriptState*, indexed_db::mojom::blink::PutMode, IDBAny* sou
rce, const ScriptValue&, IDBKey*, ExceptionState&); |
93 | 88 |
94 // Used internally and by InspectorIndexedDBAgent: | 89 // Used internally and by InspectorIndexedDBAgent: |
95 IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection, We
bIDBTaskType = WebIDBTaskTypeNormal); | 90 IDBRequest* openCursor(ScriptState*, IDBKeyRange*, indexed_db::mojom::blink:
:CursorDirection, indexed_db::mojom::blink::TaskType = indexed_db::mojom::blink:
:TaskType::Normal); |
96 | 91 |
97 void markDeleted() { m_deleted = true; } | 92 void markDeleted() { m_deleted = true; } |
98 bool isDeleted() const { return m_deleted; } | 93 bool isDeleted() const { return m_deleted; } |
99 void abort(); | 94 void abort(); |
100 void transactionFinished(); | 95 void transactionFinished(); |
101 | 96 |
102 const IDBObjectStoreMetadata& metadata() const { return m_metadata; } | 97 const IDBObjectStoreMetadata& metadata() const { return m_metadata; } |
103 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } | 98 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } |
104 | 99 |
105 typedef HeapVector<Member<IDBKey>> IndexKeys; | 100 typedef HeapVector<Member<IDBKey>> IndexKeys; |
106 | 101 |
107 WebIDBDatabase* backendDB() const; | 102 IDBDatabaseProxy* backendDB() const; |
108 | 103 |
109 private: | 104 private: |
110 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); | 105 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); |
111 | 106 |
112 IDBIndex* createIndex(ScriptState*, const String& name, const IDBKeyPath&, c
onst IDBIndexParameters&, ExceptionState&); | 107 IDBRequest* put(ScriptState*, indexed_db::mojom::blink::PutMode, IDBAny* sou
rce, const ScriptValue&, const ScriptValue& key, ExceptionState&); |
113 IDBRequest* put(ScriptState*, WebIDBPutMode, IDBAny* source, const ScriptVal
ue&, const ScriptValue& key, ExceptionState&); | |
114 | 108 |
115 int64_t findIndexId(const String& name) const; | 109 int64_t findIndexId(const String& name) const; |
116 bool containsIndex(const String& name) const | 110 bool containsIndex(const String& name) const |
117 { | 111 { |
118 return findIndexId(name) != IDBIndexMetadata::InvalidId; | 112 return findIndexId(name) != IDBIndexMetadata::InvalidId; |
119 } | 113 } |
120 | 114 |
121 IDBObjectStoreMetadata m_metadata; | 115 IDBObjectStoreMetadata m_metadata; |
122 Member<IDBTransaction> m_transaction; | 116 Member<IDBTransaction> m_transaction; |
123 bool m_deleted = false; | 117 bool m_deleted = false; |
124 | 118 |
125 typedef HeapHashMap<String, Member<IDBIndex>> IDBIndexMap; | 119 typedef HeapHashMap<String, Member<IDBIndex>> IDBIndexMap; |
126 IDBIndexMap m_indexMap; | 120 IDBIndexMap m_indexMap; |
127 | 121 |
128 // Used to mark indexes created in an aborted upgrade transaction as | 122 // Used to mark indexes created in an aborted upgrade transaction as |
129 // deleted. | 123 // deleted. |
130 HeapHashSet<Member<IDBIndex>> m_createdIndexes; | 124 HeapHashSet<Member<IDBIndex>> m_createdIndexes; |
131 }; | 125 }; |
132 | 126 |
133 } // namespace blink | 127 } // namespace blink |
134 | 128 |
135 #endif // IDBObjectStore_h | 129 #endif // IDBObjectStore_h |
OLD | NEW |