| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/indexed_db/indexed_db_transaction.h" | 5 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 CloseOpenCursors(); | 308 CloseOpenCursors(); |
| 309 transaction_->Reset(); | 309 transaction_->Reset(); |
| 310 | 310 |
| 311 // Transactions must also be marked as completed before the | 311 // Transactions must also be marked as completed before the |
| 312 // front-end is notified, as the transaction completion unblocks | 312 // front-end is notified, as the transaction completion unblocks |
| 313 // operations like closing connections. | 313 // operations like closing connections. |
| 314 database_->transaction_coordinator().DidFinishTransaction(this); | 314 database_->transaction_coordinator().DidFinishTransaction(this); |
| 315 | 315 |
| 316 if (committed) { | 316 if (committed) { |
| 317 abort_task_stack_.clear(); | 317 abort_task_stack_.clear(); |
| 318 callbacks_->OnComplete(id_); | 318 { |
| 319 IDB_TRACE1( |
| 320 "IndexedDBTransaction::CommitPhaseTwo.TransactionCompleteCallbacks", |
| 321 "txn.id", id()); |
| 322 callbacks_->OnComplete(id_); |
| 323 } |
| 319 database_->TransactionFinished(this, true); | 324 database_->TransactionFinished(this, true); |
| 320 } else { | 325 } else { |
| 321 while (!abort_task_stack_.empty()) | 326 while (!abort_task_stack_.empty()) |
| 322 abort_task_stack_.pop().Run(NULL); | 327 abort_task_stack_.pop().Run(NULL); |
| 323 | 328 |
| 324 IndexedDBDatabaseError error; | 329 IndexedDBDatabaseError error; |
| 325 if (leveldb_env::IndicatesDiskFull(s)) { | 330 if (leveldb_env::IndicatesDiskFull(s)) { |
| 326 error = IndexedDBDatabaseError( | 331 error = IndexedDBDatabaseError( |
| 327 blink::WebIDBDatabaseExceptionQuotaError, | 332 blink::WebIDBDatabaseExceptionQuotaError, |
| 328 "Encountered disk full while committing transaction."); | 333 "Encountered disk full while committing transaction."); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return base::TimeDelta::FromSeconds(kInactivityTimeoutPeriodSeconds); | 407 return base::TimeDelta::FromSeconds(kInactivityTimeoutPeriodSeconds); |
| 403 } | 408 } |
| 404 | 409 |
| 405 void IndexedDBTransaction::Timeout() { | 410 void IndexedDBTransaction::Timeout() { |
| 406 Abort(IndexedDBDatabaseError( | 411 Abort(IndexedDBDatabaseError( |
| 407 blink::WebIDBDatabaseExceptionTimeoutError, | 412 blink::WebIDBDatabaseExceptionTimeoutError, |
| 408 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); | 413 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); |
| 409 } | 414 } |
| 410 | 415 |
| 411 void IndexedDBTransaction::CloseOpenCursors() { | 416 void IndexedDBTransaction::CloseOpenCursors() { |
| 417 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); |
| 412 for (auto* cursor : open_cursors_) | 418 for (auto* cursor : open_cursors_) |
| 413 cursor->Close(); | 419 cursor->Close(); |
| 414 open_cursors_.clear(); | 420 open_cursors_.clear(); |
| 415 } | 421 } |
| 416 | 422 |
| 417 } // namespace content | 423 } // namespace content |
| OLD | NEW |