| 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 21 matching lines...) Expand all Loading... |
| 32 #include "modules/indexeddb/IDBKeyPath.h" | 32 #include "modules/indexeddb/IDBKeyPath.h" |
| 33 #include "modules/indexeddb/IDBKeyRange.h" | 33 #include "modules/indexeddb/IDBKeyRange.h" |
| 34 #include "modules/indexeddb/IDBMetadata.h" | 34 #include "modules/indexeddb/IDBMetadata.h" |
| 35 #include "modules/indexeddb/IDBObjectStore.h" | 35 #include "modules/indexeddb/IDBObjectStore.h" |
| 36 #include "modules/indexeddb/IDBRequest.h" | 36 #include "modules/indexeddb/IDBRequest.h" |
| 37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 38 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 class ExceptionState; |
| 42 class IDBObjectStore; | 43 class IDBObjectStore; |
| 43 | 44 |
| 44 class IDBIndex : public ScriptWrappable, public RefCounted<IDBIndex> { | 45 class IDBIndex : public ScriptWrappable, public RefCounted<IDBIndex> { |
| 45 public: | 46 public: |
| 46 static PassRefPtr<IDBIndex> create(const IDBIndexMetadata& metadata, IDBObje
ctStore* objectStore, IDBTransaction* transaction) | 47 static PassRefPtr<IDBIndex> create(const IDBIndexMetadata& metadata, IDBObje
ctStore* objectStore, IDBTransaction* transaction) |
| 47 { | 48 { |
| 48 return adoptRef(new IDBIndex(metadata, objectStore, transaction)); | 49 return adoptRef(new IDBIndex(metadata, objectStore, transaction)); |
| 49 } | 50 } |
| 50 ~IDBIndex(); | 51 ~IDBIndex(); |
| 51 | 52 |
| 52 // Implement the IDL | 53 // Implement the IDL |
| 53 const String name() const { return m_metadata.name; } | 54 const String name() const { return m_metadata.name; } |
| 54 PassRefPtr<IDBObjectStore> objectStore() const { return m_objectStore; } | 55 PassRefPtr<IDBObjectStore> objectStore() const { return m_objectStore; } |
| 55 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key
Path); } | 56 PassRefPtr<IDBAny> keyPathAny() const { return IDBAny::create(m_metadata.key
Path); } |
| 56 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } | 57 const IDBKeyPath keyPath() const { return m_metadata.keyPath; } |
| 57 bool unique() const { return m_metadata.unique; } | 58 bool unique() const { return m_metadata.unique; } |
| 58 bool multiEntry() const { return m_metadata.multiEntry; } | 59 bool multiEntry() const { return m_metadata.multiEntry; } |
| 59 int64_t id() const { return m_metadata.id; } | 60 int64_t id() const { return m_metadata.id; } |
| 60 | 61 |
| 61 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, const String& direction, ExceptionCode&); | 62 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKey
Range>, const String& direction, ExceptionState&); |
| 62 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue
& key, const String& direction, ExceptionCode&); | 63 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const ScriptValue
& key, const String& direction, ExceptionState&); |
| 63 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange
>, ExceptionCode&); | 64 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange
>, ExceptionState&); |
| 64 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& key
, ExceptionCode&); | 65 PassRefPtr<IDBRequest> count(ScriptExecutionContext*, const ScriptValue& key
, ExceptionState&); |
| 65 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDB
KeyRange>, const String& direction, ExceptionCode&); | 66 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDB
KeyRange>, const String& direction, ExceptionState&); |
| 66 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, const ScriptVa
lue& key, const String& direction, ExceptionCode&); | 67 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, const ScriptVa
lue& key, const String& direction, ExceptionState&); |
| 67 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>,
ExceptionCode&); | 68 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>,
ExceptionState&); |
| 68 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key,
ExceptionCode&); | 69 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, const ScriptValue& key,
ExceptionState&); |
| 69 PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKeyRang
e>, ExceptionCode&); | 70 PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKeyRang
e>, ExceptionState&); |
| 70 PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, const ScriptValue& ke
y, ExceptionCode&); | 71 PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, const ScriptValue& ke
y, ExceptionState&); |
| 71 | 72 |
| 72 void markDeleted() { m_deleted = true; } | 73 void markDeleted() { m_deleted = true; } |
| 73 bool isDeleted() const; | 74 bool isDeleted() const; |
| 74 | 75 |
| 75 IDBDatabaseBackendInterface* backendDB() const; | 76 IDBDatabaseBackendInterface* backendDB() const; |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 IDBIndex(const IDBIndexMetadata&, IDBObjectStore*, IDBTransaction*); | 79 IDBIndex(const IDBIndexMetadata&, IDBObjectStore*, IDBTransaction*); |
| 79 | 80 |
| 80 IDBIndexMetadata m_metadata; | 81 IDBIndexMetadata m_metadata; |
| 81 RefPtr<IDBObjectStore> m_objectStore; | 82 RefPtr<IDBObjectStore> m_objectStore; |
| 82 RefPtr<IDBTransaction> m_transaction; | 83 RefPtr<IDBTransaction> m_transaction; |
| 83 bool m_deleted; | 84 bool m_deleted; |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // namespace WebCore | 87 } // namespace WebCore |
| 87 | 88 |
| 88 #endif // IDBIndex_h | 89 #endif // IDBIndex_h |
| OLD | NEW |