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

Side by Side Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 1671193003: Indexed DB: Remove transaction throttle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_database.h" 5 #include "content/browser/indexed_db/indexed_db_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 IDB_TRACE1("IndexedDBDatabase::CreateTransaction", "txn.id", transaction_id); 1665 IDB_TRACE1("IndexedDBDatabase::CreateTransaction", "txn.id", transaction_id);
1666 DCHECK(connections_.count(connection)); 1666 DCHECK(connections_.count(connection));
1667 DCHECK(transactions_.find(transaction_id) == transactions_.end()); 1667 DCHECK(transactions_.find(transaction_id) == transactions_.end());
1668 if (transactions_.find(transaction_id) != transactions_.end()) 1668 if (transactions_.find(transaction_id) != transactions_.end())
1669 return; 1669 return;
1670 1670
1671 UMA_HISTOGRAM_COUNTS_1000( 1671 UMA_HISTOGRAM_COUNTS_1000(
1672 "WebCore.IndexedDB.Database.OutstandingTransactionCount", 1672 "WebCore.IndexedDB.Database.OutstandingTransactionCount",
1673 transactions_.size()); 1673 transactions_.size());
1674 1674
1675 // Throttle transaction creation so that a renderer in a tight loop can't
1676 // cause browser memory to grow unbounded by creating transactions faster
1677 // than they can be processed.
1678 const size_t kMaxTransactionCount = 256;
1679 if (transactions_.size() >= kMaxTransactionCount) {
1680 connection->callbacks()->OnAbort(
1681 transaction_id, IndexedDBDatabaseError(
1682 blink::WebIDBDatabaseExceptionUnknownError,
1683 "Internal error: Too many transactions queued."));
1684 return;
1685 }
1686
1687 // The transaction will add itself to this database's coordinator, which 1675 // The transaction will add itself to this database's coordinator, which
1688 // manages the lifetime of the object. 1676 // manages the lifetime of the object.
1689 TransactionCreated(IndexedDBClassFactory::Get()->CreateIndexedDBTransaction( 1677 TransactionCreated(IndexedDBClassFactory::Get()->CreateIndexedDBTransaction(
1690 transaction_id, connection->callbacks(), 1678 transaction_id, connection->callbacks(),
1691 std::set<int64_t>(object_store_ids.begin(), object_store_ids.end()), mode, 1679 std::set<int64_t>(object_store_ids.begin(), object_store_ids.end()), mode,
1692 this, new IndexedDBBackingStore::Transaction(backing_store_.get()))); 1680 this, new IndexedDBBackingStore::Transaction(backing_store_.get())));
1693 } 1681 }
1694 1682
1695 void IndexedDBDatabase::TransactionCreated(IndexedDBTransaction* transaction) { 1683 void IndexedDBDatabase::TransactionCreated(IndexedDBTransaction* transaction) {
1696 transactions_[transaction->id()] = transaction; 1684 transactions_[transaction->id()] = transaction;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 const base::string16& previous_version, 1968 const base::string16& previous_version,
1981 int64_t previous_int_version, 1969 int64_t previous_int_version,
1982 IndexedDBTransaction* transaction) { 1970 IndexedDBTransaction* transaction) {
1983 DCHECK(!transaction); 1971 DCHECK(!transaction);
1984 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 1972 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
1985 metadata_.version = previous_version; 1973 metadata_.version = previous_version;
1986 metadata_.int_version = previous_int_version; 1974 metadata_.int_version = previous_int_version;
1987 } 1975 }
1988 1976
1989 } // namespace content 1977 } // namespace content
OLDNEW
« 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