| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #ifndef IDBCursor_h | 26 #ifndef IDBCursor_h |
| 27 #define IDBCursor_h | 27 #define IDBCursor_h |
| 28 | 28 |
| 29 #include "bindings/v8/ScriptValue.h" | 29 #include "bindings/v8/ScriptValue.h" |
| 30 #include "bindings/v8/ScriptWrappable.h" | 30 #include "bindings/v8/ScriptWrappable.h" |
| 31 #include "modules/indexeddb/IDBKey.h" | 31 #include "modules/indexeddb/IDBKey.h" |
| 32 #include "modules/indexeddb/IDBRequest.h" | 32 #include "modules/indexeddb/IDBRequest.h" |
| 33 #include "modules/indexeddb/IndexedDB.h" | 33 #include "modules/indexeddb/IndexedDB.h" |
| 34 #include "public/platform/WebIDBCursor.h" | 34 #include "public/platform/WebIDBCursor.h" |
| 35 #include "public/platform/WebIDBTypes.h" |
| 35 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class WebBlobInfo; | 41 class WebBlobInfo; |
| 41 | 42 |
| 42 } // namespace blink | 43 } // namespace blink |
| 43 | 44 |
| 44 namespace WebCore { | 45 namespace WebCore { |
| 45 | 46 |
| 46 class ExceptionState; | 47 class ExceptionState; |
| 47 class IDBAny; | 48 class IDBAny; |
| 48 class IDBTransaction; | 49 class IDBTransaction; |
| 49 class ExecutionContext; | 50 class ExecutionContext; |
| 50 class SharedBuffer; | 51 class SharedBuffer; |
| 51 | 52 |
| 52 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { | 53 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { |
| 53 public: | 54 public: |
| 54 static const AtomicString& directionNext(); | 55 static const AtomicString& directionNext(); |
| 55 static const AtomicString& directionNextUnique(); | 56 static const AtomicString& directionNextUnique(); |
| 56 static const AtomicString& directionPrev(); | 57 static const AtomicString& directionPrev(); |
| 57 static const AtomicString& directionPrevUnique(); | 58 static const AtomicString& directionPrevUnique(); |
| 58 | 59 |
| 59 static blink::WebIDBCursor::Direction stringToDirection(const String& modeSt
ring, ExceptionState&); | 60 static blink::WebIDBCursorDirection stringToDirection(const String& modeStri
ng, ExceptionState&); |
| 60 static const AtomicString& directionToString(unsigned short mode); | 61 static const AtomicString& directionToString(unsigned short mode); |
| 61 | 62 |
| 62 static IDBCursor* create(PassOwnPtr<blink::WebIDBCursor>, blink::WebIDBCurso
r::Direction, IDBRequest*, IDBAny* source, IDBTransaction*); | 63 static IDBCursor* create(PassOwnPtr<blink::WebIDBCursor>, blink::WebIDBCurso
rDirection, IDBRequest*, IDBAny* source, IDBTransaction*); |
| 63 virtual ~IDBCursor(); | 64 virtual ~IDBCursor(); |
| 64 void trace(Visitor*); | 65 void trace(Visitor*); |
| 65 void contextWillBeDestroyed() { m_backend.clear(); } | 66 void contextWillBeDestroyed() { m_backend.clear(); } |
| 66 | 67 |
| 67 // Implement the IDL | 68 // Implement the IDL |
| 68 const String& direction() const { return directionToString(m_direction); } | 69 const String& direction() const { return directionToString(m_direction); } |
| 69 ScriptValue key(ScriptState*); | 70 ScriptValue key(ScriptState*); |
| 70 ScriptValue primaryKey(ScriptState*); | 71 ScriptValue primaryKey(ScriptState*); |
| 71 ScriptValue value(ScriptState*); | 72 ScriptValue value(ScriptState*); |
| 72 ScriptValue source(ScriptState*) const; | 73 ScriptValue source(ScriptState*) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 void postSuccessHandlerCallback(); | 86 void postSuccessHandlerCallback(); |
| 86 bool isDeleted() const; | 87 bool isDeleted() const; |
| 87 void close(); | 88 void close(); |
| 88 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<SharedBuffer> val
ue, PassOwnPtr<Vector<blink::WebBlobInfo> >); | 89 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<SharedBuffer> val
ue, PassOwnPtr<Vector<blink::WebBlobInfo> >); |
| 89 IDBKey* idbPrimaryKey() const { return m_primaryKey; } | 90 IDBKey* idbPrimaryKey() const { return m_primaryKey; } |
| 90 IDBRequest* request() const { return m_request.get(); } | 91 IDBRequest* request() const { return m_request.get(); } |
| 91 virtual bool isKeyCursor() const { return true; } | 92 virtual bool isKeyCursor() const { return true; } |
| 92 virtual bool isCursorWithValue() const { return false; } | 93 virtual bool isCursorWithValue() const { return false; } |
| 93 | 94 |
| 94 protected: | 95 protected: |
| 95 IDBCursor(PassOwnPtr<blink::WebIDBCursor>, blink::WebIDBCursor::Direction, I
DBRequest*, IDBAny* source, IDBTransaction*); | 96 IDBCursor(PassOwnPtr<blink::WebIDBCursor>, blink::WebIDBCursorDirection, IDB
Request*, IDBAny* source, IDBTransaction*); |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 IDBObjectStore* effectiveObjectStore() const; | 99 IDBObjectStore* effectiveObjectStore() const; |
| 99 void handleBlobAcks(); | 100 void handleBlobAcks(); |
| 100 | 101 |
| 101 OwnPtr<blink::WebIDBCursor> m_backend; | 102 OwnPtr<blink::WebIDBCursor> m_backend; |
| 102 Member<IDBRequest> m_request; | 103 Member<IDBRequest> m_request; |
| 103 const blink::WebIDBCursor::Direction m_direction; | 104 const blink::WebIDBCursorDirection m_direction; |
| 104 Member<IDBAny> m_source; | 105 Member<IDBAny> m_source; |
| 105 Member<IDBTransaction> m_transaction; | 106 Member<IDBTransaction> m_transaction; |
| 106 bool m_gotValue; | 107 bool m_gotValue; |
| 107 bool m_keyDirty; | 108 bool m_keyDirty; |
| 108 bool m_primaryKeyDirty; | 109 bool m_primaryKeyDirty; |
| 109 bool m_valueDirty; | 110 bool m_valueDirty; |
| 110 Member<IDBKey> m_key; | 111 Member<IDBKey> m_key; |
| 111 Member<IDBKey> m_primaryKey; | 112 Member<IDBKey> m_primaryKey; |
| 112 RefPtr<SharedBuffer> m_value; | 113 RefPtr<SharedBuffer> m_value; |
| 113 OwnPtr<Vector<blink::WebBlobInfo> > m_blobInfo; | 114 OwnPtr<Vector<blink::WebBlobInfo> > m_blobInfo; |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 } // namespace WebCore | 117 } // namespace WebCore |
| 117 | 118 |
| 118 #endif // IDBCursor_h | 119 #endif // IDBCursor_h |
| OLD | NEW |