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

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: added comments and bug link 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 // Observer transactions jump to the front of the queue.
31 void IndexedDBTransactionCoordinator::DidCreateObserverTransaction(
32 IndexedDBTransaction* transaction) {
33 DCHECK(!queued_transactions_.count(transaction));
34 DCHECK(!started_transactions_.count(transaction));
35 DCHECK_EQ(IndexedDBTransaction::CREATED, transaction->state());
36
37 started_transactions_.insert_front(transaction);
38 ProcessQueuedTransactions();
39 }
40
30 void IndexedDBTransactionCoordinator::DidFinishTransaction( 41 void IndexedDBTransactionCoordinator::DidFinishTransaction(
31 IndexedDBTransaction* transaction) { 42 IndexedDBTransaction* transaction) {
32 if (queued_transactions_.count(transaction)) { 43 if (queued_transactions_.count(transaction)) {
33 DCHECK(!started_transactions_.count(transaction)); 44 DCHECK(!started_transactions_.count(transaction));
34 queued_transactions_.erase(transaction); 45 queued_transactions_.erase(transaction);
35 } else { 46 } else {
36 DCHECK(started_transactions_.count(transaction)); 47 DCHECK(started_transactions_.count(transaction));
37 started_transactions_.erase(transaction); 48 started_transactions_.erase(transaction);
38 } 49 }
39 50
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 156
146 case blink::WebIDBTransactionModeReadOnly: 157 case blink::WebIDBTransactionModeReadOnly:
147 case blink::WebIDBTransactionModeReadWrite: 158 case blink::WebIDBTransactionModeReadWrite:
148 return !DoSetsIntersect(transaction->scope(), locked_scope); 159 return !DoSetsIntersect(transaction->scope(), locked_scope);
149 } 160 }
150 NOTREACHED(); 161 NOTREACHED();
151 return false; 162 return false;
152 } 163 }
153 164
154 } // namespace content 165 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction_coordinator.h ('k') | content/browser/indexed_db/list_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698