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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 { | 185 { |
186 if (!m_result) | 186 if (!m_result) |
187 return 0; | 187 return 0; |
188 if (m_result->type() == IDBAny::IDBCursorType) | 188 if (m_result->type() == IDBAny::IDBCursorType) |
189 return m_result->idbCursor(); | 189 return m_result->idbCursor(); |
190 if (m_result->type() == IDBAny::IDBCursorWithValueType) | 190 if (m_result->type() == IDBAny::IDBCursorWithValueType) |
191 return m_result->idbCursorWithValue(); | 191 return m_result->idbCursorWithValue(); |
192 return 0; | 192 return 0; |
193 } | 193 } |
194 | 194 |
195 void IDBRequest::setResultCursor(IDBCursor* cursor, IDBKey* key, IDBKey* primary
Key, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo> > blobInfo) | 195 void IDBRequest::setResultCursor(IDBCursor* cursor, IDBKey* key, IDBKey* primary
Key, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo>> blobInfo) |
196 { | 196 { |
197 ASSERT(m_readyState == PENDING); | 197 ASSERT(m_readyState == PENDING); |
198 m_cursorKey = key; | 198 m_cursorKey = key; |
199 m_cursorPrimaryKey = primaryKey; | 199 m_cursorPrimaryKey = primaryKey; |
200 m_cursorValue = value; | 200 m_cursorValue = value; |
201 setBlobInfo(blobInfo); | 201 setBlobInfo(blobInfo); |
202 | 202 |
203 onSuccessInternal(IDBAny::create(cursor)); | 203 onSuccessInternal(IDBAny::create(cursor)); |
204 } | 204 } |
205 | 205 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 IDB_TRACE("IDBRequest::onSuccess(StringList)"); | 237 IDB_TRACE("IDBRequest::onSuccess(StringList)"); |
238 if (!shouldEnqueueEvent()) | 238 if (!shouldEnqueueEvent()) |
239 return; | 239 return; |
240 | 240 |
241 RefPtrWillBeRawPtr<DOMStringList> domStringList = DOMStringList::create(); | 241 RefPtrWillBeRawPtr<DOMStringList> domStringList = DOMStringList::create(); |
242 for (size_t i = 0; i < stringList.size(); ++i) | 242 for (size_t i = 0; i < stringList.size(); ++i) |
243 domStringList->append(stringList[i]); | 243 domStringList->append(stringList[i]); |
244 onSuccessInternal(IDBAny::create(domStringList.release())); | 244 onSuccessInternal(IDBAny::create(domStringList.release())); |
245 } | 245 } |
246 | 246 |
247 void IDBRequest::onSuccess(PassOwnPtr<WebIDBCursor> backend, IDBKey* key, IDBKey
* primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo> > b
lobInfo) | 247 void IDBRequest::onSuccess(PassOwnPtr<WebIDBCursor> backend, IDBKey* key, IDBKey
* primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<WebBlobInfo>> bl
obInfo) |
248 { | 248 { |
249 IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); | 249 IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); |
250 if (!shouldEnqueueEvent()) | 250 if (!shouldEnqueueEvent()) |
251 return; | 251 return; |
252 | 252 |
253 ASSERT(!m_pendingCursor); | 253 ASSERT(!m_pendingCursor); |
254 IDBCursor* cursor = 0; | 254 IDBCursor* cursor = 0; |
255 switch (m_cursorType) { | 255 switch (m_cursorType) { |
256 case IndexedDB::CursorKeyOnly: | 256 case IndexedDB::CursorKeyOnly: |
257 cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.ge
t(), m_transaction.get()); | 257 cursor = IDBCursor::create(backend, m_cursorDirection, this, m_source.ge
t(), m_transaction.get()); |
(...skipping 12 matching lines...) Expand all Loading... |
270 IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); | 270 IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); |
271 if (!shouldEnqueueEvent()) | 271 if (!shouldEnqueueEvent()) |
272 return; | 272 return; |
273 | 273 |
274 if (idbKey && idbKey->isValid()) | 274 if (idbKey && idbKey->isValid()) |
275 onSuccessInternal(IDBAny::create(idbKey)); | 275 onSuccessInternal(IDBAny::create(idbKey)); |
276 else | 276 else |
277 onSuccessInternal(IDBAny::createUndefined()); | 277 onSuccessInternal(IDBAny::createUndefined()); |
278 } | 278 } |
279 | 279 |
280 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> valueBuffer, PassOwnPtr<Vect
or<WebBlobInfo> > blobInfo) | 280 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> valueBuffer, PassOwnPtr<Vect
or<WebBlobInfo>> blobInfo) |
281 { | 281 { |
282 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer)"); | 282 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer)"); |
283 if (!shouldEnqueueEvent()) | 283 if (!shouldEnqueueEvent()) |
284 return; | 284 return; |
285 | 285 |
286 if (m_pendingCursor) { | 286 if (m_pendingCursor) { |
287 // Value should be null, signifying the end of the cursor's range. | 287 // Value should be null, signifying the end of the cursor's range. |
288 ASSERT(!valueBuffer.get()); | 288 ASSERT(!valueBuffer.get()); |
289 ASSERT(!blobInfo->size()); | 289 ASSERT(!blobInfo->size()); |
290 m_pendingCursor->close(); | 290 m_pendingCursor->close(); |
(...skipping 10 matching lines...) Expand all Loading... |
301 if (source->type() == IDBAny::IDBObjectStoreType) | 301 if (source->type() == IDBAny::IDBObjectStoreType) |
302 return source->idbObjectStore(); | 302 return source->idbObjectStore(); |
303 if (source->type() == IDBAny::IDBIndexType) | 303 if (source->type() == IDBAny::IDBIndexType) |
304 return source->idbIndex()->objectStore(); | 304 return source->idbIndex()->objectStore(); |
305 | 305 |
306 ASSERT_NOT_REACHED(); | 306 ASSERT_NOT_REACHED(); |
307 return 0; | 307 return 0; |
308 } | 308 } |
309 #endif | 309 #endif |
310 | 310 |
311 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassOwnPtr<V
ector<WebBlobInfo> > blobInfo, IDBKey* prpPrimaryKey, const IDBKeyPath& keyPath) | 311 void IDBRequest::onSuccess(PassRefPtr<SharedBuffer> prpValueBuffer, PassOwnPtr<V
ector<WebBlobInfo>> blobInfo, IDBKey* prpPrimaryKey, const IDBKeyPath& keyPath) |
312 { | 312 { |
313 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)"); | 313 IDB_TRACE("IDBRequest::onSuccess(SharedBuffer, IDBKey, IDBKeyPath)"); |
314 if (!shouldEnqueueEvent()) | 314 if (!shouldEnqueueEvent()) |
315 return; | 315 return; |
316 | 316 |
317 ASSERT(keyPath == effectiveObjectStore(m_source)->metadata().keyPath); | 317 ASSERT(keyPath == effectiveObjectStore(m_source)->metadata().keyPath); |
318 | 318 |
319 RefPtr<SharedBuffer> valueBuffer = prpValueBuffer; | 319 RefPtr<SharedBuffer> valueBuffer = prpValueBuffer; |
320 IDBKey* primaryKey = prpPrimaryKey; | 320 IDBKey* primaryKey = prpPrimaryKey; |
321 setBlobInfo(blobInfo); | 321 setBlobInfo(blobInfo); |
(...skipping 28 matching lines...) Expand all Loading... |
350 setResult(result); | 350 setResult(result); |
351 enqueueEvent(Event::create(EventTypeNames::success)); | 351 enqueueEvent(Event::create(EventTypeNames::success)); |
352 } | 352 } |
353 | 353 |
354 void IDBRequest::setResult(IDBAny* result) | 354 void IDBRequest::setResult(IDBAny* result) |
355 { | 355 { |
356 m_result = result; | 356 m_result = result; |
357 m_resultDirty = true; | 357 m_resultDirty = true; |
358 } | 358 } |
359 | 359 |
360 void IDBRequest::onSuccess(IDBKey* key, IDBKey* primaryKey, PassRefPtr<SharedBuf
fer> value, PassOwnPtr<Vector<WebBlobInfo> > blobInfo) | 360 void IDBRequest::onSuccess(IDBKey* key, IDBKey* primaryKey, PassRefPtr<SharedBuf
fer> value, PassOwnPtr<Vector<WebBlobInfo>> blobInfo) |
361 { | 361 { |
362 IDB_TRACE("IDBRequest::onSuccess(key, primaryKey, value)"); | 362 IDB_TRACE("IDBRequest::onSuccess(key, primaryKey, value)"); |
363 if (!shouldEnqueueEvent()) | 363 if (!shouldEnqueueEvent()) |
364 return; | 364 return; |
365 | 365 |
366 ASSERT(m_pendingCursor); | 366 ASSERT(m_pendingCursor); |
367 setResultCursor(m_pendingCursor.release(), key, primaryKey, value, blobInfo)
; | 367 setResultCursor(m_pendingCursor.release(), key, primaryKey, value, blobInfo)
; |
368 } | 368 } |
369 | 369 |
370 bool IDBRequest::hasPendingActivity() const | 370 bool IDBRequest::hasPendingActivity() const |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 ASSERT(m_hasPendingActivity); | 418 ASSERT(m_hasPendingActivity); |
419 ASSERT(m_enqueuedEvents.size()); | 419 ASSERT(m_enqueuedEvents.size()); |
420 ASSERT(event->target() == this); | 420 ASSERT(event->target() == this); |
421 | 421 |
422 ScriptState::Scope scope(m_scriptState.get()); | 422 ScriptState::Scope scope(m_scriptState.get()); |
423 | 423 |
424 if (event->type() != EventTypeNames::blocked) | 424 if (event->type() != EventTypeNames::blocked) |
425 m_readyState = DONE; | 425 m_readyState = DONE; |
426 dequeueEvent(event.get()); | 426 dequeueEvent(event.get()); |
427 | 427 |
428 WillBeHeapVector<RefPtrWillBeMember<EventTarget> > targets; | 428 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> targets; |
429 targets.append(this); | 429 targets.append(this); |
430 if (m_transaction && !m_preventPropagation) { | 430 if (m_transaction && !m_preventPropagation) { |
431 targets.append(m_transaction); | 431 targets.append(m_transaction); |
432 // If there ever are events that are associated with a database but | 432 // If there ever are events that are associated with a database but |
433 // that do not have a transaction, then this will not work and we need | 433 // that do not have a transaction, then this will not work and we need |
434 // this object to actually hold a reference to the database (to ensure | 434 // this object to actually hold a reference to the database (to ensure |
435 // it stays alive). | 435 // it stays alive). |
436 targets.append(m_transaction->db()); | 436 targets.append(m_transaction->db()); |
437 } | 437 } |
438 | 438 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 Vector<String> IDBRequest::IDBBlobHolder::getUUIDs() const | 548 Vector<String> IDBRequest::IDBBlobHolder::getUUIDs() const |
549 { | 549 { |
550 Vector<String> uuids; | 550 Vector<String> uuids; |
551 uuids.reserveCapacity(m_blobInfo->size()); | 551 uuids.reserveCapacity(m_blobInfo->size()); |
552 for (const auto& info : *m_blobInfo) | 552 for (const auto& info : *m_blobInfo) |
553 uuids.append(info.uuid()); | 553 uuids.append(info.uuid()); |
554 return uuids; | 554 return uuids; |
555 } | 555 } |
556 | 556 |
557 } // namespace blink | 557 } // namespace blink |
OLD | NEW |