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