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

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

Issue 134503003: Revert 244240 "IndexedDBFactory now ForceCloses databases." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 <set> 8 #include <set>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 } 1582 }
1583 metadata_.version = kNoStringVersion; 1583 metadata_.version = kNoStringVersion;
1584 metadata_.id = kInvalidId; 1584 metadata_.id = kInvalidId;
1585 metadata_.int_version = IndexedDBDatabaseMetadata::NO_INT_VERSION; 1585 metadata_.int_version = IndexedDBDatabaseMetadata::NO_INT_VERSION;
1586 metadata_.object_stores.clear(); 1586 metadata_.object_stores.clear();
1587 callbacks->OnSuccess(); 1587 callbacks->OnSuccess();
1588 if (factory_) 1588 if (factory_)
1589 factory_->DatabaseDeleted(identifier_); 1589 factory_->DatabaseDeleted(identifier_);
1590 } 1590 }
1591 1591
1592 void IndexedDBDatabase::ForceClose() {
1593 // IndexedDBConnection::ForceClose() may delete this database, so hold ref.
1594 scoped_refptr<IndexedDBDatabase> protect(this);
1595 ConnectionSet::const_iterator it = connections_.begin();
1596 while (it != connections_.end()) {
1597 IndexedDBConnection* connection = *it++;
1598 connection->ForceClose();
1599 }
1600 DCHECK(connections_.empty());
1601 }
1602
1603 void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) { 1592 void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) {
1604 DCHECK(connections_.count(connection)); 1593 DCHECK(connections_.count(connection));
1605 DCHECK(connection->IsConnected()); 1594 DCHECK(connection->IsConnected());
1606 DCHECK(connection->database() == this); 1595 DCHECK(connection->database() == this);
1607 1596
1608 // Abort outstanding transactions from the closing connection. This 1597 // Abort outstanding transactions from the closing connection. This
1609 // can not happen if the close is requested by the connection itself 1598 // can not happen if the close is requested by the connection itself
1610 // as the front-end defers the close until all transactions are 1599 // as the front-end defers the close until all transactions are
1611 // complete, but can occur on process termination or forced close. 1600 // complete, but can occur on process termination or forced close.
1612 { 1601 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 const base::string16& previous_version, 1660 const base::string16& previous_version,
1672 int64 previous_int_version, 1661 int64 previous_int_version,
1673 IndexedDBTransaction* transaction) { 1662 IndexedDBTransaction* transaction) {
1674 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 1663 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
1675 DCHECK(!transaction); 1664 DCHECK(!transaction);
1676 metadata_.version = previous_version; 1665 metadata_.version = previous_version;
1677 metadata_.int_version = previous_int_version; 1666 metadata_.int_version = previous_int_version;
1678 } 1667 }
1679 1668
1680 } // namespace content 1669 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/indexed_db/indexed_db_database.h ('k') | trunk/src/content/browser/indexed_db/indexed_db_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698