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

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

Issue 2109273002: IndexedDB: Created IndexedDBDataLossInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initializing data loss in IndexedDBBackingStore::Open Created 4 years, 5 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 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 } 1733 }
1734 1734
1735 void IndexedDBDatabase::OpenConnection( 1735 void IndexedDBDatabase::OpenConnection(
1736 const IndexedDBPendingConnection& connection) { 1736 const IndexedDBPendingConnection& connection) {
1737 DCHECK(backing_store_.get()); 1737 DCHECK(backing_store_.get());
1738 1738
1739 if (IsOpenConnectionBlocked()) { 1739 if (IsOpenConnectionBlocked()) {
1740 // The backing store only detects data loss when it is first opened. The 1740 // The backing store only detects data loss when it is first opened. The
1741 // presence of existing connections means we didn't even check for data loss 1741 // presence of existing connections means we didn't even check for data loss
1742 // so there'd better not be any. 1742 // so there'd better not be any.
1743 DCHECK_NE(blink::WebIDBDataLossTotal, connection.callbacks->data_loss()); 1743 DCHECK_NE(blink::WebIDBDataLossTotal,
1744 connection.callbacks->data_loss_info().status);
1744 pending_open_calls_.push(connection); 1745 pending_open_calls_.push(connection);
1745 return; 1746 return;
1746 } 1747 }
1747 1748
1748 if (metadata_.id == kInvalidId) { 1749 if (metadata_.id == kInvalidId) {
1749 // The database was deleted then immediately re-opened; OpenInternal() 1750 // The database was deleted then immediately re-opened; OpenInternal()
1750 // recreates it in the backing store. 1751 // recreates it in the backing store.
1751 if (OpenInternal().ok()) { 1752 if (OpenInternal().ok()) {
1752 DCHECK_EQ(IndexedDBDatabaseMetadata::NO_VERSION, metadata_.version); 1753 DCHECK_EQ(IndexedDBDatabaseMetadata::NO_VERSION, metadata_.version);
1753 } else { 1754 } else {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 } 1824 }
1824 1825
1825 void IndexedDBDatabase::RunVersionChangeTransaction( 1826 void IndexedDBDatabase::RunVersionChangeTransaction(
1826 scoped_refptr<IndexedDBCallbacks> callbacks, 1827 scoped_refptr<IndexedDBCallbacks> callbacks,
1827 std::unique_ptr<IndexedDBConnection> connection, 1828 std::unique_ptr<IndexedDBConnection> connection,
1828 int64_t transaction_id, 1829 int64_t transaction_id,
1829 int64_t requested_version) { 1830 int64_t requested_version) {
1830 DCHECK(callbacks.get()); 1831 DCHECK(callbacks.get());
1831 DCHECK(connections_.count(connection.get())); 1832 DCHECK(connections_.count(connection.get()));
1832 if (ConnectionCount() > 1) { 1833 if (ConnectionCount() > 1) {
1833 DCHECK_NE(blink::WebIDBDataLossTotal, callbacks->data_loss()); 1834 DCHECK_NE(blink::WebIDBDataLossTotal, callbacks->data_loss_info().status);
1834 // Front end ensures the event is not fired at connections that have 1835 // Front end ensures the event is not fired at connections that have
1835 // close_pending set. 1836 // close_pending set.
1836 for (const auto* iter : connections_) { 1837 for (const auto* iter : connections_) {
1837 if (iter != connection.get()) { 1838 if (iter != connection.get()) {
1838 iter->callbacks()->OnVersionChange(metadata_.version, 1839 iter->callbacks()->OnVersionChange(metadata_.version,
1839 requested_version); 1840 requested_version);
1840 } 1841 }
1841 } 1842 }
1842 // OnBlocked will be fired at the request when one of the other 1843 // OnBlocked will be fired at the request when one of the other
1843 // connections acks that the OnVersionChange was ignored. 1844 // connections acks that the OnVersionChange was ignored.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 2010
2010 void IndexedDBDatabase::VersionChangeAbortOperation( 2011 void IndexedDBDatabase::VersionChangeAbortOperation(
2011 int64_t previous_version, 2012 int64_t previous_version,
2012 IndexedDBTransaction* transaction) { 2013 IndexedDBTransaction* transaction) {
2013 DCHECK(!transaction); 2014 DCHECK(!transaction);
2014 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); 2015 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation");
2015 metadata_.version = previous_version; 2016 metadata_.version = previous_version;
2016 } 2017 }
2017 2018
2018 } // namespace content 2019 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc ('k') | content/browser/indexed_db/indexed_db_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698