| Index: content/browser/indexed_db/indexed_db_database_callbacks.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_database_callbacks.cc b/content/browser/indexed_db/indexed_db_database_callbacks.cc
|
| index 69f9b16221307a6747f6052df4ea18898f9ad7f8..265a5b09eb3f475f567779f25d97e54eb7268dd8 100644
|
| --- a/content/browser/indexed_db/indexed_db_database_callbacks.cc
|
| +++ b/content/browser/indexed_db/indexed_db_database_callbacks.cc
|
| @@ -4,64 +4,50 @@
|
|
|
| #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
|
|
|
| +#include <utility>
|
| +
|
| #include "content/browser/indexed_db/indexed_db_database_error.h"
|
| #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
|
| -#include "content/common/indexed_db/indexed_db_messages.h"
|
|
|
| namespace content {
|
|
|
| IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks(
|
| - IndexedDBDispatcherHost* dispatcher_host,
|
| - int ipc_thread_id,
|
| - int ipc_database_callbacks_id)
|
| - : dispatcher_host_(dispatcher_host),
|
| - ipc_thread_id_(ipc_thread_id),
|
| - ipc_database_callbacks_id_(ipc_database_callbacks_id) {}
|
| + indexed_db::mojom::DatabaseObserverPtr database_observer)
|
| + : database_observer_(std::move(database_observer)) {}
|
|
|
| IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() {}
|
|
|
| void IndexedDBDatabaseCallbacks::OnForcedClose() {
|
| - if (!dispatcher_host_.get())
|
| + if (!database_observer_)
|
| return;
|
|
|
| - dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksForcedClose(
|
| - ipc_thread_id_, ipc_database_callbacks_id_));
|
| -
|
| - dispatcher_host_ = NULL;
|
| + database_observer_->OnForcedClosed();
|
| + database_observer_ = nullptr;
|
| }
|
|
|
| void IndexedDBDatabaseCallbacks::OnVersionChange(int64_t old_version,
|
| int64_t new_version) {
|
| - if (!dispatcher_host_.get())
|
| + if (!database_observer_)
|
| return;
|
|
|
| - dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksVersionChange(
|
| - ipc_thread_id_, ipc_database_callbacks_id_, old_version, new_version));
|
| + database_observer_->OnVersionChange(old_version, new_version);
|
| }
|
|
|
| void IndexedDBDatabaseCallbacks::OnAbort(int64_t host_transaction_id,
|
| const IndexedDBDatabaseError& error) {
|
| - if (!dispatcher_host_.get())
|
| + if (!database_observer_)
|
| return;
|
|
|
| - dispatcher_host_->FinishTransaction(host_transaction_id, false);
|
| - dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksAbort(
|
| - ipc_thread_id_,
|
| - ipc_database_callbacks_id_,
|
| - dispatcher_host_->RendererTransactionId(host_transaction_id),
|
| - error.code(),
|
| - error.message()));
|
| + database_observer_->OnTransactionFinished(host_transaction_id, false);
|
| + database_observer_->OnTransactionAborted(host_transaction_id, error);
|
| }
|
|
|
| void IndexedDBDatabaseCallbacks::OnComplete(int64_t host_transaction_id) {
|
| - if (!dispatcher_host_.get())
|
| + if (!database_observer_)
|
| return;
|
|
|
| - dispatcher_host_->FinishTransaction(host_transaction_id, true);
|
| - dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksComplete(
|
| - ipc_thread_id_,
|
| - ipc_database_callbacks_id_,
|
| - dispatcher_host_->RendererTransactionId(host_transaction_id)));
|
| + database_observer_->OnTransactionFinished(host_transaction_id, false);
|
| + database_observer_->OnTransactionCompleted(host_transaction_id);
|
| }
|
|
|
| } // namespace content
|
|
|