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

Unified Diff: shell/context.cc

Issue 983113002: ApplicationManager: Use callback to get notified on application shutdown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase after parameters fix Created 5 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 | « shell/context.h ('k') | shell/native_runner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/context.cc
diff --git a/shell/context.cc b/shell/context.cc
index 91bfa120ce7da5c237221695044250455e6f840d..b7f310717c5309511ccb37b7a50702f6762ac293 100644
--- a/shell/context.cc
+++ b/shell/context.cc
@@ -289,7 +289,7 @@ bool Context::Init() {
new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr));
application_manager_.ConnectToApplication(
GURL("mojo:tracing"), GURL(""), nullptr,
- tracing_service_provider_ptr.Pass());
+ tracing_service_provider_ptr.Pass(), base::Closure());
if (listener_)
listener_->WaitForListening();
@@ -305,17 +305,6 @@ void Context::Shutdown() {
base::MessageLoop::current()->Run();
}
-void Context::OnApplicationError(const GURL& url) {
- if (app_urls_.find(url) != app_urls_.end()) {
- app_urls_.erase(url);
- if (app_urls_.empty() && base::MessageLoop::current()->is_running()) {
- DCHECK_EQ(base::MessageLoop::current()->task_runner(),
- task_runners_->shell_runner());
- base::MessageLoop::current()->Quit();
- }
- }
-}
-
GURL Context::ResolveURL(const GURL& url) {
return url_resolver_.ResolveMojoURL(url);
}
@@ -335,17 +324,28 @@ void Context::Run(const GURL& url) {
ServiceProviderPtr exposed_services;
app_urls_.insert(url);
- application_manager_.ConnectToApplication(url, GURL(), GetProxy(&services),
- exposed_services.Pass());
+ application_manager_.ConnectToApplication(
+ url, GURL(), GetProxy(&services), exposed_services.Pass(),
+ base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url));
}
ScopedMessagePipeHandle Context::ConnectToServiceByName(
const GURL& application_url,
const std::string& service_name) {
- app_urls_.insert(application_url);
return application_manager_.ConnectToServiceByName(application_url,
service_name).Pass();
}
+void Context::OnApplicationEnd(const GURL& url) {
+ if (app_urls_.find(url) != app_urls_.end()) {
+ app_urls_.erase(url);
+ if (app_urls_.empty() && base::MessageLoop::current()->is_running()) {
+ DCHECK_EQ(base::MessageLoop::current()->task_runner(),
+ task_runners_->shell_runner());
+ base::MessageLoop::current()->Quit();
+ }
+ }
+}
+
} // namespace shell
} // namespace mojo
« no previous file with comments | « shell/context.h ('k') | shell/native_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698