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

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

Issue 2691423005: [IndexedDB] Transaction limitting (Closed)
Patch Set: more explanation Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_transaction_coordinator.cc
diff --git a/content/browser/indexed_db/indexed_db_transaction_coordinator.cc b/content/browser/indexed_db/indexed_db_transaction_coordinator.cc
index 80345303ab195efadd7a765b33fb8d8b154033b1..3f7fd4677880796d18693e206e4541b0585f17d9 100644
--- a/content/browser/indexed_db/indexed_db_transaction_coordinator.cc
+++ b/content/browser/indexed_db/indexed_db_transaction_coordinator.cc
@@ -9,6 +9,15 @@
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
namespace content {
+namespace {
+
+// Only this many transactions can be active at any time before they are queued.
+// Limited prevent transaction trashing. Ten is chosen to reduce performance
cmumford 2017/02/16 23:36:14 "Limited to prevent"
pwnall 2017/02/16 23:38:28 Is this accurate? I thought we're limiting txns to
dmurph 2017/02/16 23:50:27 That's a side effect of the transaction trashing.
+// regressions.
+// TODO(dmurph): Choose this number better, or implement a scheduler.
pwnall 2017/02/16 23:38:28 crbug in the todo?
dmurph 2017/02/16 23:50:27 Done.
+static const size_t kMaxStartedTransactions = 10;
+
+} // namespace
IndexedDBTransactionCoordinator::IndexedDBTransactionCoordinator() {}
@@ -146,6 +155,9 @@ static bool DoSetsIntersect(const std::set<T>& set1,
bool IndexedDBTransactionCoordinator::CanStartTransaction(
IndexedDBTransaction* const transaction,
const std::set<int64_t>& locked_scope) const {
+ if (started_transactions_.size() >= kMaxStartedTransactions) {
+ return false;
+ }
DCHECK(queued_transactions_.count(transaction));
switch (transaction->mode()) {
case blink::WebIDBTransactionModeVersionChange:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698