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 17 matching lines...) Expand all Loading... |
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/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/modules/indexeddb/WebIDBCursor.h" | 34 #include "public/platform/modules/indexeddb/WebIDBCursor.h" |
35 #include "public/platform/modules/indexeddb/WebIDBTypes.h" | 35 #include "public/platform/modules/indexeddb/WebIDBTypes.h" |
36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 38 #include <memory> |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class ExceptionState; | 42 class ExceptionState; |
42 class IDBAny; | 43 class IDBAny; |
43 class IDBTransaction; | 44 class IDBTransaction; |
44 class IDBValue; | 45 class IDBValue; |
45 class ScriptState; | 46 class ScriptState; |
46 | 47 |
47 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { | 48 class IDBCursor : public GarbageCollectedFinalized<IDBCursor>, public ScriptWrap
pable { |
48 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
49 public: | 50 public: |
50 static WebIDBCursorDirection stringToDirection(const String& modeString); | 51 static WebIDBCursorDirection stringToDirection(const String& modeString); |
51 | 52 |
52 static IDBCursor* create(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, ID
BRequest*, IDBAny* source, IDBTransaction*); | 53 static IDBCursor* create(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirectio
n, IDBRequest*, IDBAny* source, IDBTransaction*); |
53 virtual ~IDBCursor(); | 54 virtual ~IDBCursor(); |
54 DECLARE_TRACE(); | 55 DECLARE_TRACE(); |
55 void contextWillBeDestroyed() { m_backend.reset(); } | 56 void contextWillBeDestroyed() { m_backend.reset(); } |
56 | 57 |
57 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; | 58 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; |
58 | 59 |
59 // Implement the IDL | 60 // Implement the IDL |
60 const String& direction() const; | 61 const String& direction() const; |
61 ScriptValue key(ScriptState*); | 62 ScriptValue key(ScriptState*); |
62 ScriptValue primaryKey(ScriptState*); | 63 ScriptValue primaryKey(ScriptState*); |
(...skipping 13 matching lines...) Expand all Loading... |
76 void continueFunction(IDBKey*, IDBKey* primaryKey, ExceptionState&); | 77 void continueFunction(IDBKey*, IDBKey* primaryKey, ExceptionState&); |
77 void postSuccessHandlerCallback(); | 78 void postSuccessHandlerCallback(); |
78 bool isDeleted() const; | 79 bool isDeleted() const; |
79 void close(); | 80 void close(); |
80 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); | 81 void setValueReady(IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); |
81 IDBKey* idbPrimaryKey() const { return m_primaryKey; } | 82 IDBKey* idbPrimaryKey() const { return m_primaryKey; } |
82 virtual bool isKeyCursor() const { return true; } | 83 virtual bool isKeyCursor() const { return true; } |
83 virtual bool isCursorWithValue() const { return false; } | 84 virtual bool isCursorWithValue() const { return false; } |
84 | 85 |
85 protected: | 86 protected: |
86 IDBCursor(PassOwnPtr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*, IDBA
ny* source, IDBTransaction*); | 87 IDBCursor(std::unique_ptr<WebIDBCursor>, WebIDBCursorDirection, IDBRequest*,
IDBAny* source, IDBTransaction*); |
87 | 88 |
88 private: | 89 private: |
89 IDBObjectStore* effectiveObjectStore() const; | 90 IDBObjectStore* effectiveObjectStore() const; |
90 | 91 |
91 OwnPtr<WebIDBCursor> m_backend; | 92 std::unique_ptr<WebIDBCursor> m_backend; |
92 Member<IDBRequest> m_request; | 93 Member<IDBRequest> m_request; |
93 const WebIDBCursorDirection m_direction; | 94 const WebIDBCursorDirection m_direction; |
94 Member<IDBAny> m_source; | 95 Member<IDBAny> m_source; |
95 Member<IDBTransaction> m_transaction; | 96 Member<IDBTransaction> m_transaction; |
96 bool m_gotValue = false; | 97 bool m_gotValue = false; |
97 bool m_keyDirty = true; | 98 bool m_keyDirty = true; |
98 bool m_primaryKeyDirty = true; | 99 bool m_primaryKeyDirty = true; |
99 bool m_valueDirty = true; | 100 bool m_valueDirty = true; |
100 Member<IDBKey> m_key; | 101 Member<IDBKey> m_key; |
101 Member<IDBKey> m_primaryKey; | 102 Member<IDBKey> m_primaryKey; |
102 RefPtr<IDBValue> m_value; | 103 RefPtr<IDBValue> m_value; |
103 }; | 104 }; |
104 | 105 |
105 } // namespace blink | 106 } // namespace blink |
106 | 107 |
107 #endif // IDBCursor_h | 108 #endif // IDBCursor_h |
OLD | NEW |