| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // Implement the IDBObjectStore IDL | 57 // Implement the IDBObjectStore IDL |
| 58 int64_t id() const { return m_metadata.id; } | 58 int64_t id() const { return m_metadata.id; } |
| 59 const String name() const { return m_metadata.name; } | 59 const String name() const { return m_metadata.name; } |
| 60 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key
Path); } | 60 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key
Path); } |
| 61 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } | 61 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } |
| 62 PassRefPtr<DOMStringList> indexNames() const; | 62 PassRefPtr<DOMStringList> indexNames() const; |
| 63 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } | 63 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } |
| 64 bool autoIncrement() const { return m_metadata.autoIncrement; } | 64 bool autoIncrement() const { return m_metadata.autoIncrement; } |
| 65 | 65 |
| 66 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKeyRange> range, const String& direction, ExceptionCode& ec) { return openC
ursor(context, range, direction, IDBDatabaseBackendInterface::NormalTask, ec); } | 66 IDBRequest* openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRan
ge> range, const String& direction, ExceptionCode& ec) { return openCursor(conte
xt, range, direction, IDBDatabaseBackendInterface::NormalTask, ec); } |
| 67 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue
& key, const String& direction, ExceptionCode&); | 67 IDBRequest* openCursor(ScriptExecutionContext*, const ScriptValue& key, cons
t String& direction, ExceptionCode&); |
| 68 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key,
ExceptionCode&); | 68 IDBRequest* get(ScriptExecutionContext*, const ScriptValue& key, ExceptionCo
de&); |
| 69 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>,
ExceptionCode&); | 69 IDBRequest* get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionC
ode&); |
| 70 PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, const ScriptValue& ke
y, ExceptionCode&); | 70 IDBRequest* add(ScriptState*, ScriptValue&, const ScriptValue& key, Exceptio
nCode&); |
| 71 PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, const ScriptValue& ke
y, ExceptionCode&); | 71 IDBRequest* put(ScriptState*, ScriptValue&, const ScriptValue& key, Exceptio
nCode&); |
| 72 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID
BKeyRange>, ExceptionCode&); | 72 IDBRequest* deleteFunction(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>,
ExceptionCode&); |
| 73 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, const ScriptV
alue& key, ExceptionCode&); | 73 IDBRequest* deleteFunction(ScriptExecutionContext*, const ScriptValue& key,
ExceptionCode&); |
| 74 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&); | 74 IDBRequest* clear(ScriptExecutionContext*, ExceptionCode&); |
| 75 | 75 |
| 76 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, const String& keyPath, const Dictionary& options, ExceptionCode& ec) {
return createIndex(context, name, IDBKeyPath(keyPath), options, ec); } | 76 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, const String& keyPath, const Dictionary& options, ExceptionCode& ec) {
return createIndex(context, name, IDBKeyPath(keyPath), options, ec); } |
| 77 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionCod
e& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); } | 77 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, const Vector<String>& keyPath, const Dictionary& options, ExceptionCod
e& ec) { return createIndex(context, name, IDBKeyPath(keyPath), options, ec); } |
| 78 PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&); | 78 PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&); |
| 79 void deleteIndex(const String& name, ExceptionCode&); | 79 void deleteIndex(const String& name, ExceptionCode&); |
| 80 | 80 |
| 81 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange
>, ExceptionCode&); | 81 IDBRequest* count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, Exceptio
nCode&); |
| 82 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& key
, ExceptionCode&); | 82 IDBRequest* count(ScriptExecutionContext*, const ScriptValue& key, Exception
Code&); |
| 83 | 83 |
| 84 // Used by IDBCursor::update(): | 84 // Used by IDBCursor::update(): |
| 85 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr<
IDBAny> source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&); | 85 IDBRequest* put(IDBDatabaseBackendInterface::PutMode, PassRefPtr<IDBAny> sou
rce, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&); |
| 86 | 86 |
| 87 void markDeleted() { m_deleted = true; } | 87 void markDeleted() { m_deleted = true; } |
| 88 bool isDeleted() const { return m_deleted; } | 88 bool isDeleted() const { return m_deleted; } |
| 89 void transactionFinished(); | 89 void transactionFinished(); |
| 90 | 90 |
| 91 IDBObjectStoreMetadata metadata() const { return m_metadata; } | 91 IDBObjectStoreMetadata metadata() const { return m_metadata; } |
| 92 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } | 92 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } |
| 93 | 93 |
| 94 typedef Vector<RefPtr<IDBKey> > IndexKeys; | 94 typedef Vector<RefPtr<IDBKey> > IndexKeys; |
| 95 typedef HashMap<String, IndexKeys> IndexKeyMap; | 95 typedef HashMap<String, IndexKeys> IndexKeyMap; |
| 96 | 96 |
| 97 IDBDatabaseBackendInterface* backendDB() const; | 97 IDBDatabaseBackendInterface* backendDB() const; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); | 100 IDBObjectStore(const IDBObjectStoreMetadata&, IDBTransaction*); |
| 101 | 101 |
| 102 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, const String& direction, IDBDatabaseBackendInterface::TaskType, Exceptio
nCode&); | 102 IDBRequest* openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, con
st String& direction, IDBDatabaseBackendInterface::TaskType, ExceptionCode&); |
| 103 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, const IDBKeyPath&, const Dictionary&, ExceptionCode&); | 103 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, const IDBKeyPath&, const Dictionary&, ExceptionCode&); |
| 104 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCode&); | 104 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCode&); |
| 105 PassRefPtr<IDBRequest> put(IDBDatabaseBackendInterface::PutMode, PassRefPtr<
IDBAny> source, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionCod
e&); | 105 IDBRequest* put(IDBDatabaseBackendInterface::PutMode, PassRefPtr<IDBAny> sou
rce, ScriptState*, ScriptValue&, const ScriptValue& key, ExceptionCode&); |
| 106 | 106 |
| 107 int64_t findIndexId(const String& name) const; | 107 int64_t findIndexId(const String& name) const; |
| 108 bool containsIndex(const String& name) const | 108 bool containsIndex(const String& name) const |
| 109 { | 109 { |
| 110 return findIndexId(name) != IDBIndexMetadata::InvalidId; | 110 return findIndexId(name) != IDBIndexMetadata::InvalidId; |
| 111 } | 111 } |
| 112 | 112 |
| 113 IDBObjectStoreMetadata m_metadata; | 113 IDBObjectStoreMetadata m_metadata; |
| 114 RefPtr<IDBTransaction> m_transaction; | 114 RefPtr<IDBTransaction> m_transaction; |
| 115 bool m_deleted; | 115 bool m_deleted; |
| 116 | 116 |
| 117 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; | 117 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; |
| 118 IDBIndexMap m_indexMap; | 118 IDBIndexMap m_indexMap; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace WebCore | 121 } // namespace WebCore |
| 122 | 122 |
| 123 #endif // IDBObjectStore_h | 123 #endif // IDBObjectStore_h |
| OLD | NEW |