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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 int64_t id() const { return m_metadata.id; } | 62 int64_t id() const { return m_metadata.id; } |
63 const String& name() const { return m_metadata.name; } | 63 const String& name() const { return m_metadata.name; } |
64 ScriptValue keyPath(ScriptState*) const; | 64 ScriptValue keyPath(ScriptState*) const; |
65 PassRefPtrWillBeRawPtr<DOMStringList> indexNames() const; | 65 PassRefPtrWillBeRawPtr<DOMStringList> indexNames() const; |
66 IDBTransaction* transaction() const { return m_transaction.get(); } | 66 IDBTransaction* transaction() const { return m_transaction.get(); } |
67 bool autoIncrement() const { return m_metadata.autoIncrement; } | 67 bool autoIncrement() const { return m_metadata.autoIncrement; } |
68 | 68 |
69 IDBRequest* openCursor(ScriptState*, const ScriptValue& range, const String&
direction, ExceptionState&); | 69 IDBRequest* openCursor(ScriptState*, const ScriptValue& range, const String&
direction, ExceptionState&); |
70 IDBRequest* openKeyCursor(ScriptState*, const ScriptValue& range, const Stri
ng& direction, ExceptionState&); | 70 IDBRequest* openKeyCursor(ScriptState*, const ScriptValue& range, const Stri
ng& direction, ExceptionState&); |
71 IDBRequest* get(ScriptState*, const ScriptValue& key, ExceptionState&); | 71 IDBRequest* get(ScriptState*, const ScriptValue& key, ExceptionState&); |
72 IDBRequest* add(ScriptState*, ScriptValue&, const ScriptValue& key, Exceptio
nState&); | 72 IDBRequest* add(ScriptState*, const ScriptValue&, const ScriptValue& key, Ex
ceptionState&); |
73 IDBRequest* put(ScriptState*, ScriptValue&, const ScriptValue& key, Exceptio
nState&); | 73 IDBRequest* put(ScriptState*, const ScriptValue&, const ScriptValue& key, Ex
ceptionState&); |
74 IDBRequest* deleteFunction(ScriptState*, const ScriptValue& key, ExceptionSt
ate&); | 74 IDBRequest* deleteFunction(ScriptState*, const ScriptValue& key, ExceptionSt
ate&); |
75 IDBRequest* clear(ScriptState*, ExceptionState&); | 75 IDBRequest* clear(ScriptState*, ExceptionState&); |
76 | 76 |
77 IDBIndex* createIndex(ScriptState* scriptState, const String& name, const St
ring& keyPath, const Dictionary& options, ExceptionState& exceptionState) | 77 IDBIndex* createIndex(ScriptState* scriptState, const String& name, const St
ring& keyPath, const Dictionary& options, ExceptionState& exceptionState) |
78 { | 78 { |
79 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce
ptionState); | 79 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce
ptionState); |
80 } | 80 } |
81 IDBIndex* createIndex(ScriptState* scriptState, const String& name, const Ve
ctor<String>& keyPath, const Dictionary& options, ExceptionState& exceptionState
) | 81 IDBIndex* createIndex(ScriptState* scriptState, const String& name, const Ve
ctor<String>& keyPath, const Dictionary& options, ExceptionState& exceptionState
) |
82 { | 82 { |
83 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce
ptionState); | 83 return createIndex(scriptState, name, IDBKeyPath(keyPath), options, exce
ptionState); |
84 } | 84 } |
85 IDBIndex* index(const String& name, ExceptionState&); | 85 IDBIndex* index(const String& name, ExceptionState&); |
86 void deleteIndex(const String& name, ExceptionState&); | 86 void deleteIndex(const String& name, ExceptionState&); |
87 | 87 |
88 IDBRequest* count(ScriptState*, const ScriptValue& range, ExceptionState&); | 88 IDBRequest* count(ScriptState*, const ScriptValue& range, ExceptionState&); |
89 | 89 |
90 // Used by IDBCursor::update(): | 90 // Used by IDBCursor::update(): |
91 IDBRequest* put(ScriptState*, WebIDBPutMode, IDBAny* source, ScriptValue&, I
DBKey*, ExceptionState&); | 91 IDBRequest* put(ScriptState*, WebIDBPutMode, IDBAny* source, const ScriptVal
ue&, IDBKey*, ExceptionState&); |
92 | 92 |
93 // Used internally and by InspectorIndexedDBAgent: | 93 // Used internally and by InspectorIndexedDBAgent: |
94 IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection, We
bIDBTaskType = WebIDBTaskTypeNormal); | 94 IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection, We
bIDBTaskType = WebIDBTaskTypeNormal); |
95 | 95 |
96 void markDeleted() { m_deleted = true; } | 96 void markDeleted() { m_deleted = true; } |
97 bool isDeleted() const { return m_deleted; } | 97 bool isDeleted() const { return m_deleted; } |
98 void transactionFinished(); | 98 void transactionFinished(); |
99 | 99 |
100 const IDBObjectStoreMetadata& metadata() const { return m_metadata; } | 100 const IDBObjectStoreMetadata& metadata() const { return m_metadata; } |
101 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } | 101 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } |
102 | 102 |
103 typedef HeapVector<Member<IDBKey> > IndexKeys; | 103 typedef HeapVector<Member<IDBKey> > IndexKeys; |
104 | 104 |
105 WebIDBDatabase* backendDB() const; | 105 WebIDBDatabase* backendDB() const; |
106 | 106 |
107 private: | 107 private: |
108 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); | 108 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); |
109 | 109 |
110 IDBIndex* createIndex(ScriptState*, const String& name, const IDBKeyPath&, c
onst Dictionary&, ExceptionState&); | 110 IDBIndex* createIndex(ScriptState*, const String& name, const IDBKeyPath&, c
onst Dictionary&, ExceptionState&); |
111 IDBIndex* createIndex(ScriptState*, const String& name, const IDBKeyPath&, b
ool unique, bool multiEntry, ExceptionState&); | 111 IDBIndex* createIndex(ScriptState*, const String& name, const IDBKeyPath&, b
ool unique, bool multiEntry, ExceptionState&); |
112 IDBRequest* put(ScriptState*, WebIDBPutMode, IDBAny* source, ScriptValue&, c
onst ScriptValue& key, ExceptionState&); | 112 IDBRequest* put(ScriptState*, WebIDBPutMode, IDBAny* source, const ScriptVal
ue&, const ScriptValue& key, ExceptionState&); |
113 | 113 |
114 int64_t findIndexId(const String& name) const; | 114 int64_t findIndexId(const String& name) const; |
115 bool containsIndex(const String& name) const | 115 bool containsIndex(const String& name) const |
116 { | 116 { |
117 return findIndexId(name) != IDBIndexMetadata::InvalidId; | 117 return findIndexId(name) != IDBIndexMetadata::InvalidId; |
118 } | 118 } |
119 | 119 |
120 IDBObjectStoreMetadata m_metadata; | 120 IDBObjectStoreMetadata m_metadata; |
121 Member<IDBTransaction> m_transaction; | 121 Member<IDBTransaction> m_transaction; |
122 bool m_deleted; | 122 bool m_deleted; |
123 | 123 |
124 typedef HeapHashMap<String, Member<IDBIndex> > IDBIndexMap; | 124 typedef HeapHashMap<String, Member<IDBIndex> > IDBIndexMap; |
125 IDBIndexMap m_indexMap; | 125 IDBIndexMap m_indexMap; |
126 }; | 126 }; |
127 | 127 |
128 } // namespace blink | 128 } // namespace blink |
129 | 129 |
130 #endif // IDBObjectStore_h | 130 #endif // IDBObjectStore_h |
OLD | NEW |