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

Unified Diff: components/profile_service/profile_app.cc

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keeping up with the ToT Created 4 years, 10 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
Index: components/profile_service/profile_app.cc
diff --git a/components/profile_service/profile_app.cc b/components/profile_service/profile_app.cc
index 6ec8c0d14ed65d5bed93dff5cd33b1a66f91d131..5a4befd5358effe6e0fc57851e59a31eb6d3d344 100644
--- a/components/profile_service/profile_app.cc
+++ b/components/profile_service/profile_app.cc
@@ -5,7 +5,6 @@
#include "components/profile_service/profile_app.h"
#include "base/lazy_instance.h"
-#include "components/leveldb/leveldb_service_impl.h"
#include "components/profile_service/profile_service_impl.h"
#include "mojo/shell/public/cpp/connection.h"
@@ -23,7 +22,8 @@ scoped_ptr<mojo::ShellClient> CreateProfileApp() {
}
ProfileApp::ProfileApp()
- : lock_table_(new filesystem::LockTable) {
+ : lock_table_(new filesystem::LockTable),
+ profiles_outstanding_(0) {
}
ProfileApp::~ProfileApp() {}
@@ -35,12 +35,17 @@ void ProfileApp::AssociateMojoUserIDWithProfileDir(
g_user_id_to_data_dir.Get()[user_id] = profile_data_dir;
}
+void ProfileApp::OnProfileServiceDestroyed() {
+ profiles_outstanding_--;
+ if (profiles_outstanding_ == 0)
+ base::MessageLoop::current()->QuitNow();
Ben Goodger (Google) 2016/03/04 20:50:49 you can also use mojo/shell/public/cpp/message_loo
Elliot Glaysher 2016/03/10 21:00:35 Done. (Here and in leveldb.)
+}
+
void ProfileApp::Initialize(mojo::Connector* connector,
const std::string& url,
uint32_t id,
uint32_t user_id) {
tracing_.Initialize(connector, url);
- leveldb_service_.reset(new leveldb::LevelDBServiceImpl);
auto it = g_user_id_to_data_dir.Get().find(user_id);
DCHECK(it != g_user_id_to_data_dir.Get().end());
@@ -48,24 +53,19 @@ void ProfileApp::Initialize(mojo::Connector* connector,
}
bool ProfileApp::AcceptConnection(mojo::Connection* connection) {
- connection->AddInterface<leveldb::LevelDBService>(this);
connection->AddInterface<ProfileService>(this);
return true;
}
void ProfileApp::Create(mojo::Connection* connection,
mojo::InterfaceRequest<ProfileService> request) {
- // No, we need one of these per connection.
+ profiles_outstanding_++;
new ProfileServiceImpl(connection,
std::move(request),
+ base::Bind(&ProfileApp::OnProfileServiceDestroyed,
+ base::Unretained(this)),
profile_data_dir_,
lock_table_.get());
}
-void ProfileApp::Create(
- mojo::Connection* connection,
- mojo::InterfaceRequest<leveldb::LevelDBService> request) {
- leveldb_bindings_.AddBinding(leveldb_service_.get(), std::move(request));
-}
-
} // namespace profile

Powered by Google App Engine
This is Rietveld 408576698