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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 public: | 48 public: |
49 static IDBIndex* create(const IDBIndexMetadata& metadata, IDBObjectStore* ob
jectStore, IDBTransaction* transaction) | 49 static IDBIndex* create(const IDBIndexMetadata& metadata, IDBObjectStore* ob
jectStore, IDBTransaction* transaction) |
50 { | 50 { |
51 return new IDBIndex(metadata, objectStore, transaction); | 51 return new IDBIndex(metadata, objectStore, transaction); |
52 } | 52 } |
53 ~IDBIndex(); | 53 ~IDBIndex(); |
54 DECLARE_TRACE(); | 54 DECLARE_TRACE(); |
55 | 55 |
56 // Implement the IDL | 56 // Implement the IDL |
57 const String& name() const { return m_metadata.name; } | 57 const String& name() const { return m_metadata.name; } |
| 58 void setName(const String& name, ExceptionState&); |
58 IDBObjectStore* objectStore() const { return m_objectStore.get(); } | 59 IDBObjectStore* objectStore() const { return m_objectStore.get(); } |
59 ScriptValue keyPath(ScriptState*) const; | 60 ScriptValue keyPath(ScriptState*) const; |
60 bool unique() const { return m_metadata.unique; } | 61 bool unique() const { return m_metadata.unique; } |
61 bool multiEntry() const { return m_metadata.multiEntry; } | 62 bool multiEntry() const { return m_metadata.multiEntry; } |
62 | 63 |
63 IDBRequest* openCursor(ScriptState*, const ScriptValue& key, const String& d
irection, ExceptionState&); | 64 IDBRequest* openCursor(ScriptState*, const ScriptValue& key, const String& d
irection, ExceptionState&); |
64 IDBRequest* openKeyCursor(ScriptState*, const ScriptValue& range, const Stri
ng& direction, ExceptionState&); | 65 IDBRequest* openKeyCursor(ScriptState*, const ScriptValue& range, const Stri
ng& direction, ExceptionState&); |
65 IDBRequest* count(ScriptState*, const ScriptValue& range, ExceptionState&); | 66 IDBRequest* count(ScriptState*, const ScriptValue& range, ExceptionState&); |
66 IDBRequest* get(ScriptState*, const ScriptValue& key, ExceptionState&); | 67 IDBRequest* get(ScriptState*, const ScriptValue& key, ExceptionState&); |
67 IDBRequest* getAll(ScriptState*, const ScriptValue& range, ExceptionState&); | 68 IDBRequest* getAll(ScriptState*, const ScriptValue& range, ExceptionState&); |
68 IDBRequest* getAll(ScriptState*, const ScriptValue& range, unsigned long max
Count, ExceptionState&); | 69 IDBRequest* getAll(ScriptState*, const ScriptValue& range, unsigned long max
Count, ExceptionState&); |
69 IDBRequest* getKey(ScriptState*, const ScriptValue& key, ExceptionState&); | 70 IDBRequest* getKey(ScriptState*, const ScriptValue& key, ExceptionState&); |
70 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, ExceptionStat
e&); | 71 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, ExceptionStat
e&); |
71 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, uint32_t maxC
ount, ExceptionState&); | 72 IDBRequest* getAllKeys(ScriptState*, const ScriptValue& range, uint32_t maxC
ount, ExceptionState&); |
72 | 73 |
73 void markDeleted() { m_deleted = true; } | 74 void markDeleted() { m_deleted = true; } |
74 bool isDeleted() const; | 75 bool isDeleted() const; |
| 76 int64_t id() const { return m_metadata.id; } |
75 | 77 |
76 // Used internally and by InspectorIndexedDBAgent: | 78 // Used internally and by InspectorIndexedDBAgent: |
77 IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection); | 79 IDBRequest* openCursor(ScriptState*, IDBKeyRange*, WebIDBCursorDirection); |
78 | 80 |
79 WebIDBDatabase* backendDB() const; | 81 WebIDBDatabase* backendDB() const; |
80 | 82 |
81 private: | 83 private: |
82 IDBIndex(const IDBIndexMetadata&, IDBObjectStore*, IDBTransaction*); | 84 IDBIndex(const IDBIndexMetadata&, IDBObjectStore*, IDBTransaction*); |
83 | 85 |
84 IDBRequest* getInternal(ScriptState*, const ScriptValue& key, ExceptionState
&, bool keyOnly); | 86 IDBRequest* getInternal(ScriptState*, const ScriptValue& key, ExceptionState
&, bool keyOnly); |
85 IDBRequest* getAllInternal(ScriptState*, const ScriptValue& range, unsigned
long maxCount, ExceptionState&, bool keyOnly); | 87 IDBRequest* getAllInternal(ScriptState*, const ScriptValue& range, unsigned
long maxCount, ExceptionState&, bool keyOnly); |
86 | 88 |
87 IDBIndexMetadata m_metadata; | 89 IDBIndexMetadata m_metadata; |
88 Member<IDBObjectStore> m_objectStore; | 90 Member<IDBObjectStore> m_objectStore; |
89 Member<IDBTransaction> m_transaction; | 91 Member<IDBTransaction> m_transaction; |
90 bool m_deleted = false; | 92 bool m_deleted = false; |
91 }; | 93 }; |
92 | 94 |
93 } // namespace blink | 95 } // namespace blink |
94 | 96 |
95 #endif // IDBIndex_h | 97 #endif // IDBIndex_h |
OLD | NEW |