Index: content/browser/indexed_db/indexed_db_pending_connection.cc |
diff --git a/content/browser/indexed_db/indexed_db_pending_connection.cc b/content/browser/indexed_db/indexed_db_pending_connection.cc |
index 34f4924285ca8f5d18589fbb2303d6970c7820e2..552e8f03ce09999ad898ac4bd3e829c60f0397bb 100644 |
--- a/content/browser/indexed_db/indexed_db_pending_connection.cc |
+++ b/content/browser/indexed_db/indexed_db_pending_connection.cc |
@@ -4,23 +4,63 @@ |
#include "content/browser/indexed_db/indexed_db_pending_connection.h" |
-namespace content { |
+#include <utility> |
-IndexedDBPendingConnection::IndexedDBPendingConnection( |
- scoped_refptr<IndexedDBCallbacks> callbacks_in, |
- scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks_in, |
- int child_process_id_in, |
- int64_t transaction_id_in, |
- int64_t version_in) |
- : callbacks(callbacks_in), |
- database_callbacks(database_callbacks_in), |
- child_process_id(child_process_id_in), |
- transaction_id(transaction_id_in), |
- version(version_in) {} |
+#include "content/browser/indexed_db/indexed_db_connection.h" |
+#include "content/browser/indexed_db/indexed_db_metadata.h" |
+#include "content/browser/indexed_db/indexed_db_open_request_observer.h" |
+#include "content/public/browser/indexed_db_context.h" |
+ |
+namespace content { |
IndexedDBPendingConnection::IndexedDBPendingConnection( |
- const IndexedDBPendingConnection& other) = default; |
+ const OpenResultCallback& open_callback, |
+ scoped_refptr<IndexedDBChangeHandler> change_handler, |
+ scoped_refptr<IndexedDBOpenRequestObserver> open_observer, |
+ int child_process_id, |
+ int64_t transaction_id, |
+ int64_t version, |
+ const url::Origin& origin) |
+ : open_callback_(std::move(open_callback)), |
+ change_handler_(change_handler), |
+ open_observer_(open_observer), |
+ child_process_id_(child_process_id), |
+ transaction_id_(transaction_id), |
+ version_(version), |
+ origin_(origin) {} |
IndexedDBPendingConnection::~IndexedDBPendingConnection() {} |
+void IndexedDBPendingConnection::SetDataLossInfo( |
+ const IndexedDBDataLossInfo& data_loss_info) { |
+ data_loss_info_ = data_loss_info; |
+} |
+ |
+void IndexedDBPendingConnection::OnError( |
+ const IndexedDBDatabaseError& error) const { |
+ IndexedDBDatabaseMetadata metadata; |
+ open_callback_.Run(nullptr, metadata, error); |
+} |
+ |
+void IndexedDBPendingConnection::OnSuccess( |
+ std::unique_ptr<IndexedDBConnection> connection, |
+ const IndexedDBDatabaseMetadata& metadata) const { |
+ DCHECK_EQ(data_loss_info_.status, blink::WebIDBDataLossNone); |
+ IndexedDBDatabaseError error; |
+ open_callback_.Run(std::move(connection), metadata, error); |
+} |
+ |
+void IndexedDBPendingConnection::OnBlocked(int64_t old_version) const { |
+ open_observer_->OnBlocked(old_version); |
+} |
+ |
+void IndexedDBPendingConnection::OnUpgradeNeeded( |
+ int64_t old_version, |
+ IndexedDBConnection* connection, |
+ const IndexedDBDatabaseMetadata& metadata) const { |
+ connection->RegisterTransactionId(transaction_id_, origin_); |
+ open_observer_->OnUpgradeNeeded(old_version, connection, data_loss_info_, |
+ metadata); |
+} |
+ |
} // namespace content |