Chromium Code Reviews| Index: components/profile_service/profile_app.cc |
| diff --git a/components/profile_service/profile_app.cc b/components/profile_service/profile_app.cc |
| index 27491db5e910d27946721e9031860a493591c71b..7ec091a94a0622de3162dd36f8905a279c897bdf 100644 |
| --- a/components/profile_service/profile_app.cc |
| +++ b/components/profile_service/profile_app.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/lazy_instance.h" |
| #include "components/leveldb/leveldb_service_impl.h" |
| +#include "components/profile_service/leveldb_thread.h" |
| #include "components/profile_service/profile_service_impl.h" |
| #include "mojo/shell/public/cpp/connection.h" |
| @@ -39,7 +40,6 @@ void ProfileApp::Initialize(mojo::Connector* connector, |
| const mojo::Identity& identity, |
| uint32_t id) { |
| tracing_.Initialize(connector, identity.name()); |
| - leveldb_service_.reset(new leveldb::LevelDBServiceImpl); |
| auto it = g_user_id_to_data_dir.Get().find(identity.user_id()); |
| DCHECK(it != g_user_id_to_data_dir.Get().end()); |
| @@ -57,13 +57,21 @@ void ProfileApp::Create(mojo::Connection* connection, |
| // No, we need one of these per connection. |
| new ProfileServiceImpl(connection, |
| std::move(request), |
| + ref_factory_.CreateRef(), |
| profile_data_dir_, |
| lock_table_.get()); |
| } |
| void ProfileApp::Create(mojo::Connection* connection, |
| leveldb::LevelDBServiceRequest request) { |
| - leveldb_bindings_.AddBinding(leveldb_service_.get(), std::move(request)); |
| + if (!leveldb_thread_) { |
|
michaeln
2016/03/16 03:11:13
If the leveldb_thread_ self terminates, how is a n
|
| + leveldb_thread_ = new LevelDBThread( |
| + ref_factory_.CreateRef(), |
| + std::move(request)); |
| + } else { |
| + // We need to pass this binding to the leveldb thread. |
| + leveldb_thread_->BindNewRequest(std::move(request)); |
| + } |
| } |
| } // namespace profile |