| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 DCHECK(ready_state_ == PENDING || ready_state_ == DONE); | 234 DCHECK(ready_state_ == PENDING || ready_state_ == DONE); |
| 235 if (request_aborted_) | 235 if (request_aborted_) |
| 236 return false; | 236 return false; |
| 237 DCHECK_EQ(ready_state_, PENDING); | 237 DCHECK_EQ(ready_state_, PENDING); |
| 238 DCHECK(!error_ && !result_); | 238 DCHECK(!error_ && !result_); |
| 239 return true; | 239 return true; |
| 240 } | 240 } |
| 241 | 241 |
| 242 void IDBRequest::OnError(DOMException* error) { | 242 void IDBRequest::OnError(DOMException* error) { |
| 243 IDB_TRACE("IDBRequest::onError()"); | 243 IDB_TRACE("IDBRequest::onError()"); |
| 244 ClearPutOperationBlobs(); |
| 244 if (!ShouldEnqueueEvent()) | 245 if (!ShouldEnqueueEvent()) |
| 245 return; | 246 return; |
| 246 | 247 |
| 247 error_ = error; | 248 error_ = error; |
| 248 SetResult(IDBAny::CreateUndefined()); | 249 SetResult(IDBAny::CreateUndefined()); |
| 249 pending_cursor_.Clear(); | 250 pending_cursor_.Clear(); |
| 250 EnqueueEvent(Event::CreateCancelableBubble(EventTypeNames::error)); | 251 EnqueueEvent(Event::CreateCancelableBubble(EventTypeNames::error)); |
| 251 } | 252 } |
| 252 | 253 |
| 253 void IDBRequest::OnSuccess(const Vector<String>& string_list) { | 254 void IDBRequest::OnSuccess(const Vector<String>& string_list) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 282 this, source_.Get(), transaction_.Get()); | 283 this, source_.Get(), transaction_.Get()); |
| 283 break; | 284 break; |
| 284 default: | 285 default: |
| 285 NOTREACHED(); | 286 NOTREACHED(); |
| 286 } | 287 } |
| 287 SetResultCursor(cursor, key, primary_key, std::move(value)); | 288 SetResultCursor(cursor, key, primary_key, std::move(value)); |
| 288 } | 289 } |
| 289 | 290 |
| 290 void IDBRequest::OnSuccess(IDBKey* idb_key) { | 291 void IDBRequest::OnSuccess(IDBKey* idb_key) { |
| 291 IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); | 292 IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); |
| 293 ClearPutOperationBlobs(); |
| 292 if (!ShouldEnqueueEvent()) | 294 if (!ShouldEnqueueEvent()) |
| 293 return; | 295 return; |
| 294 | 296 |
| 295 if (idb_key && idb_key->IsValid()) | 297 if (idb_key && idb_key->IsValid()) |
| 296 OnSuccessInternal(IDBAny::Create(idb_key)); | 298 OnSuccessInternal(IDBAny::Create(idb_key)); |
| 297 else | 299 else |
| 298 OnSuccessInternal(IDBAny::CreateUndefined()); | 300 OnSuccessInternal(IDBAny::CreateUndefined()); |
| 299 } | 301 } |
| 300 | 302 |
| 301 void IDBRequest::OnSuccess(const Vector<RefPtr<IDBValue>>& values) { | 303 void IDBRequest::OnSuccess(const Vector<RefPtr<IDBValue>>& values) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 void IDBRequest::OnSuccess() { | 355 void IDBRequest::OnSuccess() { |
| 354 IDB_TRACE("IDBRequest::onSuccess()"); | 356 IDB_TRACE("IDBRequest::onSuccess()"); |
| 355 if (!ShouldEnqueueEvent()) | 357 if (!ShouldEnqueueEvent()) |
| 356 return; | 358 return; |
| 357 OnSuccessInternal(IDBAny::CreateUndefined()); | 359 OnSuccessInternal(IDBAny::CreateUndefined()); |
| 358 } | 360 } |
| 359 | 361 |
| 360 void IDBRequest::OnSuccessInternal(IDBAny* result) { | 362 void IDBRequest::OnSuccessInternal(IDBAny* result) { |
| 361 DCHECK(GetExecutionContext()); | 363 DCHECK(GetExecutionContext()); |
| 362 DCHECK(!pending_cursor_); | 364 DCHECK(!pending_cursor_); |
| 365 DCHECK(transit_blob_handles_.IsEmpty()); |
| 363 SetResult(result); | 366 SetResult(result); |
| 364 EnqueueEvent(Event::Create(EventTypeNames::success)); | 367 EnqueueEvent(Event::Create(EventTypeNames::success)); |
| 365 } | 368 } |
| 366 | 369 |
| 367 void IDBRequest::SetResult(IDBAny* result) { | 370 void IDBRequest::SetResult(IDBAny* result) { |
| 368 result_ = result; | 371 result_ = result; |
| 369 result_dirty_ = true; | 372 result_dirty_ = true; |
| 370 } | 373 } |
| 371 | 374 |
| 372 void IDBRequest::OnSuccess(IDBKey* key, | 375 void IDBRequest::OnSuccess(IDBKey* key, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 556 } |
| 554 | 557 |
| 555 void IDBRequest::DequeueEvent(Event* event) { | 558 void IDBRequest::DequeueEvent(Event* event) { |
| 556 for (size_t i = 0; i < enqueued_events_.size(); ++i) { | 559 for (size_t i = 0; i < enqueued_events_.size(); ++i) { |
| 557 if (enqueued_events_[i].Get() == event) | 560 if (enqueued_events_[i].Get() == event) |
| 558 enqueued_events_.erase(i); | 561 enqueued_events_.erase(i); |
| 559 } | 562 } |
| 560 } | 563 } |
| 561 | 564 |
| 562 } // namespace blink | 565 } // namespace blink |
| OLD | NEW |