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

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

Issue 2472213003: [IndexedDB] Refactoring to remove ref ptrs and host transaction ids. (Closed)
Patch Set: comments & rebase Created 4 years, 1 month 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
Index: content/browser/indexed_db/indexed_db_callbacks.cc
diff --git a/content/browser/indexed_db/indexed_db_callbacks.cc b/content/browser/indexed_db/indexed_db_callbacks.cc
index eb639072bfc5c21cde8db2f750a2e322605bb14b..96cb66d3e84ce369a2c5abb67202bdf83a8ff91e 100644
--- a/content/browser/indexed_db/indexed_db_callbacks.cc
+++ b/content/browser/indexed_db/indexed_db_callbacks.cc
@@ -21,6 +21,7 @@
#include "content/browser/indexed_db/indexed_db_database_error.h"
#include "content/browser/indexed_db/indexed_db_return_value.h"
#include "content/browser/indexed_db/indexed_db_tracing.h"
+#include "content/browser/indexed_db/indexed_db_transaction.h"
#include "content/browser/indexed_db/indexed_db_value.h"
#include "content/common/indexed_db/indexed_db_constants.h"
#include "content/common/indexed_db/indexed_db_messages.h"
@@ -174,6 +175,7 @@ void IndexedDBCallbacks::OnBlocked(int64_t existing_version) {
void IndexedDBCallbacks::OnUpgradeNeeded(
int64_t old_version,
std::unique_ptr<IndexedDBConnection> connection,
+ IndexedDBTransaction* transaction,
const IndexedDBDatabaseMetadata& metadata,
const IndexedDBDataLossInfo& data_loss_info) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -184,9 +186,8 @@ void IndexedDBCallbacks::OnUpgradeNeeded(
DCHECK_EQ(kNoDatabase, ipc_database_id_);
data_loss_ = data_loss_info.status;
- dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_);
int32_t ipc_database_id =
- dispatcher_host_->Add(connection.release(), origin_);
+ dispatcher_host_->Add(std::move(connection), origin_);
if (ipc_database_id < 0)
return;
@@ -222,7 +223,7 @@ void IndexedDBCallbacks::OnSuccess(
int32_t ipc_object_id = kNoDatabase;
// Only register if the connection was not previously sent in OnUpgradeNeeded.
if (ipc_database_id_ == kNoDatabase) {
- ipc_object_id = dispatcher_host_->Add(connection.release(), origin_);
+ ipc_object_id = dispatcher_host_->Add(std::move(connection), origin_);
}
BrowserThread::PostTask(
@@ -354,7 +355,7 @@ void IndexedDBCallbacks::RegisterBlobsAndSend(
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback);
}
-void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor,
+void IndexedDBCallbacks::OnSuccess(std::unique_ptr<IndexedDBCursor> cursor,
const IndexedDBKey& key,
const IndexedDBKey& primary_key,
IndexedDBValue* value) {
@@ -367,7 +368,7 @@ void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor,
DCHECK_EQ(kNoDatabase, ipc_database_id_);
DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
- int32_t ipc_object_id = dispatcher_host_->Add(cursor.get());
+ int32_t ipc_object_id = dispatcher_host_->Add(std::move(cursor));
std::unique_ptr<IndexedDBMsg_CallbacksSuccessIDBCursor_Params> params(
new IndexedDBMsg_CallbacksSuccessIDBCursor_Params());
params->ipc_thread_id = ipc_thread_id_;

Powered by Google App Engine
This is Rietveld 408576698