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