| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void trace(Visitor*); | 59 void trace(Visitor*); |
| 60 | 60 |
| 61 // Implement the IDBObjectStore IDL | 61 // Implement the IDBObjectStore IDL |
| 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 PassRefPtrWillBeRawPtr<IDBRequest> openCursor(ExecutionContext*, const Scrip
tValue& range, const String& direction, ExceptionState&); | 69 PassRefPtrWillBeRawPtr<IDBRequest> openCursor(ScriptState*, const ScriptValu
e& range, const String& direction, ExceptionState&); |
| 70 PassRefPtrWillBeRawPtr<IDBRequest> openKeyCursor(ExecutionContext*, const Sc
riptValue& range, const String& direction, ExceptionState&); | 70 PassRefPtrWillBeRawPtr<IDBRequest> openKeyCursor(ScriptState*, const ScriptV
alue& range, const String& direction, ExceptionState&); |
| 71 PassRefPtrWillBeRawPtr<IDBRequest> get(ExecutionContext*, const ScriptValue&
key, ExceptionState&); | 71 PassRefPtrWillBeRawPtr<IDBRequest> get(ScriptState*, const ScriptValue& key,
ExceptionState&); |
| 72 PassRefPtrWillBeRawPtr<IDBRequest> add(ExecutionContext*, ScriptValue&, cons
t ScriptValue& key, ExceptionState&); | 72 PassRefPtrWillBeRawPtr<IDBRequest> add(ScriptState*, ScriptValue&, const Scr
iptValue& key, ExceptionState&); |
| 73 PassRefPtrWillBeRawPtr<IDBRequest> put(ExecutionContext*, ScriptValue&, cons
t ScriptValue& key, ExceptionState&); | 73 PassRefPtrWillBeRawPtr<IDBRequest> put(ScriptState*, ScriptValue&, const Scr
iptValue& key, ExceptionState&); |
| 74 PassRefPtrWillBeRawPtr<IDBRequest> deleteFunction(ExecutionContext*, const S
criptValue& key, ExceptionState&); | 74 PassRefPtrWillBeRawPtr<IDBRequest> deleteFunction(ScriptState*, const Script
Value& key, ExceptionState&); |
| 75 PassRefPtrWillBeRawPtr<IDBRequest> clear(ExecutionContext*, ExceptionState&)
; | 75 PassRefPtrWillBeRawPtr<IDBRequest> clear(ScriptState*, ExceptionState&); |
| 76 | 76 |
| 77 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState* scriptState, const
String& name, const String& keyPath, const Dictionary& options, ExceptionState&
exceptionState) | 77 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState* scriptState, const
String& name, const String& 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 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState* scriptState, const
String& name, const Vector<String>& keyPath, const Dictionary& options, Excepti
onState& exceptionState) | 81 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState* scriptState, const
String& name, const Vector<String>& keyPath, const Dictionary& options, Excepti
onState& 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 PassRefPtrWillBeRawPtr<IDBIndex> index(const String& name, ExceptionState&); | 85 PassRefPtrWillBeRawPtr<IDBIndex> index(const String& name, ExceptionState&); |
| 86 void deleteIndex(const String& name, ExceptionState&); | 86 void deleteIndex(const String& name, ExceptionState&); |
| 87 | 87 |
| 88 PassRefPtrWillBeRawPtr<IDBRequest> count(ExecutionContext*, const ScriptValu
e& range, ExceptionState&); | 88 PassRefPtrWillBeRawPtr<IDBRequest> count(ScriptState*, const ScriptValue& ra
nge, ExceptionState&); |
| 89 | 89 |
| 90 // Used by IDBCursor::update(): | 90 // Used by IDBCursor::update(): |
| 91 PassRefPtrWillBeRawPtr<IDBRequest> put(ExecutionContext*, blink::WebIDBDatab
ase::PutMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue&, PassRefPtrWil
lBeRawPtr<IDBKey>, ExceptionState&); | 91 PassRefPtrWillBeRawPtr<IDBRequest> put(ScriptState*, blink::WebIDBDatabase::
PutMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue&, PassRefPtrWillBeRa
wPtr<IDBKey>, ExceptionState&); |
| 92 | 92 |
| 93 // Used internally and by InspectorIndexedDBAgent: | 93 // Used internally and by InspectorIndexedDBAgent: |
| 94 PassRefPtrWillBeRawPtr<IDBRequest> openCursor(ExecutionContext*, PassRefPtrW
illBeRawPtr<IDBKeyRange>, blink::WebIDBCursor::Direction, blink::WebIDBDatabase:
:TaskType = blink::WebIDBDatabase::NormalTask); | 94 PassRefPtrWillBeRawPtr<IDBRequest> openCursor(ScriptState*, PassRefPtrWillBe
RawPtr<IDBKeyRange>, blink::WebIDBCursor::Direction, blink::WebIDBDatabase::Task
Type = blink::WebIDBDatabase::NormalTask); |
| 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 WillBeHeapVector<RefPtrWillBeMember<IDBKey> > IndexKeys; | 103 typedef WillBeHeapVector<RefPtrWillBeMember<IDBKey> > IndexKeys; |
| 104 | 104 |
| 105 blink::WebIDBDatabase* backendDB() const; | 105 blink::WebIDBDatabase* backendDB() const; |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); | 108 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); |
| 109 | 109 |
| 110 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState*, const String& nam
e, const IDBKeyPath&, const Dictionary&, ExceptionState&); | 110 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState*, const String& nam
e, const IDBKeyPath&, const Dictionary&, ExceptionState&); |
| 111 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState*, const String& nam
e, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionState&); | 111 PassRefPtrWillBeRawPtr<IDBIndex> createIndex(ScriptState*, const String& nam
e, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionState&); |
| 112 PassRefPtrWillBeRawPtr<IDBRequest> put(ExecutionContext*, blink::WebIDBDatab
ase::PutMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue&, const ScriptV
alue& key, ExceptionState&); | 112 PassRefPtrWillBeRawPtr<IDBRequest> put(ScriptState*, blink::WebIDBDatabase::
PutMode, PassRefPtrWillBeRawPtr<IDBAny> source, ScriptValue&, 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 RefPtrWillBeMember<IDBTransaction> m_transaction; | 121 RefPtrWillBeMember<IDBTransaction> m_transaction; |
| 122 bool m_deleted; | 122 bool m_deleted; |
| 123 | 123 |
| 124 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<IDBIndex> > IDBIndexMap
; | 124 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<IDBIndex> > IDBIndexMap
; |
| 125 IDBIndexMap m_indexMap; | 125 IDBIndexMap m_indexMap; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace WebCore | 128 } // namespace WebCore |
| 129 | 129 |
| 130 #endif // IDBObjectStore_h | 130 #endif // IDBObjectStore_h |
| OLD | NEW |