| 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/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 10 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/thread_task_runner_handle.h" |
| 11 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 13 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 12 #include "content/browser/indexed_db/indexed_db_cursor.h" | 14 #include "content/browser/indexed_db/indexed_db_cursor.h" |
| 13 #include "content/browser/indexed_db/indexed_db_database.h" | 15 #include "content/browser/indexed_db/indexed_db_database.h" |
| 14 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 16 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
| 15 #include "content/browser/indexed_db/indexed_db_tracing.h" | 17 #include "content/browser/indexed_db/indexed_db_tracing.h" |
| 16 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 18 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
| 17 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" | 19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" |
| 18 #include "third_party/leveldatabase/env_chromium.h" | 20 #include "third_party/leveldatabase/env_chromium.h" |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 117 |
| 116 // Not started by the coordinator yet. | 118 // Not started by the coordinator yet. |
| 117 if (state_ != STARTED) | 119 if (state_ != STARTED) |
| 118 return; | 120 return; |
| 119 | 121 |
| 120 // A task is already posted. | 122 // A task is already posted. |
| 121 if (should_process_queue_) | 123 if (should_process_queue_) |
| 122 return; | 124 return; |
| 123 | 125 |
| 124 should_process_queue_ = true; | 126 should_process_queue_ = true; |
| 125 base::MessageLoop::current()->PostTask( | 127 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 126 FROM_HERE, base::Bind(&IndexedDBTransaction::ProcessTaskQueue, this)); | 128 FROM_HERE, base::Bind(&IndexedDBTransaction::ProcessTaskQueue, this)); |
| 127 } | 129 } |
| 128 | 130 |
| 129 void IndexedDBTransaction::Abort() { | 131 void IndexedDBTransaction::Abort() { |
| 130 Abort(IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError, | 132 Abort(IndexedDBDatabaseError(blink::WebIDBDatabaseExceptionUnknownError, |
| 131 "Internal error (unknown cause)")); | 133 "Internal error (unknown cause)")); |
| 132 } | 134 } |
| 133 | 135 |
| 134 void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) { | 136 void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) { |
| 135 IDB_TRACE1("IndexedDBTransaction::Abort", "txn.id", id()); | 137 IDB_TRACE1("IndexedDBTransaction::Abort", "txn.id", id()); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); | 406 base::ASCIIToUTF16("Transaction timed out due to inactivity."))); |
| 405 } | 407 } |
| 406 | 408 |
| 407 void IndexedDBTransaction::CloseOpenCursors() { | 409 void IndexedDBTransaction::CloseOpenCursors() { |
| 408 for (auto* cursor : open_cursors_) | 410 for (auto* cursor : open_cursors_) |
| 409 cursor->Close(); | 411 cursor->Close(); |
| 410 open_cursors_.clear(); | 412 open_cursors_.clear(); |
| 411 } | 413 } |
| 412 | 414 |
| 413 } // namespace content | 415 } // namespace content |
| OLD | NEW |