Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: content/browser/indexed_db/indexed_db_transaction_coordinator.cc

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: Transactions working Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_coordinator.h" 5 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/indexed_db/indexed_db_transaction.h" 8 #include "content/browser/indexed_db/indexed_db_transaction.h"
9 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" 9 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 IndexedDBTransactionCoordinator::IndexedDBTransactionCoordinator() {} 13 IndexedDBTransactionCoordinator::IndexedDBTransactionCoordinator() {}
14 14
15 IndexedDBTransactionCoordinator::~IndexedDBTransactionCoordinator() { 15 IndexedDBTransactionCoordinator::~IndexedDBTransactionCoordinator() {
16 DCHECK(queued_transactions_.empty()); 16 DCHECK(queued_transactions_.empty());
17 DCHECK(started_transactions_.empty()); 17 DCHECK(started_transactions_.empty());
18 } 18 }
19 19
20 void IndexedDBTransactionCoordinator::DidCreateTransaction( 20 void IndexedDBTransactionCoordinator::DidCreateTransaction(
21 IndexedDBTransaction* transaction) { 21 IndexedDBTransaction* transaction) {
22 DCHECK(!queued_transactions_.count(transaction)); 22 DCHECK(!queued_transactions_.count(transaction));
23 DCHECK(!started_transactions_.count(transaction)); 23 DCHECK(!started_transactions_.count(transaction));
24 DCHECK_EQ(IndexedDBTransaction::CREATED, transaction->state()); 24 DCHECK_EQ(IndexedDBTransaction::CREATED, transaction->state());
25 25
26 queued_transactions_.insert(transaction); 26 queued_transactions_.insert(transaction);
27 ProcessQueuedTransactions(); 27 ProcessQueuedTransactions();
28 } 28 }
29 29
30 void IndexedDBTransactionCoordinator::DidCreateObserverTransaction(
31 IndexedDBTransaction* transaction) {
32 DCHECK(!queued_transactions_.count(transaction));
33 DCHECK(!started_transactions_.count(transaction));
34 DCHECK_EQ(IndexedDBTransaction::CREATED, transaction->state());
35
36 started_transactions_.insert_front(transaction);
37 ProcessQueuedTransactions();
38 }
39
30 void IndexedDBTransactionCoordinator::DidFinishTransaction( 40 void IndexedDBTransactionCoordinator::DidFinishTransaction(
31 IndexedDBTransaction* transaction) { 41 IndexedDBTransaction* transaction) {
32 if (queued_transactions_.count(transaction)) { 42 if (queued_transactions_.count(transaction)) {
33 DCHECK(!started_transactions_.count(transaction)); 43 DCHECK(!started_transactions_.count(transaction));
34 queued_transactions_.erase(transaction); 44 queued_transactions_.erase(transaction);
35 } else { 45 } else {
36 DCHECK(started_transactions_.count(transaction)); 46 DCHECK(started_transactions_.count(transaction));
37 started_transactions_.erase(transaction); 47 started_transactions_.erase(transaction);
38 } 48 }
39 49
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 155
146 case blink::WebIDBTransactionModeReadOnly: 156 case blink::WebIDBTransactionModeReadOnly:
147 case blink::WebIDBTransactionModeReadWrite: 157 case blink::WebIDBTransactionModeReadWrite:
148 return !DoSetsIntersect(transaction->scope(), locked_scope); 158 return !DoSetsIntersect(transaction->scope(), locked_scope);
149 } 159 }
150 NOTREACHED(); 160 NOTREACHED();
151 return false; 161 return false;
152 } 162 }
153 163
154 } // namespace content 164 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698