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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
13 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 13 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
14 #include "content/browser/indexed_db/indexed_db_cursor.h" | 14 #include "content/browser/indexed_db/indexed_db_cursor.h" |
15 #include "content/browser/indexed_db/indexed_db_database.h" | 15 #include "content/browser/indexed_db/indexed_db_database.h" |
16 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 16 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
17 #include "content/browser/indexed_db/indexed_db_tracing.h" | 17 #include "content/browser/indexed_db/indexed_db_tracing.h" |
18 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 18 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" | 19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" |
20 #include "third_party/leveldatabase/env_chromium.h" | 20 #include "third_party/leveldatabase/env_chromium.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 const int64 kInactivityTimeoutPeriodSeconds = 60; | 24 const int64_t kInactivityTimeoutPeriodSeconds = 60; |
25 | 25 |
26 IndexedDBTransaction::TaskQueue::TaskQueue() {} | 26 IndexedDBTransaction::TaskQueue::TaskQueue() {} |
27 IndexedDBTransaction::TaskQueue::~TaskQueue() { clear(); } | 27 IndexedDBTransaction::TaskQueue::~TaskQueue() { clear(); } |
28 | 28 |
29 void IndexedDBTransaction::TaskQueue::clear() { | 29 void IndexedDBTransaction::TaskQueue::clear() { |
30 while (!queue_.empty()) | 30 while (!queue_.empty()) |
31 queue_.pop(); | 31 queue_.pop(); |
32 } | 32 } |
33 | 33 |
34 IndexedDBTransaction::Operation IndexedDBTransaction::TaskQueue::pop() { | 34 IndexedDBTransaction::Operation IndexedDBTransaction::TaskQueue::pop() { |
(...skipping 12 matching lines...) Expand all Loading... |
47 } | 47 } |
48 | 48 |
49 IndexedDBTransaction::Operation IndexedDBTransaction::TaskStack::pop() { | 49 IndexedDBTransaction::Operation IndexedDBTransaction::TaskStack::pop() { |
50 DCHECK(!stack_.empty()); | 50 DCHECK(!stack_.empty()); |
51 Operation task(stack_.top()); | 51 Operation task(stack_.top()); |
52 stack_.pop(); | 52 stack_.pop(); |
53 return task; | 53 return task; |
54 } | 54 } |
55 | 55 |
56 IndexedDBTransaction::IndexedDBTransaction( | 56 IndexedDBTransaction::IndexedDBTransaction( |
57 int64 id, | 57 int64_t id, |
58 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, | 58 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
59 const std::set<int64>& object_store_ids, | 59 const std::set<int64_t>& object_store_ids, |
60 blink::WebIDBTransactionMode mode, | 60 blink::WebIDBTransactionMode mode, |
61 IndexedDBDatabase* database, | 61 IndexedDBDatabase* database, |
62 IndexedDBBackingStore::Transaction* backing_store_transaction) | 62 IndexedDBBackingStore::Transaction* backing_store_transaction) |
63 : id_(id), | 63 : id_(id), |
64 object_store_ids_(object_store_ids), | 64 object_store_ids_(object_store_ids), |
65 mode_(mode), | 65 mode_(mode), |
66 used_(false), | 66 used_(false), |
67 state_(CREATED), | 67 state_(CREATED), |
68 commit_pending_(false), | 68 commit_pending_(false), |
69 callbacks_(callbacks), | 69 callbacks_(callbacks), |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 414 } |
415 | 415 |
416 void IndexedDBTransaction::CloseOpenCursors() { | 416 void IndexedDBTransaction::CloseOpenCursors() { |
417 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); | 417 IDB_TRACE1("IndexedDBTransaction::CloseOpenCursors", "txn.id", id()); |
418 for (auto* cursor : open_cursors_) | 418 for (auto* cursor : open_cursors_) |
419 cursor->Close(); | 419 cursor->Close(); |
420 open_cursors_.clear(); | 420 open_cursors_.clear(); |
421 } | 421 } |
422 | 422 |
423 } // namespace content | 423 } // namespace content |
OLD | NEW |