| 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 20 matching lines...) Expand all Loading... |
| 31 #include "modules/indexeddb/IDBKey.h" | 31 #include "modules/indexeddb/IDBKey.h" |
| 32 #include "modules/indexeddb/IDBTransaction.h" | 32 #include "modules/indexeddb/IDBTransaction.h" |
| 33 #include "modules/indexeddb/IndexedDB.h" | 33 #include "modules/indexeddb/IndexedDB.h" |
| 34 #include "wtf/PassRefPtr.h" | 34 #include "wtf/PassRefPtr.h" |
| 35 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
| 36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 class DOMRequestState; | 40 class DOMRequestState; |
| 41 class ExceptionState; |
| 41 class IDBAny; | 42 class IDBAny; |
| 42 class IDBCallbacks; | 43 class IDBCallbacks; |
| 43 class IDBCursorBackendInterface; | 44 class IDBCursorBackendInterface; |
| 44 class IDBRequest; | 45 class IDBRequest; |
| 45 class ScriptExecutionContext; | 46 class ScriptExecutionContext; |
| 46 | 47 |
| 47 typedef int ExceptionCode; | |
| 48 | |
| 49 class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor> { | 48 class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor> { |
| 50 public: | 49 public: |
| 51 static const AtomicString& directionNext(); | 50 static const AtomicString& directionNext(); |
| 52 static const AtomicString& directionNextUnique(); | 51 static const AtomicString& directionNextUnique(); |
| 53 static const AtomicString& directionPrev(); | 52 static const AtomicString& directionPrev(); |
| 54 static const AtomicString& directionPrevUnique(); | 53 static const AtomicString& directionPrevUnique(); |
| 55 | 54 |
| 56 static IndexedDB::CursorDirection stringToDirection(const String& modeString
, ExceptionCode&); | 55 static IndexedDB::CursorDirection stringToDirection(const String& modeString
, ExceptionState&); |
| 57 static const AtomicString& directionToString(unsigned short mode); | 56 static const AtomicString& directionToString(unsigned short mode); |
| 58 | 57 |
| 59 static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface>, I
ndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); | 58 static PassRefPtr<IDBCursor> create(PassRefPtr<IDBCursorBackendInterface>, I
ndexedDB::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); |
| 60 virtual ~IDBCursor(); | 59 virtual ~IDBCursor(); |
| 61 | 60 |
| 62 // Implement the IDL | 61 // Implement the IDL |
| 63 const String& direction() const; | 62 const String& direction() const; |
| 64 const ScriptValue& key() const; | 63 const ScriptValue& key() const; |
| 65 const ScriptValue& primaryKey() const; | 64 const ScriptValue& primaryKey() const; |
| 66 const ScriptValue& value() const; | 65 const ScriptValue& value() const; |
| 67 IDBAny* source() const; | 66 IDBAny* source() const; |
| 68 | 67 |
| 69 PassRefPtr<IDBRequest> update(ScriptState*, ScriptValue&, ExceptionCode&); | 68 PassRefPtr<IDBRequest> update(ScriptState*, ScriptValue&, ExceptionState&); |
| 70 void advance(unsigned long, ExceptionCode&); | 69 void advance(unsigned long, ExceptionState&); |
| 71 void continueFunction(ScriptExecutionContext*, const ScriptValue& key, Excep
tionCode&); | 70 void continueFunction(ScriptExecutionContext*, const ScriptValue& key, Excep
tionState&); |
| 72 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, ExceptionCode
&); | 71 PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, ExceptionStat
e&); |
| 73 | 72 |
| 74 void continueFunction(PassRefPtr<IDBKey>, ExceptionCode&); | 73 void continueFunction(PassRefPtr<IDBKey>, ExceptionState&); |
| 75 void postSuccessHandlerCallback(); | 74 void postSuccessHandlerCallback(); |
| 76 void close(); | 75 void close(); |
| 77 void setValueReady(DOMRequestState*, PassRefPtr<IDBKey>, PassRefPtr<IDBKey>
primaryKey, ScriptValue&); | 76 void setValueReady(DOMRequestState*, PassRefPtr<IDBKey>, PassRefPtr<IDBKey>
primaryKey, ScriptValue&); |
| 78 PassRefPtr<IDBKey> idbPrimaryKey() { return m_currentPrimaryKey; } | 77 PassRefPtr<IDBKey> idbPrimaryKey() { return m_currentPrimaryKey; } |
| 79 | 78 |
| 80 protected: | 79 protected: |
| 81 IDBCursor(PassRefPtr<IDBCursorBackendInterface>, IndexedDB::CursorDirection,
IDBRequest*, IDBAny* source, IDBTransaction*); | 80 IDBCursor(PassRefPtr<IDBCursorBackendInterface>, IndexedDB::CursorDirection,
IDBRequest*, IDBAny* source, IDBTransaction*); |
| 82 virtual bool isKeyCursor() const { return true; } | 81 virtual bool isKeyCursor() const { return true; } |
| 83 | 82 |
| 84 private: | 83 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 ScriptValue m_currentKeyValue; | 97 ScriptValue m_currentKeyValue; |
| 99 ScriptValue m_currentPrimaryKeyValue; | 98 ScriptValue m_currentPrimaryKeyValue; |
| 100 RefPtr<IDBKey> m_currentKey; | 99 RefPtr<IDBKey> m_currentKey; |
| 101 RefPtr<IDBKey> m_currentPrimaryKey; | 100 RefPtr<IDBKey> m_currentPrimaryKey; |
| 102 ScriptValue m_currentValue; | 101 ScriptValue m_currentValue; |
| 103 }; | 102 }; |
| 104 | 103 |
| 105 } // namespace WebCore | 104 } // namespace WebCore |
| 106 | 105 |
| 107 #endif // IDBCursor_h | 106 #endif // IDBCursor_h |
| OLD | NEW |