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

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

Issue 235933013: Add the backchannel for Blobs to be received into Blink from the database backend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove accidentally-included files Created 6 years, 8 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 | Annotate | Revision Log
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 24 matching lines...) Expand all
35 #include "core/dom/ActiveDOMObject.h" 35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/dom/DOMError.h" 36 #include "core/dom/DOMError.h"
37 #include "core/dom/DOMStringList.h" 37 #include "core/dom/DOMStringList.h"
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/events/EventListener.h" 39 #include "core/events/EventListener.h"
40 #include "core/events/EventTarget.h" 40 #include "core/events/EventTarget.h"
41 #include "heap/Handle.h" 41 #include "heap/Handle.h"
42 #include "modules/indexeddb/IDBAny.h" 42 #include "modules/indexeddb/IDBAny.h"
43 #include "modules/indexeddb/IDBTransaction.h" 43 #include "modules/indexeddb/IDBTransaction.h"
44 #include "modules/indexeddb/IndexedDB.h" 44 #include "modules/indexeddb/IndexedDB.h"
45 #include "public/platform/WebBlobInfo.h"
45 #include "public/platform/WebIDBCursor.h" 46 #include "public/platform/WebIDBCursor.h"
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
49 class ExceptionState; 50 class ExceptionState;
50 class IDBCursor; 51 class IDBCursor;
51 struct IDBDatabaseMetadata; 52 struct IDBDatabaseMetadata;
52 class SharedBuffer; 53 class SharedBuffer;
53 54
54 // Base class to simplify usage of event target refcounting. 55 // Base class to simplify usage of event target refcounting.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 DEFINE_ATTRIBUTE_EVENT_LISTENER(success); 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
92 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
93 94
94 void setCursorDetails(IndexedDB::CursorType, blink::WebIDBCursor::Direction) ; 95 void setCursorDetails(IndexedDB::CursorType, blink::WebIDBCursor::Direction) ;
95 void setPendingCursor(PassRefPtr<IDBCursor>); 96 void setPendingCursor(PassRefPtr<IDBCursor>);
96 void abort(); 97 void abort();
97 98
98 virtual void onError(PassRefPtrWillBeRawPtr<DOMError>); 99 virtual void onError(PassRefPtrWillBeRawPtr<DOMError>);
99 virtual void onSuccess(const Vector<String>&); 100 virtual void onSuccess(const Vector<String>&);
100 virtual void onSuccess(PassOwnPtr<blink::WebIDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>); 101 virtual void onSuccess(PassOwnPtr<blink::WebIDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>, PassOwnPtr<Vector<blink ::WebBlobInfo> >);
101 virtual void onSuccess(PassRefPtr<IDBKey>); 102 virtual void onSuccess(PassRefPtr<IDBKey>);
102 virtual void onSuccess(PassRefPtr<SharedBuffer>); 103 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassOwnPtr<Vector<blink::We bBlobInfo> >);
103 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I DBKeyPath&); 104 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassOwnPtr<Vector<blink::We bBlobInfo> >, PassRefPtr<IDBKey>, const IDBKeyPath&);
104 virtual void onSuccess(int64_t); 105 virtual void onSuccess(int64_t);
105 virtual void onSuccess(); 106 virtual void onSuccess();
106 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa ssRefPtr<SharedBuffer>); 107 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa ssRefPtr<SharedBuffer>, PassOwnPtr<Vector<blink::WebBlobInfo> >);
107 108
108 // Only IDBOpenDBRequest instances should receive these: 109 // Only IDBOpenDBRequest instances should receive these:
109 virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); } 110 virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); }
110 virtual void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<blink::WebIDBDat abase>, const IDBDatabaseMetadata&, blink::WebIDBDataLoss, String dataLossMessag e) { ASSERT_NOT_REACHED(); } 111 virtual void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<blink::WebIDBDat abase>, const IDBDatabaseMetadata&, blink::WebIDBDataLoss, String dataLossMessag e) { ASSERT_NOT_REACHED(); }
111 virtual void onSuccess(PassOwnPtr<blink::WebIDBDatabase>, const IDBDatabaseM etadata&) { ASSERT_NOT_REACHED(); } 112 virtual void onSuccess(PassOwnPtr<blink::WebIDBDatabase>, const IDBDatabaseM etadata&) { ASSERT_NOT_REACHED(); }
112 113
113 // ActiveDOMObject 114 // ActiveDOMObject
114 virtual bool hasPendingActivity() const OVERRIDE FINAL; 115 virtual bool hasPendingActivity() const OVERRIDE FINAL;
115 virtual void stop() OVERRIDE FINAL; 116 virtual void stop() OVERRIDE FINAL;
116 117
(...skipping 13 matching lines...) Expand all
130 virtual void deref() OVERRIDE FINAL 131 virtual void deref() OVERRIDE FINAL
131 { 132 {
132 if (derefBase()) 133 if (derefBase())
133 delete this; 134 delete this;
134 else if (hasOneRef()) 135 else if (hasOneRef())
135 checkForReferenceCycle(); 136 checkForReferenceCycle();
136 } 137 }
137 138
138 IDBCursor* getResultCursor() const; 139 IDBCursor* getResultCursor() const;
139 140
141 void ackReceivedBlobs(const Vector<blink::WebBlobInfo>*);
142
140 protected: 143 protected:
141 IDBRequest(ExecutionContext*, PassRefPtr<IDBAny> source, IDBTransaction*); 144 IDBRequest(ExecutionContext*, PassRefPtr<IDBAny> source, IDBTransaction*);
142 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); 145 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>);
143 void dequeueEvent(Event*); 146 void dequeueEvent(Event*);
144 virtual bool shouldEnqueueEvent() const; 147 virtual bool shouldEnqueueEvent() const;
145 void onSuccessInternal(PassRefPtr<IDBAny>); 148 void onSuccessInternal(PassRefPtr<IDBAny>);
146 void setResult(PassRefPtr<IDBAny>); 149 void setResult(PassRefPtr<IDBAny>);
147 150
148 bool m_contextStopped; 151 bool m_contextStopped;
149 RefPtr<IDBTransaction> m_transaction; 152 RefPtr<IDBTransaction> m_transaction;
150 ReadyState m_readyState; 153 ReadyState m_readyState;
151 bool m_requestAborted; // May be aborted by transaction then receive async o nsuccess; ignore vs. assert. 154 bool m_requestAborted; // May be aborted by transaction then receive async o nsuccess; ignore vs. assert.
152 155
153 private: 156 private:
154 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I DBKey> primaryKey, PassRefPtr<SharedBuffer> value); 157 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I DBKey> primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<blink::WebB lobInfo> >);
155 void checkForReferenceCycle(); 158 void checkForReferenceCycle();
159 void handleBlobAcks();
156 160
157 RefPtr<NewScriptState> m_scriptState; 161 RefPtr<NewScriptState> m_scriptState;
158 RefPtr<IDBAny> m_source; 162 RefPtr<IDBAny> m_source;
159 RefPtr<IDBAny> m_result; 163 RefPtr<IDBAny> m_result;
160 RefPtrWillBePersistent<DOMError> m_error; 164 RefPtrWillBePersistent<DOMError> m_error;
161 165
162 bool m_hasPendingActivity; 166 bool m_hasPendingActivity;
163 WillBePersistentHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents; 167 WillBePersistentHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents;
164 168
165 // Only used if the result type will be a cursor. 169 // Only used if the result type will be a cursor.
166 IndexedDB::CursorType m_cursorType; 170 IndexedDB::CursorType m_cursorType;
167 blink::WebIDBCursor::Direction m_cursorDirection; 171 blink::WebIDBCursor::Direction m_cursorDirection;
168 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur sor holds it. 172 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur sor holds it.
169 RefPtr<IDBCursor> m_pendingCursor; 173 RefPtr<IDBCursor> m_pendingCursor;
170 // New state is not applied to the cursor object until the event is dispatch ed. 174 // New state is not applied to the cursor object until the event is dispatch ed.
171 RefPtr<IDBKey> m_cursorKey; 175 RefPtr<IDBKey> m_cursorKey;
172 RefPtr<IDBKey> m_cursorPrimaryKey; 176 RefPtr<IDBKey> m_cursorPrimaryKey;
173 RefPtr<SharedBuffer> m_cursorValue; 177 RefPtr<SharedBuffer> m_cursorValue;
178 OwnPtr<Vector<blink::WebBlobInfo> > m_blobInfo;
174 179
175 bool m_didFireUpgradeNeededEvent; 180 bool m_didFireUpgradeNeededEvent;
176 bool m_preventPropagation; 181 bool m_preventPropagation;
177 bool m_resultDirty; 182 bool m_resultDirty;
178 }; 183 };
179 184
180 } // namespace WebCore 185 } // namespace WebCore
181 186
182 #endif // IDBRequest_h 187 #endif // IDBRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698