| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 ~IDBObjectStore() { } | 57 ~IDBObjectStore() { } |
| 58 | 58 |
| 59 // Implement the IDBObjectStore IDL | 59 // Implement the IDBObjectStore IDL |
| 60 const String name() const { return m_metadata.name; } | 60 const String name() const { return m_metadata.name; } |
| 61 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key
Path); } | 61 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key
Path); } |
| 62 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } | 62 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } |
| 63 PassRefPtr<DOMStringList> indexNames() const; | 63 PassRefPtr<DOMStringList> indexNames() const; |
| 64 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } | 64 PassRefPtr<IDBTransaction> transaction() const { return m_transaction; } |
| 65 bool autoIncrement() const { return m_metadata.autoIncrement; } | 65 bool autoIncrement() const { return m_metadata.autoIncrement; } |
| 66 | 66 |
| 67 PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, ScriptValue& val
ue, ExceptionCode& ec) { return add(context, value, 0, ec); } | 67 PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, PassRefPtr<Seria
lizedScriptValue> value, ExceptionCode& ec) { return add(context, value, 0, ec);
} |
| 68 PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, ScriptValue& val
ue, ExceptionCode& ec) { return put(context, value, 0, ec); } | 68 PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, PassRefPtr<Seria
lizedScriptValue> value, ExceptionCode& ec) { return put(context, value, 0, ec);
} |
| 69 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, Exception
Code& ec) { return openCursor(context, static_cast<IDBKeyRange*>(0), ec); } | 69 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, Exception
Code& ec) { return openCursor(context, static_cast<IDBKeyRange*>(0), ec); } |
| 70 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRang
e, IDBCursor::directionNext(), ec); } | 70 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRang
e, IDBCursor::directionNext(), ec); } |
| 71 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKey> key, ExceptionCode& ec) { return openCursor(context, key, IDBCursor::d
irectionNext(), ec); } | 71 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKey> key, ExceptionCode& ec) { return openCursor(context, key, IDBCursor::d
irectionNext(), ec); } |
| 72 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKeyRange> range, const String& direction, ExceptionCode& ec) { return openC
ursor(context, range, direction, IDBTransactionBackendInterface::NormalTask, ec)
; } | 72 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPt
r<IDBKeyRange> range, const String& direction, ExceptionCode& ec) { return openC
ursor(context, range, direction, IDBTransactionBackendInterface::NormalTask, ec)
; } |
| 73 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, const String& direction, IDBTransactionBackendInterface::TaskType, Excep
tionCode&); | 73 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, const String& direction, IDBTransactionBackendInterface::TaskType, Excep
tionCode&); |
| 74 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
>, const String& direction, ExceptionCode&); | 74 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
>, const String& direction, ExceptionCode&); |
| 75 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, unsigned short direction, ExceptionCode&); | 75 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, unsigned short direction, ExceptionCode&); |
| 76 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
>, unsigned short direction, ExceptionCode&); | 76 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
>, unsigned short direction, ExceptionCode&); |
| 77 | 77 |
| 78 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, Exce
ptionCode&); | 78 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, Exce
ptionCode&); |
| 79 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>,
ExceptionCode&); | 79 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>,
ExceptionCode&); |
| 80 PassRefPtr<IDBRequest> add(ScriptExecutionContext*, ScriptValue&, PassRefPtr
<IDBKey>, ExceptionCode&); | 80 PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScr
iptValue>, PassRefPtr<IDBKey>, ExceptionCode&); |
| 81 PassRefPtr<IDBRequest> put(ScriptExecutionContext*, ScriptValue&, PassRefPtr
<IDBKey>, ExceptionCode&); | 81 PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScr
iptValue>, PassRefPtr<IDBKey>, ExceptionCode&); |
| 82 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID
BKeyRange>, ExceptionCode&); | 82 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID
BKeyRange>, ExceptionCode&); |
| 83 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID
BKey> key, ExceptionCode&); | 83 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<ID
BKey> key, ExceptionCode&); |
| 84 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&); | 84 PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&); |
| 85 | 85 |
| 86 // FIXME: Try to modify the code generator so this duplication is unneeded. | 86 // FIXME: Try to modify the code generator so this duplication is unneeded. |
| 87 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, const String& keyPath, const Dictionary&, ExceptionCode&); | 87 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, const String& keyPath, const Dictionary&, ExceptionCode&); |
| 88 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, const String& keyPath, ExceptionCode& ec) { return createIndex(context
, name, keyPath, Dictionary(), ec); } | 88 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, const String& keyPath, ExceptionCode& ec) { return createIndex(context
, name, keyPath, Dictionary(), ec); } |
| 89 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, PassRefPtr<DOMStringList> keyPath, const Dictionary&, ExceptionCode&); | 89 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String& name
, PassRefPtr<DOMStringList> keyPath, const Dictionary&, ExceptionCode&); |
| 90 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, PassRefPtr<DOMStringList> keyPath, ExceptionCode& ec) { return createI
ndex(context, name, keyPath, Dictionary(), ec); } | 90 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext* context, const Stri
ng& name, PassRefPtr<DOMStringList> keyPath, ExceptionCode& ec) { return createI
ndex(context, name, keyPath, Dictionary(), ec); } |
| 91 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String&, con
st IDBKeyPath&, const Dictionary&, ExceptionCode&); | 91 PassRefPtr<IDBIndex> createIndex(ScriptExecutionContext*, const String&, con
st IDBKeyPath&, const Dictionary&, ExceptionCode&); |
| 92 | 92 |
| 93 PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&); | 93 PassRefPtr<IDBIndex> index(const String& name, ExceptionCode&); |
| 94 void deleteIndex(const String& name, ExceptionCode&); | 94 void deleteIndex(const String& name, ExceptionCode&); |
| 95 | 95 |
| 96 PassRefPtr<IDBRequest> count(ScriptExecutionContext* context, ExceptionCode&
ec) { return count(context, static_cast<IDBKeyRange*>(0), ec); } | 96 PassRefPtr<IDBRequest> count(ScriptExecutionContext* context, ExceptionCode&
ec) { return count(context, static_cast<IDBKeyRange*>(0), ec); } |
| 97 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange
>, ExceptionCode&); | 97 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange
>, ExceptionCode&); |
| 98 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKey>, Ex
ceptionCode&); | 98 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKey>, Ex
ceptionCode&); |
| 99 | 99 |
| 100 PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefP
tr<IDBAny> source, ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, Ex
ceptionCode&); | 100 PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefP
tr<IDBAny> source, ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, P
assRefPtr<IDBKey>, ExceptionCode&); |
| 101 void markDeleted() { m_deleted = true; } | 101 void markDeleted() { m_deleted = true; } |
| 102 void transactionFinished(); | 102 void transactionFinished(); |
| 103 | 103 |
| 104 IDBObjectStoreMetadata metadata() const { return m_metadata; } | 104 IDBObjectStoreMetadata metadata() const { return m_metadata; } |
| 105 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } | 105 void setMetadata(const IDBObjectStoreMetadata& metadata) { m_metadata = meta
data; } |
| 106 | 106 |
| 107 typedef Vector<RefPtr<IDBKey> > IndexKeys; | 107 typedef Vector<RefPtr<IDBKey> > IndexKeys; |
| 108 typedef HashMap<String, IndexKeys> IndexKeyMap; | 108 typedef HashMap<String, IndexKeys> IndexKeyMap; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 IDBObjectStore(const IDBObjectStoreMetadata&, PassRefPtr<IDBObjectStoreBacke
ndInterface>, IDBTransaction*); | 111 IDBObjectStore(const IDBObjectStoreMetadata&, PassRefPtr<IDBObjectStoreBacke
ndInterface>, IDBTransaction*); |
| 112 | 112 |
| 113 IDBObjectStoreMetadata m_metadata; | 113 IDBObjectStoreMetadata m_metadata; |
| 114 RefPtr<IDBObjectStoreBackendInterface> m_backend; | 114 RefPtr<IDBObjectStoreBackendInterface> m_backend; |
| 115 RefPtr<IDBTransaction> m_transaction; | 115 RefPtr<IDBTransaction> m_transaction; |
| 116 bool m_deleted; | 116 bool m_deleted; |
| 117 | 117 |
| 118 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; | 118 typedef HashMap<String, RefPtr<IDBIndex> > IDBIndexMap; |
| 119 IDBIndexMap m_indexMap; | 119 IDBIndexMap m_indexMap; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace WebCore | 122 } // namespace WebCore |
| 123 | 123 |
| 124 #endif | 124 #endif |
| 125 | 125 |
| 126 #endif // IDBObjectStore_h | 126 #endif // IDBObjectStore_h |
| OLD | NEW |