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..51ae0283fa00185c27b43dbc91b76496a70805fc 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 to prevent transaction trashing which can consume a ton of RAM. Ten |
+// is chosen to reduce performance regressions. |
+// TODO(dmurph): crbug.com/693260 Create better scheduling or limits. |
+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: |