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

Unified Diff: content/browser/indexed_db/indexed_db_transaction_coordinator.h

Issue 15564008: Migrate the IndexedDB backend from Blink to Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to ToT again Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_transaction_coordinator.h
diff --git a/content/browser/indexed_db/indexed_db_transaction_coordinator.h b/content/browser/indexed_db/indexed_db_transaction_coordinator.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e01e9e2963a58125534f9d84580b5b62ce10cc3
--- /dev/null
+++ b/content/browser/indexed_db/indexed_db_transaction_coordinator.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_
+#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_
+
+#include <map>
+#include <set>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/indexed_db/list_set.h"
+
+namespace content {
+
+class IndexedDBTransaction;
+
+// Transactions are executed in the order the were created.
+class IndexedDBTransactionCoordinator {
+ public:
+ IndexedDBTransactionCoordinator();
+ ~IndexedDBTransactionCoordinator();
+
+ // Called by transactions as they start and finish.
+ void DidCreateTransaction(IndexedDBTransaction* transaction);
+ void DidStartTransaction(IndexedDBTransaction* transaction);
+ void DidFinishTransaction(IndexedDBTransaction* transaction);
+
+#ifndef NDEBUG
+ bool IsActive(IndexedDBTransaction* transaction);
+#endif
+
+ // TODO(jsbell): API to handle closed connections. http://crbug.com/241821
+
+ private:
+ void ProcessStartedTransactions();
+ bool CanRunTransaction(IndexedDBTransaction* transaction);
+
+ // This is just an efficient way to keep references to all transactions.
+ std::map<IndexedDBTransaction*, scoped_refptr<IndexedDBTransaction> >
+ transactions_;
+ // Transactions in different states are grouped below.
+ list_set<IndexedDBTransaction*> queued_transactions_;
+ std::set<IndexedDBTransaction*> started_transactions_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_COORDINATOR_H_
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction.cc ('k') | content/browser/indexed_db/indexed_db_transaction_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698