Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: components/profile_service/profile_app.cc

Issue 1839823002: mojo leveldb: Remove the created file thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: And cut out manual Signal()ing most places. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/profile_service/OWNERS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/profile_service/profile_app.cc
diff --git a/components/profile_service/profile_app.cc b/components/profile_service/profile_app.cc
index a58071163cb47e5c64029ae5f00dda1f43712d29..8625a830486bc104b70fccb2bd617c75320f212b 100644
--- a/components/profile_service/profile_app.cc
+++ b/components/profile_service/profile_app.cc
@@ -47,7 +47,8 @@ class ProfileApp::LevelDBServiceObjects
: public base::SupportsWeakPtr<LevelDBServiceObjects> {
public:
// Created on the main thread.
- LevelDBServiceObjects() {}
+ LevelDBServiceObjects(scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : task_runner_(std::move(task_runner)) {}
// Destroyed on the |leveldb_service_runner_|.
~LevelDBServiceObjects() {}
@@ -56,11 +57,13 @@ class ProfileApp::LevelDBServiceObjects
void OnLevelDBServiceRequest(mojo::Connection* connection,
leveldb::LevelDBServiceRequest request) {
if (!leveldb_service_)
- leveldb_service_.reset(new leveldb::LevelDBServiceImpl);
+ leveldb_service_.reset(new leveldb::LevelDBServiceImpl(task_runner_));
leveldb_bindings_.AddBinding(leveldb_service_.get(), std::move(request));
}
private:
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+
// Variables that are only accessible on the |leveldb_service_runner_| thread.
scoped_ptr<leveldb::LevelDBService> leveldb_service_;
mojo::BindingSet<leveldb::LevelDBService> leveldb_bindings_;
@@ -93,7 +96,8 @@ void ProfileApp::Initialize(mojo::Connector* connector,
tracing_.Initialize(connector, identity.name());
profile_objects_.reset(new ProfileApp::ProfileServiceObjects(
GetProfileDirForUserID(identity.user_id())));
- leveldb_objects_.reset(new ProfileApp::LevelDBServiceObjects);
+ leveldb_objects_.reset(
+ new ProfileApp::LevelDBServiceObjects(leveldb_service_runner_));
}
bool ProfileApp::AcceptConnection(mojo::Connection* connection) {
« no previous file with comments | « components/profile_service/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698