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