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

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

Issue 93873017: IndexedDBFactory now ForceCloses databases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up iterator usage, removed local copy of conns. 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
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 while (!connections_.empty())
jsbell 2014/01/06 22:33:50 If we ever break IndexedDBConnect::ForceClose() so
cmumford 2014/01/09 00:48:25 Done.
1596 (*connections_.begin())->ForceClose();
1597 }
1598
1592 void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) { 1599 void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) {
1593 DCHECK(connections_.count(connection)); 1600 DCHECK(connections_.count(connection));
1594 DCHECK(connection->IsConnected()); 1601 DCHECK(connection->IsConnected());
1595 DCHECK(connection->database() == this); 1602 DCHECK(connection->database() == this);
1596 1603
1597 // Abort outstanding transactions from the closing connection. This 1604 // Abort outstanding transactions from the closing connection. This
1598 // can not happen if the close is requested by the connection itself 1605 // can not happen if the close is requested by the connection itself
1599 // as the front-end defers the close until all transactions are 1606 // as the front-end defers the close until all transactions are
1600 // complete, but can occur on process termination or forced close. 1607 // complete, but can occur on process termination or forced close.
1601 { 1608 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 const base::string16& previous_version, 1667 const base::string16& previous_version,
1661 int64 previous_int_version, 1668 int64 previous_int_version,
1662 IndexedDBTransaction* transaction) { 1669 IndexedDBTransaction* transaction) {
1663 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 1670 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
1664 DCHECK(!transaction); 1671 DCHECK(!transaction);
1665 metadata_.version = previous_version; 1672 metadata_.version = previous_version;
1666 metadata_.int_version = previous_int_version; 1673 metadata_.int_version = previous_int_version;
1667 } 1674 }
1668 1675
1669 } // namespace content 1676 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698