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 10 matching lines...) Expand all Loading... |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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/core/v8/ScriptValue.h" | 29 #include "bindings/core/v8/ScriptValue.h" |
30 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.h" |
| 31 #include "modules/indexeddb/IDBCursorProxy.h" |
31 #include "modules/indexeddb/IDBKey.h" | 32 #include "modules/indexeddb/IDBKey.h" |
32 #include "modules/indexeddb/IDBRequest.h" | 33 #include "modules/indexeddb/IDBRequest.h" |
33 #include "modules/indexeddb/IndexedDB.h" | 34 #include "modules/indexeddb/IndexedDB.h" |
34 #include "public/platform/modules/indexeddb/WebIDBCursor.h" | |
35 #include "public/platform/modules/indexeddb/WebIDBTypes.h" | |
36 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
37 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
38 #include <memory> | 37 #include <memory> |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 class ExceptionState; | 41 class ExceptionState; |
43 class IDBAny; | 42 class IDBAny; |
44 class IDBTransaction; | 43 class IDBTransaction; |
45 class IDBValue; | 44 class IDBValue; |
46 class ScriptState; | 45 class ScriptState; |
47 | 46 |
48 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { | 47 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { |
49 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
50 public: | 49 public: |
51 static WebIDBCursorDirection stringToDirection(const String& modeString); | 50 static indexed_db::mojom::blink::CursorDirection stringToDirection(const Str
ing& modeString); |
52 | 51 |
53 static IDBCursor* create(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirectio
n, IDBRequest*, IDBAny* source, IDBTransaction*); | 52 static IDBCursor* create(std::unique_ptr<IDBCursorProxy>, indexed_db::mojom:
:blink::CursorDirection, IDBRequest*, IDBAny* source, IDBTransaction*); |
54 virtual ~IDBCursor(); | 53 virtual ~IDBCursor(); |
55 DECLARE_TRACE(); | 54 DECLARE_TRACE(); |
56 void contextWillBeDestroyed() { m_backend.reset(); } | 55 void contextWillBeDestroyed() { m_backend.reset(); } |
57 | 56 |
58 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; | 57 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; |
59 | 58 |
60 // Implement the IDL | 59 // Implement the IDL |
61 const String& direction() const; | 60 const String& direction() const; |
62 ScriptValue key(ScriptState*); | 61 ScriptValue key(ScriptState*); |
63 ScriptValue primaryKey(ScriptState*); | 62 ScriptValue primaryKey(ScriptState*); |
(...skipping 13 matching lines...) Expand all Loading... |
77 void continueFunction(IDBKey*, IDBKey* primaryKey, ExceptionState&); | 76 void continueFunction(IDBKey*, IDBKey* primaryKey, ExceptionState&); |
78 void postSuccessHandlerCallback(); | 77 void postSuccessHandlerCallback(); |
79 bool isDeleted() const; | 78 bool isDeleted() const; |
80 void close(); | 79 void close(); |
81 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); | 80 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); |
82 IDBKey* idbPrimaryKey() const { return m_primaryKey; } | 81 IDBKey* idbPrimaryKey() const { return m_primaryKey; } |
83 virtual bool isKeyCursor() const { return true; } | 82 virtual bool isKeyCursor() const { return true; } |
84 virtual bool isCursorWithValue() const { return false; } | 83 virtual bool isCursorWithValue() const { return false; } |
85 | 84 |
86 protected: | 85 protected: |
87 IDBCursor(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*,
IDBAny* source, IDBTransaction*); | 86 IDBCursor(std::unique_ptr<IDBCursorProxy>, indexed_db::mojom::blink::CursorD
irection, IDBRequest*, IDBAny* source, IDBTransaction*); |
88 | 87 |
89 private: | 88 private: |
90 IDBObjectStore* effectiveObjectStore() const; | 89 IDBObjectStore* effectiveObjectStore() const; |
91 | 90 |
92 std::unique_ptr<WebIDBCursor> m_backend; | 91 std::unique_ptr<IDBCursorProxy> m_backend; |
93 Member<IDBRequest> m_request; | 92 Member<IDBRequest> m_request; |
94 const WebIDBCursorDirection m_direction; | 93 const indexed_db::mojom::blink::CursorDirection m_direction; |
95 Member<IDBAny> m_source; | 94 Member<IDBAny> m_source; |
96 Member<IDBTransaction> m_transaction; | 95 Member<IDBTransaction> m_transaction; |
97 bool m_gotValue = false; | 96 bool m_gotValue = false; |
98 bool m_keyDirty = true; | 97 bool m_keyDirty = true; |
99 bool m_primaryKeyDirty = true; | 98 bool m_primaryKeyDirty = true; |
100 bool m_valueDirty = true; | 99 bool m_valueDirty = true; |
101 Member<IDBKey> m_key; | 100 Member<IDBKey> m_key; |
102 Member<IDBKey> m_primaryKey; | 101 Member<IDBKey> m_primaryKey; |
103 RefPtr<IDBValue> m_value; | 102 RefPtr<IDBValue> m_value; |
104 }; | 103 }; |
105 | 104 |
106 } // namespace blink | 105 } // namespace blink |
107 | 106 |
108 #endif // IDBCursor_h | 107 #endif // IDBCursor_h |
OLD | NEW |