OLD | NEW |
---|---|
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 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1639 } | 1639 } |
1640 metadata_.version = kNoStringVersion; | 1640 metadata_.version = kNoStringVersion; |
1641 metadata_.id = kInvalidId; | 1641 metadata_.id = kInvalidId; |
1642 metadata_.int_version = IndexedDBDatabaseMetadata::NO_INT_VERSION; | 1642 metadata_.int_version = IndexedDBDatabaseMetadata::NO_INT_VERSION; |
1643 metadata_.object_stores.clear(); | 1643 metadata_.object_stores.clear(); |
1644 callbacks->OnSuccess(); | 1644 callbacks->OnSuccess(); |
1645 if (factory_) | 1645 if (factory_) |
1646 factory_->DatabaseDeleted(identifier_); | 1646 factory_->DatabaseDeleted(identifier_); |
1647 } | 1647 } |
1648 | 1648 |
1649 void IndexedDBDatabase::ForceClose() { | |
1650 ConnectionSet conns(connections_); | |
jsbell
2013/12/20 00:24:42
Is this copy necessary?
cmumford
2013/12/20 18:09:26
I can't see an alternative. listset has no front m
jsbell
2013/12/20 18:22:56
A few possibilities:
* list_set does have begin()
| |
1651 for (ConnectionSet::iterator i = conns.begin(); i != conns.end(); ++i) | |
jsbell
2013/12/20 00:24:42
Nit: We try not to use single-character variables.
cmumford
2013/12/20 18:09:26
Done.
| |
1652 (*i)->ForceClose(); | |
1653 } | |
1654 | |
1649 void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) { | 1655 void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) { |
1650 DCHECK(connections_.count(connection)); | 1656 DCHECK(connections_.count(connection)); |
1651 DCHECK(connection->IsConnected()); | 1657 DCHECK(connection->IsConnected()); |
1652 DCHECK(connection->database() == this); | 1658 DCHECK(connection->database() == this); |
1653 | 1659 |
1654 // Abort outstanding transactions from the closing connection. This | 1660 // Abort outstanding transactions from the closing connection. This |
1655 // can not happen if the close is requested by the connection itself | 1661 // can not happen if the close is requested by the connection itself |
1656 // as the front-end defers the close until all transactions are | 1662 // as the front-end defers the close until all transactions are |
1657 // complete, but can occur on process termination or forced close. | 1663 // complete, but can occur on process termination or forced close. |
1658 { | 1664 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 const base::string16& previous_version, | 1723 const base::string16& previous_version, |
1718 int64 previous_int_version, | 1724 int64 previous_int_version, |
1719 IndexedDBTransaction* transaction) { | 1725 IndexedDBTransaction* transaction) { |
1720 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 1726 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
1721 DCHECK(!transaction); | 1727 DCHECK(!transaction); |
1722 metadata_.version = previous_version; | 1728 metadata_.version = previous_version; |
1723 metadata_.int_version = previous_int_version; | 1729 metadata_.int_version = previous_int_version; |
1724 } | 1730 } |
1725 | 1731 |
1726 } // namespace content | 1732 } // namespace content |
OLD | NEW |