Index: content/browser/dom_storage/local_storage_context_mojo.cc |
diff --git a/content/browser/dom_storage/local_storage_context_mojo.cc b/content/browser/dom_storage/local_storage_context_mojo.cc |
index 6cc0c76f6b6e2d9ff749ead7c50cbf3e5b2092b0..ffdc9503cf0293dbdf215ac2f8d54899468a161f 100644 |
--- a/content/browser/dom_storage/local_storage_context_mojo.cc |
+++ b/content/browser/dom_storage/local_storage_context_mojo.cc |
@@ -17,7 +17,6 @@ |
#include "content/common/dom_storage/dom_storage_types.h" |
#include "content/public/browser/local_storage_usage_info.h" |
#include "services/file/public/interfaces/constants.mojom.h" |
-#include "services/service_manager/public/cpp/connection.h" |
#include "services/service_manager/public/cpp/connector.h" |
#include "sql/connection.h" |
#include "third_party/leveldatabase/env_chromium.h" |
@@ -298,16 +297,7 @@ LocalStorageContextMojo::DatabaseRequestForTesting() { |
void LocalStorageContextMojo::RunWhenConnected(base::OnceClosure callback) { |
// If we don't have a filesystem_connection_, we'll need to establish one. |
if (connection_state_ == NO_CONNECTION) { |
- CHECK(connector_); |
- file_service_connection_ = connector_->Connect(file::mojom::kServiceName); |
connection_state_ = CONNECTION_IN_PROGRESS; |
- file_service_connection_->AddConnectionCompletedClosure( |
- base::Bind(&LocalStorageContextMojo::OnUserServiceConnectionComplete, |
- weak_ptr_factory_.GetWeakPtr())); |
- file_service_connection_->SetConnectionLostClosure( |
- base::Bind(&LocalStorageContextMojo::OnUserServiceConnectionError, |
- weak_ptr_factory_.GetWeakPtr())); |
- |
InitiateConnection(); |
} |
@@ -320,28 +310,20 @@ void LocalStorageContextMojo::RunWhenConnected(base::OnceClosure callback) { |
std::move(callback).Run(); |
} |
-void LocalStorageContextMojo::OnUserServiceConnectionComplete() { |
- CHECK_EQ(service_manager::mojom::ConnectResult::SUCCEEDED, |
- file_service_connection_->GetResult()); |
-} |
- |
-void LocalStorageContextMojo::OnUserServiceConnectionError() { |
- CHECK(false); |
-} |
- |
void LocalStorageContextMojo::InitiateConnection(bool in_memory_only) { |
DCHECK_EQ(connection_state_, CONNECTION_IN_PROGRESS); |
+ CHECK(connector_); |
if (!subdirectory_.empty() && !in_memory_only) { |
// We were given a subdirectory to write to. Get it and use a disk backed |
// database. |
- file_service_connection_->GetInterface(&file_system_); |
+ connector_->BindInterface(file::mojom::kServiceName, &file_system_); |
file_system_->GetSubDirectory( |
subdirectory_.AsUTF8Unsafe(), MakeRequest(&directory_), |
base::Bind(&LocalStorageContextMojo::OnDirectoryOpened, |
weak_ptr_factory_.GetWeakPtr())); |
} else { |
// We were not given a subdirectory. Use a memory backed database. |
- file_service_connection_->GetInterface(&leveldb_service_); |
+ connector_->BindInterface(file::mojom::kServiceName, &leveldb_service_); |
leveldb_service_->OpenInMemory( |
MakeRequest(&database_), |
base::Bind(&LocalStorageContextMojo::OnDatabaseOpened, |
@@ -367,7 +349,7 @@ void LocalStorageContextMojo::OnDirectoryOpened( |
// Now that we have a directory, connect to the LevelDB service and get our |
// database. |
- file_service_connection_->GetInterface(&leveldb_service_); |
+ connector_->BindInterface(file::mojom::kServiceName, &leveldb_service_); |
leveldb_service_->SetEnvironmentName("LevelDBEnv.LocalStorage"); |
// We might still need to use the directory, so create a clone. |
@@ -494,9 +476,9 @@ void LocalStorageContextMojo::DeleteAndRecreateDatabase() { |
tried_to_recreate_ = true; |
- // Unit tests might not have a file_service_connection_, in which case there |
- // is nothing to retry. |
- if (!file_service_connection_) { |
+ // Unit tests might not have a bound file_service_, in which case there is |
+ // nothing to retry. |
+ if (!file_system_.is_bound()) { |
database_ = nullptr; |
OnConnectionFinished(); |
return; |