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

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

Issue 2691423005: [IndexedDB] Transaction limitting (Closed)
Patch Set: comment change 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..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:
« 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