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..33718001f4e5b09522c36486dc28e3ae0cd0a740 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,22 @@ 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)); |
+void ProfileApp::Create( |
+ mojo::Connection* connection, |
Ben Goodger (Google)
2016/03/11 23:21:38
up to prev line
michaeln
2016/03/16 03:11:12
what is |connection| used for in this method?
Elliot Glaysher
2016/03/17 19:29:44
Nothing, but it's part of the virtual interface si
|
+ leveldb::LevelDBServiceRequest request) { |
Ben Goodger (Google)
2016/03/11 23:21:38
indent over
|
+ if (!leveldb_thread_) { |
michaeln
2016/03/16 03:11:12
if OnServiceError() with empty bindings had alread
|
+ 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 |