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

Unified Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 119343004: IndexedDB: Simplify data loss code/message routing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl format Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/indexed_db/indexed_db_database.h ('k') | content/browser/indexed_db/indexed_db_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index 881c85985e2e84808300b02a1ce724cb3ad87084..b2d6b206bd403464338af6aa3aefad2476306206 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -1232,8 +1232,6 @@ void IndexedDBDatabase::VersionChangeOperation(
int64 version,
scoped_refptr<IndexedDBCallbacks> callbacks,
scoped_ptr<IndexedDBConnection> connection,
- blink::WebIDBDataLoss data_loss,
- std::string data_loss_message,
IndexedDBTransaction* transaction) {
IDB_TRACE("IndexedDBDatabase::VersionChangeOperation");
int64 old_version = metadata_.int_version;
@@ -1255,8 +1253,7 @@ void IndexedDBDatabase::VersionChangeOperation(
DCHECK(!pending_second_half_open_);
pending_second_half_open_.reset(
new PendingSuccessCall(callbacks, connection.get(), version));
- callbacks->OnUpgradeNeeded(
- old_version, connection.Pass(), metadata(), data_loss, data_loss_message);
+ callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata());
}
void IndexedDBDatabase::TransactionStarted(IndexedDBTransaction* transaction) {
@@ -1414,19 +1411,6 @@ void IndexedDBDatabase::OpenConnection(
scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
int64 transaction_id,
int64 version) {
- const blink::WebIDBDataLoss kDataLoss =
- blink::WebIDBDataLossNone;
- OpenConnection(
- callbacks, database_callbacks, transaction_id, version, kDataLoss, "");
-}
-
-void IndexedDBDatabase::OpenConnection(
- scoped_refptr<IndexedDBCallbacks> callbacks,
- scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
- int64 transaction_id,
- int64 version,
- blink::WebIDBDataLoss data_loss,
- std::string data_loss_message) {
DCHECK(backing_store_);
// TODO(jsbell): Should have a priority queue so that higher version
@@ -1435,7 +1419,7 @@ void IndexedDBDatabase::OpenConnection(
// The backing store only detects data loss when it is first opened. The
// presence of existing connections means we didn't even check for data loss
// so there'd better not be any.
- DCHECK_NE(blink::WebIDBDataLossTotal, data_loss);
+ DCHECK_NE(blink::WebIDBDataLossTotal, callbacks->data_loss());
pending_open_calls_.push_back(new PendingOpenCall(
callbacks, database_callbacks, transaction_id, version));
return;
@@ -1495,12 +1479,8 @@ void IndexedDBDatabase::OpenConnection(
if (version > metadata_.int_version) {
connections_.insert(connection.get());
- RunVersionChangeTransaction(callbacks,
- connection.Pass(),
- transaction_id,
- version,
- data_loss,
- data_loss_message);
+ RunVersionChangeTransaction(
+ callbacks, connection.Pass(), transaction_id, version);
return;
}
if (version < metadata_.int_version) {
@@ -1520,14 +1500,12 @@ void IndexedDBDatabase::RunVersionChangeTransaction(
scoped_refptr<IndexedDBCallbacks> callbacks,
scoped_ptr<IndexedDBConnection> connection,
int64 transaction_id,
- int64 requested_version,
- blink::WebIDBDataLoss data_loss,
- std::string data_loss_message) {
+ int64 requested_version) {
DCHECK(callbacks);
DCHECK(connections_.count(connection.get()));
if (ConnectionCount() > 1) {
- DCHECK_NE(blink::WebIDBDataLossTotal, data_loss);
+ DCHECK_NE(blink::WebIDBDataLossTotal, callbacks->data_loss());
// Front end ensures the event is not fired at connections that have
// close_pending set.
for (ConnectionSet::const_iterator it = connections_.begin();
@@ -1548,12 +1526,8 @@ void IndexedDBDatabase::RunVersionChangeTransaction(
callbacks, connection.Pass(), transaction_id, requested_version));
return;
}
- RunVersionChangeTransactionFinal(callbacks,
- connection.Pass(),
- transaction_id,
- requested_version,
- data_loss,
- data_loss_message);
+ RunVersionChangeTransactionFinal(
+ callbacks, connection.Pass(), transaction_id, requested_version);
}
void IndexedDBDatabase::RunVersionChangeTransactionFinal(
@@ -1561,23 +1535,6 @@ void IndexedDBDatabase::RunVersionChangeTransactionFinal(
scoped_ptr<IndexedDBConnection> connection,
int64 transaction_id,
int64 requested_version) {
- const blink::WebIDBDataLoss kDataLoss =
- blink::WebIDBDataLossNone;
- RunVersionChangeTransactionFinal(callbacks,
- connection.Pass(),
- transaction_id,
- requested_version,
- kDataLoss,
- "");
-}
-
-void IndexedDBDatabase::RunVersionChangeTransactionFinal(
- scoped_refptr<IndexedDBCallbacks> callbacks,
- scoped_ptr<IndexedDBConnection> connection,
- int64 transaction_id,
- int64 requested_version,
- blink::WebIDBDataLoss data_loss,
- std::string data_loss_message) {
std::vector<int64> object_store_ids;
CreateTransaction(transaction_id,
@@ -1590,9 +1547,7 @@ void IndexedDBDatabase::RunVersionChangeTransactionFinal(
this,
requested_version,
callbacks,
- base::Passed(&connection),
- data_loss,
- data_loss_message),
+ base::Passed(&connection)),
base::Bind(&IndexedDBDatabase::VersionChangeAbortOperation,
this,
metadata_.version,
« no previous file with comments | « content/browser/indexed_db/indexed_db_database.h ('k') | content/browser/indexed_db/indexed_db_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698