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

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

Issue 464353002: Cleanup blink:: prefix usage in Source/core/modules/[battery/*.cpp to indexeddb/*.cpp] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 IDBRequest::IDBRequest(ScriptState* scriptState, IDBAny* source, IDBTransaction* transaction) 59 IDBRequest::IDBRequest(ScriptState* scriptState, IDBAny* source, IDBTransaction* transaction)
60 : ActiveDOMObject(scriptState->executionContext()) 60 : ActiveDOMObject(scriptState->executionContext())
61 , m_contextStopped(false) 61 , m_contextStopped(false)
62 , m_transaction(transaction) 62 , m_transaction(transaction)
63 , m_readyState(PENDING) 63 , m_readyState(PENDING)
64 , m_requestAborted(false) 64 , m_requestAborted(false)
65 , m_scriptState(scriptState) 65 , m_scriptState(scriptState)
66 , m_source(source) 66 , m_source(source)
67 , m_hasPendingActivity(true) 67 , m_hasPendingActivity(true)
68 , m_cursorType(IndexedDB::CursorKeyAndValue) 68 , m_cursorType(IndexedDB::CursorKeyAndValue)
69 , m_cursorDirection(blink::WebIDBCursorDirectionNext) 69 , m_cursorDirection(WebIDBCursorDirectionNext)
70 , m_pendingCursor(nullptr) 70 , m_pendingCursor(nullptr)
71 , m_didFireUpgradeNeededEvent(false) 71 , m_didFireUpgradeNeededEvent(false)
72 , m_preventPropagation(false) 72 , m_preventPropagation(false)
73 , m_resultDirty(true) 73 , m_resultDirty(true)
74 { 74 {
75 ScriptWrappable::init(this); 75 ScriptWrappable::init(this);
76 } 76 }
77 77
78 IDBRequest::~IDBRequest() 78 IDBRequest::~IDBRequest()
79 { 79 {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ASSERT_UNUSED(removed, removed); 152 ASSERT_UNUSED(removed, removed);
153 } 153 }
154 m_enqueuedEvents.clear(); 154 m_enqueuedEvents.clear();
155 155
156 m_error.clear(); 156 m_error.clear();
157 m_result.clear(); 157 m_result.clear();
158 onError(DOMError::create(AbortError, "The transaction was aborted, so the re quest cannot be fulfilled.")); 158 onError(DOMError::create(AbortError, "The transaction was aborted, so the re quest cannot be fulfilled."));
159 m_requestAborted = true; 159 m_requestAborted = true;
160 } 160 }
161 161
162 void IDBRequest::setCursorDetails(IndexedDB::CursorType cursorType, blink::WebID BCursorDirection direction) 162 void IDBRequest::setCursorDetails(IndexedDB::CursorType cursorType, WebIDBCursor Direction direction)
163 { 163 {
164 ASSERT(m_readyState == PENDING); 164 ASSERT(m_readyState == PENDING);
165 ASSERT(!m_pendingCursor); 165 ASSERT(!m_pendingCursor);
166 m_cursorType = cursorType; 166 m_cursorType = cursorType;
167 m_cursorDirection = direction; 167 m_cursorDirection = direction;
168 } 168 }
169 169
170 void IDBRequest::setPendingCursor(IDBCursor* cursor) 170 void IDBRequest::setPendingCursor(IDBCursor* cursor)
171 { 171 {
172 ASSERT(m_readyState == DONE); 172 ASSERT(m_readyState == DONE);
(...skipping 14 matching lines...) Expand all
187 { 187 {
188 if (!m_result) 188 if (!m_result)
189 return 0; 189 return 0;
190 if (m_result->type() == IDBAny::IDBCursorType) 190 if (m_result->type() == IDBAny::IDBCursorType)
191 return m_result->idbCursor(); 191 return m_result->idbCursor();
192 if (m_result->type() == IDBAny::IDBCursorWithValueType) 192 if (m_result->type() == IDBAny::IDBCursorWithValueType)
193 return m_result->idbCursorWithValue(); 193 return m_result->idbCursorWithValue();
194 return 0; 194 return 0;
195 } 195 }
196 196
197 void IDBRequest::setResultCursor(IDBCursor* cursor, IDBKey* key, IDBKey* primary Key, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<blink::WebBlobInfo> > blo bInfo) 197 void IDBRequest::setResultCursor(IDBCursor* cursor, IDBKey* key, IDBKey* primary Key, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo> > blobInfo)
198 { 198 {
199 ASSERT(m_readyState == PENDING); 199 ASSERT(m_readyState == PENDING);
200 m_cursorKey = key; 200 m_cursorKey = key;
201 m_cursorPrimaryKey = primaryKey; 201 m_cursorPrimaryKey = primaryKey;
202 m_cursorValue = value; 202 m_cursorValue = value;
203 ASSERT(!m_blobInfo.get()); 203 ASSERT(!m_blobInfo.get());
204 m_blobInfo = blobInfo; 204 m_blobInfo = blobInfo;
205 205
206 onSuccessInternal(IDBAny::create(cursor)); 206 onSuccessInternal(IDBAny::create(cursor));
207 } 207 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 IDB_TRACE("IDBRequest::onSuccess(StringList)"); 243 IDB_TRACE("IDBRequest::onSuccess(StringList)");
244 if (!shouldEnqueueEvent()) 244 if (!shouldEnqueueEvent())
245 return; 245 return;
246 246
247 RefPtrWillBeRawPtr<DOMStringList> domStringList = DOMStringList::create(); 247 RefPtrWillBeRawPtr<DOMStringList> domStringList = DOMStringList::create();
248 for (size_t i = 0; i < stringList.size(); ++i) 248 for (size_t i = 0; i < stringList.size(); ++i)
249 domStringList->append(stringList[i]); 249 domStringList->append(stringList[i]);
250 onSuccessInternal(IDBAny::create(domStringList.release())); 250 onSuccessInternal(IDBAny::create(domStringList.release()));
251 } 251 }
252 252
253 void IDBRequest::onSuccess(PassOwnPtr<blink::WebIDBCursor> backend, IDBKey* key, IDBKey* primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<blink::We bBlobInfo> > blobInfo) 253 void IDBRequest::onSuccess(PassOwnPtr<WebIDBCursor> backend, IDBKey* key, IDBKey * primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo> > b lobInfo)
254 { 254 {
255 IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); 255 IDB_TRACE("IDBRequest::onSuccess(IDBCursor)");
256 if (!shouldEnqueueEvent()) 256 if (!shouldEnqueueEvent())
257 return; 257 return;
258 258
259 ASSERT(!m_pendingCursor); 259 ASSERT(!m_pendingCursor);
260 IDBCursor* cursor = 0; 260 IDBCursor* cursor = 0;
261 switch (m_cursorType) { 261 switch (m_cursorType) {
262 case IndexedDB::CursorKeyOnly: 262 case IndexedDB::CursorKeyOnly:
263 cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.ge t(), m_transaction.get()); 263 cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.ge t(), m_transaction.get());
(...skipping 12 matching lines...) Expand all
276 IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); 276 IDB_TRACE("IDBRequest::onSuccess(IDBKey)");
277 if (!shouldEnqueueEvent()) 277 if (!shouldEnqueueEvent())
278 return; 278 return;
279 279
280 if (idbKey && idbKey->isValid()) 280 if (idbKey && idbKey->isValid())
281 onSuccessInternal(IDBAny::create(idbKey)); 281 onSuccessInternal(IDBAny::create(idbKey));
282 else 282 else
283 onSuccessInternal(IDBAny::createUndefined()); 283 onSuccessInternal(IDBAny::createUndefined());
284 } 284 }
285 285
286 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> valueBuffer, PassOwnPtr<Vect or<blink::WebBlobInfo> > blobInfo) 286 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> valueBuffer, PassOwnPtr<Vect or<WebBlobInfo> > blobInfo)
287 { 287 {
288 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer)"); 288 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer)");
289 if (!shouldEnqueueEvent()) 289 if (!shouldEnqueueEvent())
290 return; 290 return;
291 291
292 if (m_pendingCursor) { 292 if (m_pendingCursor) {
293 // Value should be null, signifying the end of the cursor's range. 293 // Value should be null, signifying the end of the cursor's range.
294 ASSERT(!valueBuffer.get()); 294 ASSERT(!valueBuffer.get());
295 ASSERT(!blobInfo->size()); 295 ASSERT(!blobInfo->size());
296 m_pendingCursor->close(); 296 m_pendingCursor->close();
(...skipping 11 matching lines...) Expand all
308 if (source->type() == IDBAny::IDBObjectStoreType) 308 if (source->type() == IDBAny::IDBObjectStoreType)
309 return source->idbObjectStore(); 309 return source->idbObjectStore();
310 if (source->type() == IDBAny::IDBIndexType) 310 if (source->type() == IDBAny::IDBIndexType)
311 return source->idbIndex()->objectStore(); 311 return source->idbIndex()->objectStore();
312 312
313 ASSERT_NOT_REACHED(); 313 ASSERT_NOT_REACHED();
314 return 0; 314 return 0;
315 } 315 }
316 #endif 316 #endif
317 317
318 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassOwnPtr<V ector<blink::WebBlobInfo> > blobInfo, IDBKey* prpPrimaryKey, const IDBKeyPath& k eyPath) 318 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassOwnPtr<V ector<WebBlobInfo> > blobInfo, IDBKey* prpPrimaryKey, const IDBKeyPath& keyPath)
319 { 319 {
320 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)"); 320 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)");
321 if (!shouldEnqueueEvent()) 321 if (!shouldEnqueueEvent())
322 return; 322 return;
323 323
324 ASSERT(keyPath == effectiveObjectStore(m_source)->metadata().keyPath); 324 ASSERT(keyPath == effectiveObjectStore(m_source)->metadata().keyPath);
325 325
326 RefPtr<SharedBuffer> valueBuffer = prpValueBuffer; 326 RefPtr<SharedBuffer> valueBuffer = prpValueBuffer;
327 IDBKey* primaryKey = prpPrimaryKey; 327 IDBKey* primaryKey = prpPrimaryKey;
328 ASSERT(!m_blobInfo.get()); 328 ASSERT(!m_blobInfo.get());
(...skipping 29 matching lines...) Expand all
358 setResult(result); 358 setResult(result);
359 enqueueEvent(Event::create(EventTypeNames::success)); 359 enqueueEvent(Event::create(EventTypeNames::success));
360 } 360 }
361 361
362 void IDBRequest::setResult(IDBAny* result) 362 void IDBRequest::setResult(IDBAny* result)
363 { 363 {
364 m_result = result; 364 m_result = result;
365 m_resultDirty = true; 365 m_resultDirty = true;
366 } 366 }
367 367
368 void IDBRequest::onSuccess(IDBKey* key, IDBKey* primaryKey, PassRefPtr<SharedBuf fer> value, PassOwnPtr<Vector<blink::WebBlobInfo> > blobInfo) 368 void IDBRequest::onSuccess(IDBKey* key, IDBKey* primaryKey, PassRefPtr<SharedBuf fer> value, PassOwnPtr<Vector<WebBlobInfo> > blobInfo)
369 { 369 {
370 IDB_TRACE("IDBRequest::onSuccess(key, primaryKey, value)"); 370 IDB_TRACE("IDBRequest::onSuccess(key, primaryKey, value)");
371 if (!shouldEnqueueEvent()) 371 if (!shouldEnqueueEvent())
372 return; 372 return;
373 373
374 ASSERT(m_pendingCursor); 374 ASSERT(m_pendingCursor);
375 setResultCursor(m_pendingCursor.release(), key, primaryKey, value, blobInfo) ; 375 setResultCursor(m_pendingCursor.release(), key, primaryKey, value, blobInfo) ;
376 } 376 }
377 377
378 bool IDBRequest::hasPendingActivity() const 378 bool IDBRequest::hasPendingActivity() const
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 void IDBRequest::dequeueEvent(Event* event) 538 void IDBRequest::dequeueEvent(Event* event)
539 { 539 {
540 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 540 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
541 if (m_enqueuedEvents[i].get() == event) 541 if (m_enqueuedEvents[i].get() == event)
542 m_enqueuedEvents.remove(i); 542 m_enqueuedEvents.remove(i);
543 } 543 }
544 } 544 }
545 545
546 } // namespace blink 546 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBOpenDBRequest.cpp ('k') | Source/modules/indexeddb/IDBTransaction.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698