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

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

Issue 18590006: Blob support for IDB [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: small cleanup Created 7 years 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 DEFINE_ATTRIBUTE_EVENT_LISTENER(success); 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
89 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
90 90
91 void markEarlyDeath(); 91 void markEarlyDeath();
92 void setCursorDetails(IndexedDB::CursorType, IndexedDB::CursorDirection); 92 void setCursorDetails(IndexedDB::CursorType, IndexedDB::CursorDirection);
93 void setPendingCursor(PassRefPtr<IDBCursor>); 93 void setPendingCursor(PassRefPtr<IDBCursor>);
94 void abort(); 94 void abort();
95 95
96 virtual void onError(PassRefPtr<DOMError>); 96 virtual void onError(PassRefPtr<DOMError>);
97 virtual void onSuccess(const Vector<String>&); 97 virtual void onSuccess(const Vector<String>&);
98 virtual void onSuccess(PassOwnPtr<blink::WebIDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>); 98 virtual void onSuccess(PassOwnPtr<blink::WebIDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>, PassOwnPtr<Vector<BlobI nfo> >);
99 virtual void onSuccess(PassRefPtr<IDBKey>); 99 virtual void onSuccess(PassRefPtr<IDBKey>);
100 virtual void onSuccess(PassRefPtr<SharedBuffer>); 100 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassOwnPtr<Vector<BlobInfo> >);
101 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I DBKeyPath&); 101 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassOwnPtr<Vector<BlobInfo> >, PassRefPtr<IDBKey>, const IDBKeyPath&);
102 virtual void onSuccess(int64_t); 102 virtual void onSuccess(int64_t);
103 virtual void onSuccess(); 103 virtual void onSuccess();
104 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa ssRefPtr<SharedBuffer>); 104 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa ssRefPtr<SharedBuffer>, PassOwnPtr<Vector<BlobInfo> >);
105 105
106 // Only IDBOpenDBRequest instances should receive these: 106 // Only IDBOpenDBRequest instances should receive these:
107 virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); } 107 virtual void onBlocked(int64_t oldVersion) { ASSERT_NOT_REACHED(); }
108 virtual void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<blink::WebIDBDat abase>, const IDBDatabaseMetadata&, blink::WebIDBDataLoss, String dataLossMessag e) { ASSERT_NOT_REACHED(); } 108 virtual void onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<blink::WebIDBDat abase>, const IDBDatabaseMetadata&, blink::WebIDBDataLoss, String dataLossMessag e) { ASSERT_NOT_REACHED(); }
109 virtual void onSuccess(PassOwnPtr<blink::WebIDBDatabase>, const IDBDatabaseM etadata&) { ASSERT_NOT_REACHED(); } 109 virtual void onSuccess(PassOwnPtr<blink::WebIDBDatabase>, const IDBDatabaseM etadata&) { ASSERT_NOT_REACHED(); }
110 110
111 // ActiveDOMObject 111 // ActiveDOMObject
112 virtual bool hasPendingActivity() const OVERRIDE; 112 virtual bool hasPendingActivity() const OVERRIDE;
113 virtual void stop() OVERRIDE; 113 virtual void stop() OVERRIDE;
114 114
(...skipping 11 matching lines...) Expand all
126 { 126 {
127 if (derefBase()) 127 if (derefBase())
128 delete this; 128 delete this;
129 else if (hasOneRef()) 129 else if (hasOneRef())
130 checkForReferenceCycle(); 130 checkForReferenceCycle();
131 } 131 }
132 132
133 DOMRequestState* requestState() { return &m_requestState; } 133 DOMRequestState* requestState() { return &m_requestState; }
134 IDBCursor* getResultCursor(); 134 IDBCursor* getResultCursor();
135 135
136 void ackReceivedBlobs(const Vector<BlobInfo>*);
137
136 protected: 138 protected:
137 IDBRequest(ExecutionContext*, PassRefPtr<IDBAny> source, IDBTransaction*); 139 IDBRequest(ExecutionContext*, PassRefPtr<IDBAny> source, IDBTransaction*);
138 void enqueueEvent(PassRefPtr<Event>); 140 void enqueueEvent(PassRefPtr<Event>);
139 virtual bool shouldEnqueueEvent() const; 141 virtual bool shouldEnqueueEvent() const;
140 void onSuccessInternal(PassRefPtr<IDBAny>); 142 void onSuccessInternal(PassRefPtr<IDBAny>);
141 void setResult(PassRefPtr<IDBAny>); 143 void setResult(PassRefPtr<IDBAny>);
142 144
143 bool m_contextStopped; 145 bool m_contextStopped;
144 RefPtr<IDBTransaction> m_transaction; 146 RefPtr<IDBTransaction> m_transaction;
145 ReadyState m_readyState; 147 ReadyState m_readyState;
146 bool m_requestAborted; // May be aborted by transaction then receive async o nsuccess; ignore vs. assert. 148 bool m_requestAborted; // May be aborted by transaction then receive async o nsuccess; ignore vs. assert.
147 149
148 private: 150 private:
149 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I DBKey> primaryKey, PassRefPtr<SharedBuffer> value); 151 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I DBKey> primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<BlobInfo> > );
150 void checkForReferenceCycle(); 152 void checkForReferenceCycle();
153 void handleBlobAcks();
151 154
152 RefPtr<IDBAny> m_source; 155 RefPtr<IDBAny> m_source;
153 RefPtr<IDBAny> m_result; 156 RefPtr<IDBAny> m_result;
154 RefPtr<DOMError> m_error; 157 RefPtr<DOMError> m_error;
155 158
156 bool m_hasPendingActivity; 159 bool m_hasPendingActivity;
157 Vector<RefPtr<Event> > m_enqueuedEvents; 160 Vector<RefPtr<Event> > m_enqueuedEvents;
158 161
159 // Only used if the result type will be a cursor. 162 // Only used if the result type will be a cursor.
160 IndexedDB::CursorType m_cursorType; 163 IndexedDB::CursorType m_cursorType;
161 IndexedDB::CursorDirection m_cursorDirection; 164 IndexedDB::CursorDirection m_cursorDirection;
162 RefPtr<IDBCursor> m_pendingCursor; 165 RefPtr<IDBCursor> m_pendingCursor;
163 RefPtr<IDBKey> m_cursorKey; 166 RefPtr<IDBKey> m_cursorKey;
164 RefPtr<IDBKey> m_cursorPrimaryKey; 167 RefPtr<IDBKey> m_cursorPrimaryKey;
165 RefPtr<SharedBuffer> m_cursorValue; 168 RefPtr<SharedBuffer> m_cursorValue;
169 OwnPtr<Vector<BlobInfo> > m_blobInfo;
166 bool m_didFireUpgradeNeededEvent; 170 bool m_didFireUpgradeNeededEvent;
167 bool m_preventPropagation; 171 bool m_preventPropagation;
168 bool m_resultDirty; 172 bool m_resultDirty;
169 173
170 DOMRequestState m_requestState; 174 DOMRequestState m_requestState;
171 }; 175 };
172 176
173 } // namespace WebCore 177 } // namespace WebCore
174 178
175 #endif // IDBRequest_h 179 #endif // IDBRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698