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 <vector> | 7 #include <vector> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 10 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
11 #include "content/browser/indexed_db/indexed_db_cursor.h" | 11 #include "content/browser/indexed_db/indexed_db_cursor.h" |
12 #include "content/browser/indexed_db/indexed_db_database.h" | 12 #include "content/browser/indexed_db/indexed_db_database.h" |
13 #include "content/browser/indexed_db/indexed_db_database_callbacks_wrapper.h" | 13 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
14 #include "content/browser/indexed_db/indexed_db_tracing.h" | 14 #include "content/browser/indexed_db/indexed_db_tracing.h" |
15 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 15 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
16 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" | 16 #include "third_party/WebKit/public/platform/WebIDBDatabaseException.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 IndexedDBTransaction::TaskQueue::TaskQueue() {} | 20 IndexedDBTransaction::TaskQueue::TaskQueue() {} |
21 IndexedDBTransaction::TaskQueue::~TaskQueue() { clear(); } | 21 IndexedDBTransaction::TaskQueue::~TaskQueue() { clear(); } |
22 | 22 |
23 void IndexedDBTransaction::TaskQueue::clear() { | 23 void IndexedDBTransaction::TaskQueue::clear() { |
(...skipping 20 matching lines...) Expand all Loading... |
44 scoped_ptr<IndexedDBTransaction::Operation> | 44 scoped_ptr<IndexedDBTransaction::Operation> |
45 IndexedDBTransaction::TaskStack::pop() { | 45 IndexedDBTransaction::TaskStack::pop() { |
46 DCHECK(!stack_.empty()); | 46 DCHECK(!stack_.empty()); |
47 scoped_ptr<Operation> task(stack_.top()); | 47 scoped_ptr<Operation> task(stack_.top()); |
48 stack_.pop(); | 48 stack_.pop(); |
49 return task.Pass(); | 49 return task.Pass(); |
50 } | 50 } |
51 | 51 |
52 scoped_refptr<IndexedDBTransaction> IndexedDBTransaction::Create( | 52 scoped_refptr<IndexedDBTransaction> IndexedDBTransaction::Create( |
53 int64 id, | 53 int64 id, |
54 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks, | 54 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
55 const std::vector<int64>& object_store_ids, | 55 const std::vector<int64>& object_store_ids, |
56 indexed_db::TransactionMode mode, | 56 indexed_db::TransactionMode mode, |
57 IndexedDBDatabase* database) { | 57 IndexedDBDatabase* database) { |
58 std::set<int64> object_store_hash_set; | 58 std::set<int64> object_store_hash_set; |
59 for (size_t i = 0; i < object_store_ids.size(); ++i) | 59 for (size_t i = 0; i < object_store_ids.size(); ++i) |
60 object_store_hash_set.insert(object_store_ids[i]); | 60 object_store_hash_set.insert(object_store_ids[i]); |
61 | 61 |
62 return make_scoped_refptr(new IndexedDBTransaction( | 62 return make_scoped_refptr(new IndexedDBTransaction( |
63 id, callbacks, object_store_hash_set, mode, database)); | 63 id, callbacks, object_store_hash_set, mode, database)); |
64 } | 64 } |
65 | 65 |
66 IndexedDBTransaction::IndexedDBTransaction( | 66 IndexedDBTransaction::IndexedDBTransaction( |
67 int64 id, | 67 int64 id, |
68 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks, | 68 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
69 const std::set<int64>& object_store_ids, | 69 const std::set<int64>& object_store_ids, |
70 indexed_db::TransactionMode mode, | 70 indexed_db::TransactionMode mode, |
71 IndexedDBDatabase* database) | 71 IndexedDBDatabase* database) |
72 : id_(id), | 72 : id_(id), |
73 object_store_ids_(object_store_ids), | 73 object_store_ids_(object_store_ids), |
74 mode_(mode), | 74 mode_(mode), |
75 state_(UNUSED), | 75 state_(UNUSED), |
76 commit_pending_(false), | 76 commit_pending_(false), |
77 callbacks_(callbacks), | 77 callbacks_(callbacks), |
78 database_(database), | 78 database_(database), |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 void IndexedDBTransaction::CloseOpenCursors() { | 298 void IndexedDBTransaction::CloseOpenCursors() { |
299 for (std::set<IndexedDBCursor*>::iterator i = open_cursors_.begin(); | 299 for (std::set<IndexedDBCursor*>::iterator i = open_cursors_.begin(); |
300 i != open_cursors_.end(); | 300 i != open_cursors_.end(); |
301 ++i) | 301 ++i) |
302 (*i)->Close(); | 302 (*i)->Close(); |
303 open_cursors_.clear(); | 303 open_cursors_.clear(); |
304 } | 304 } |
305 | 305 |
306 } // namespace content | 306 } // namespace content |
OLD | NEW |