| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (state_ == UNUSED) { | 107 if (state_ == UNUSED) { |
| 108 Start(); | 108 Start(); |
| 109 } else if (state_ == RUNNING && !should_process_queue_) { | 109 } else if (state_ == RUNNING && !should_process_queue_) { |
| 110 should_process_queue_ = true; | 110 should_process_queue_ = true; |
| 111 base::MessageLoop::current()->PostTask( | 111 base::MessageLoop::current()->PostTask( |
| 112 FROM_HERE, base::Bind(&IndexedDBTransaction::ProcessTaskQueue, this)); | 112 FROM_HERE, base::Bind(&IndexedDBTransaction::ProcessTaskQueue, this)); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 void IndexedDBTransaction::Abort() { | 116 void IndexedDBTransaction::Abort() { |
| 117 Abort(IndexedDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError, | 117 Abort(IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError, |
| 118 "Internal error (unknown cause)")); | 118 "Internal error (unknown cause)")); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) { | 121 void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) { |
| 122 IDB_TRACE("IndexedDBTransaction::Abort"); | 122 IDB_TRACE("IndexedDBTransaction::Abort"); |
| 123 if (state_ == FINISHED) | 123 if (state_ == FINISHED) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 bool was_running = state_ == RUNNING; | 126 bool was_running = state_ == RUNNING; |
| 127 | 127 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // operations like closing connections. | 246 // operations like closing connections. |
| 247 database_->transaction_coordinator().DidFinishTransaction(this); | 247 database_->transaction_coordinator().DidFinishTransaction(this); |
| 248 database_->TransactionFinished(this); | 248 database_->TransactionFinished(this); |
| 249 | 249 |
| 250 if (committed) { | 250 if (committed) { |
| 251 callbacks_->OnComplete(id_); | 251 callbacks_->OnComplete(id_); |
| 252 database_->TransactionFinishedAndCompleteFired(this); | 252 database_->TransactionFinishedAndCompleteFired(this); |
| 253 } else { | 253 } else { |
| 254 callbacks_->OnAbort( | 254 callbacks_->OnAbort( |
| 255 id_, | 255 id_, |
| 256 IndexedDBDatabaseError(WebKit::WebIDBDatabaseExceptionUnknownError, | 256 IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError, |
| 257 "Internal error committing transaction.")); | 257 "Internal error committing transaction.")); |
| 258 database_->TransactionFinishedAndAbortFired(this); | 258 database_->TransactionFinishedAndAbortFired(this); |
| 259 database_->TransactionCommitFailed(); | 259 database_->TransactionCommitFailed(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 database_ = NULL; | 262 database_ = NULL; |
| 263 } | 263 } |
| 264 | 264 |
| 265 void IndexedDBTransaction::ProcessTaskQueue() { | 265 void IndexedDBTransaction::ProcessTaskQueue() { |
| 266 IDB_TRACE("IndexedDBTransaction::ProcessTaskQueue"); | 266 IDB_TRACE("IndexedDBTransaction::ProcessTaskQueue"); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 void IndexedDBTransaction::CloseOpenCursors() { | 307 void IndexedDBTransaction::CloseOpenCursors() { |
| 308 for (std::set<IndexedDBCursor*>::iterator i = open_cursors_.begin(); | 308 for (std::set<IndexedDBCursor*>::iterator i = open_cursors_.begin(); |
| 309 i != open_cursors_.end(); | 309 i != open_cursors_.end(); |
| 310 ++i) | 310 ++i) |
| 311 (*i)->Close(); | 311 (*i)->Close(); |
| 312 open_cursors_.clear(); | 312 open_cursors_.clear(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace content | 315 } // namespace content |
| OLD | NEW |