Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBRequest.h

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef IDBRequest_h 29 #ifndef IDBRequest_h
30 #define IDBRequest_h 30 #define IDBRequest_h
31 31
32 #include "Source/modules/indexeddb/indexed_db.mojom-blink.h"
32 #include "bindings/core/v8/ActiveScriptWrappable.h" 33 #include "bindings/core/v8/ActiveScriptWrappable.h"
33 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
34 #include "bindings/core/v8/ScriptValue.h" 35 #include "bindings/core/v8/ScriptValue.h"
35 #include "core/dom/ActiveDOMObject.h" 36 #include "core/dom/ActiveDOMObject.h"
36 #include "core/dom/DOMStringList.h" 37 #include "core/dom/DOMStringList.h"
37 #include "core/events/EventListener.h" 38 #include "core/events/EventListener.h"
38 #include "core/events/EventTarget.h" 39 #include "core/events/EventTarget.h"
39 #include "modules/EventModules.h" 40 #include "modules/EventModules.h"
40 #include "modules/ModulesExport.h" 41 #include "modules/ModulesExport.h"
41 #include "modules/indexeddb/IDBAny.h" 42 #include "modules/indexeddb/IDBAny.h"
42 #include "modules/indexeddb/IDBTransaction.h" 43 #include "modules/indexeddb/IDBTransaction.h"
43 #include "modules/indexeddb/IndexedDB.h" 44 #include "modules/indexeddb/IndexedDB.h"
44 #include "platform/blob/BlobData.h" 45 #include "platform/blob/BlobData.h"
45 #include "platform/heap/Handle.h" 46 #include "platform/heap/Handle.h"
46 #include "public/platform/WebBlobInfo.h" 47 #include "public/platform/WebBlobInfo.h"
47 #include "public/platform/modules/indexeddb/WebIDBCursor.h"
48 #include "public/platform/modules/indexeddb/WebIDBTypes.h"
49 #include <memory> 48 #include <memory>
50 49
51 namespace blink { 50 namespace blink {
52 51
53 class DOMException; 52 class DOMException;
54 class ExceptionState; 53 class ExceptionState;
55 class IDBCursor; 54 class IDBCursor;
55 class IDBCursorProxy;
56 struct IDBDatabaseMetadata; 56 struct IDBDatabaseMetadata;
57 class IDBDatabaseProxy;
57 class IDBValue; 58 class IDBValue;
58 59
59 class MODULES_EXPORT IDBRequest 60 class MODULES_EXPORT IDBRequest
60 : public EventTargetWithInlineData 61 : public EventTargetWithInlineData
61 , public ActiveScriptWrappable 62 , public ActiveScriptWrappable
62 , public ActiveDOMObject { 63 , public ActiveDOMObject {
63 DEFINE_WRAPPERTYPEINFO(); 64 DEFINE_WRAPPERTYPEINFO();
64 USING_GARBAGE_COLLECTED_MIXIN(IDBRequest); 65 USING_GARBAGE_COLLECTED_MIXIN(IDBRequest);
65 public: 66 public:
66 static IDBRequest* create(ScriptState*, IDBAny* source, IDBTransaction*); 67 static IDBRequest* create(ScriptState*, IDBAny* source, IDBTransaction*);
(...skipping 18 matching lines...) Expand all
85 PENDING = 1, 86 PENDING = 1,
86 DONE = 2, 87 DONE = 2,
87 EarlyDeath = 3 88 EarlyDeath = 3
88 }; 89 };
89 90
90 const String& readyState() const; 91 const String& readyState() const;
91 92
92 DEFINE_ATTRIBUTE_EVENT_LISTENER(success); 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
93 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
94 95
95 void setCursorDetails(IndexedDB::CursorType, WebIDBCursorDirection); 96 void setCursorDetails(IndexedDB::CursorType, indexed_db::mojom::blink::Curso rDirection);
96 void setPendingCursor(IDBCursor*); 97 void setPendingCursor(IDBCursor*);
97 void abort(); 98 void abort();
98 99
99 virtual void onError(DOMException*); 100 virtual void onError(DOMException*);
100 virtual void onSuccess(const Vector<String>&); 101 virtual void onSuccess(const Vector<String>&);
101 virtual void onSuccess(std::unique_ptr<WebIDBCursor>, IDBKey*, IDBKey* prima ryKey, PassRefPtr<IDBValue>); 102 virtual void onSuccess(std::unique_ptr<IDBCursorProxy>, IDBKey*, IDBKey* pri maryKey, PassRefPtr<IDBValue>);
102 virtual void onSuccess(IDBKey*); 103 virtual void onSuccess(IDBKey*);
103 virtual void onSuccess(PassRefPtr<IDBValue>); 104 virtual void onSuccess(PassRefPtr<IDBValue>);
104 virtual void onSuccess(const Vector<RefPtr<IDBValue>>&); 105 virtual void onSuccess(const Vector<RefPtr<IDBValue>>&);
105 virtual void onSuccess(int64_t); 106 virtual void onSuccess(int64_t);
106 virtual void onSuccess(); 107 virtual void onSuccess();
107 virtual void onSuccess(IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>); 108 virtual void onSuccess(IDBKey*, IDBKey* primaryKey, PassRefPtr<IDBValue>);
108 109
109 // Only IDBOpenDBRequest instances should receive these: 110 // Only IDBOpenDBRequest instances should receive this:
110 virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); } 111 virtual void onSuccess(std::unique_ptr<IDBDatabaseProxy>, const IDBDatabaseM etadata&) { NOTREACHED(); }
111 virtual void onUpgradeNeeded(int64_t oldVersion, std::unique_ptr<WebIDBDatab ase>, const IDBDatabaseMetadata&, WebIDBDataLoss, String dataLossMessage) { ASSE RT_NOT_REACHED(); }
112 virtual void onSuccess(std::unique_ptr<WebIDBDatabase>, const IDBDatabaseMet adata&) { ASSERT_NOT_REACHED(); }
113 112
114 // ActiveScriptWrappable 113 // ActiveScriptWrappable
115 bool hasPendingActivity() const final; 114 bool hasPendingActivity() const final;
116 115
117 // ActiveDOMObject 116 // ActiveDOMObject
118 void stop() final; 117 void stop() final;
119 118
120 // EventTarget 119 // EventTarget
121 const AtomicString& interfaceName() const override; 120 const AtomicString& interfaceName() const override;
122 ExecutionContext* getExecutionContext() const final; 121 ExecutionContext* getExecutionContext() const final;
123 void uncaughtExceptionInEventHandler() final; 122 void uncaughtExceptionInEventHandler() final;
124 123
125 // Called by a version change transaction that has finished to set this 124 // Called by a version change transaction that has finished to set this
126 // request back from DONE (following "upgradeneeded") back to PENDING (for 125 // request back from DONE (following "upgradeneeded") back to PENDING (for
127 // the upcoming "success" or "error"). 126 // the upcoming "success" or "error").
128 void transactionDidFinishAndDispatch(); 127 void transactionDidFinishAndDispatch();
129 128
129 void onGetResult(indexed_db::mojom::blink::GetResultPtr);
130
130 IDBCursor* getResultCursor() const; 131 IDBCursor* getResultCursor() const;
131 132
132 protected: 133 protected:
133 IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*); 134 IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*);
134 void enqueueEvent(Event*); 135 void enqueueEvent(Event*);
135 void dequeueEvent(Event*); 136 void dequeueEvent(Event*);
136 virtual bool shouldEnqueueEvent() const; 137 virtual bool shouldEnqueueEvent() const;
137 void onSuccessInternal(IDBAny*); 138 void onSuccessInternal(IDBAny*);
138 void setResult(IDBAny*); 139 void setResult(IDBAny*);
139 140
(...skipping 13 matching lines...) Expand all
153 RefPtr<ScriptState> m_scriptState; 154 RefPtr<ScriptState> m_scriptState;
154 Member<IDBAny> m_source; 155 Member<IDBAny> m_source;
155 Member<IDBAny> m_result; 156 Member<IDBAny> m_result;
156 Member<DOMException> m_error; 157 Member<DOMException> m_error;
157 158
158 bool m_hasPendingActivity = true; 159 bool m_hasPendingActivity = true;
159 HeapVector<Member<Event>> m_enqueuedEvents; 160 HeapVector<Member<Event>> m_enqueuedEvents;
160 161
161 // Only used if the result type will be a cursor. 162 // Only used if the result type will be a cursor.
162 IndexedDB::CursorType m_cursorType = IndexedDB::CursorKeyAndValue; 163 IndexedDB::CursorType m_cursorType = IndexedDB::CursorKeyAndValue;
163 WebIDBCursorDirection m_cursorDirection = WebIDBCursorDirectionNext; 164 indexed_db::mojom::blink::CursorDirection m_cursorDirection = indexed_db::mo jom::blink::CursorDirection::Next;
164 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur sor holds it. 165 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur sor holds it.
165 Member<IDBCursor> m_pendingCursor; 166 Member<IDBCursor> m_pendingCursor;
166 // New state is not applied to the cursor object until the event is dispatch ed. 167 // New state is not applied to the cursor object until the event is dispatch ed.
167 Member<IDBKey> m_cursorKey; 168 Member<IDBKey> m_cursorKey;
168 Member<IDBKey> m_cursorPrimaryKey; 169 Member<IDBKey> m_cursorPrimaryKey;
169 RefPtr<IDBValue> m_cursorValue; 170 RefPtr<IDBValue> m_cursorValue;
170 171
171 bool m_didFireUpgradeNeededEvent = false; 172 bool m_didFireUpgradeNeededEvent = false;
172 bool m_preventPropagation = false; 173 bool m_preventPropagation = false;
173 bool m_resultDirty = true; 174 bool m_resultDirty = true;
174 }; 175 };
175 176
176 } // namespace blink 177 } // namespace blink
177 178
178 #endif // IDBRequest_h 179 #endif // IDBRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698