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

Unified Diff: mojo/public/cpp/application/application_impl.h

Issue 394903005: mojo: terminate apps if the shell goes away (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again! Created 6 years, 5 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: mojo/public/cpp/application/application_impl.h
diff --git a/mojo/public/cpp/application/application_impl.h b/mojo/public/cpp/application/application_impl.h
index 8f7a84295bc079bfc543a3f646b27ba4aa3cffab..64d1be3781fcf734e0b5da9575799443fd4cd6f8 100644
--- a/mojo/public/cpp/application/application_impl.h
+++ b/mojo/public/cpp/application/application_impl.h
@@ -58,7 +58,7 @@ class ApplicationDelegate;
// BarImpl(ApplicationContext* app_context, BarContext* service_context)
// : app_context_(app_context), servicecontext_(context) {}
//
-// Create an ApplicationDele instance that collects any service implementations.
+// Create an ApplicationImpl instance that collects any service implementations.
//
// ApplicationImpl app(service_provider_handle);
// app.AddService<FooImpl>();
@@ -88,10 +88,25 @@ class ApplicationImpl : public InterfaceImpl<Application> {
}
private:
+ class ShellPtrWatcher : public ErrorHandler {
+ public:
+ explicit ShellPtrWatcher(ApplicationImpl* impl);
+ virtual ~ShellPtrWatcher();
+ virtual void OnConnectionError() MOJO_OVERRIDE;
+ private:
+ ApplicationImpl* impl_;
+ MOJO_DISALLOW_COPY_AND_ASSIGN(ShellPtrWatcher);
+ };
+
friend MojoResult (::MojoMain)(MojoHandle);
void BindShell(ScopedMessagePipeHandle shell_handle);
void BindShell(MojoHandle shell_handle);
+ void ClearConnections();
+ void OnShellError() { ClearConnections(); Terminate(); };
+
+ // Quits the main run loop for this application.
+ void Terminate();
// Application implementation.
virtual void AcceptConnection(const String& requestor_url,
@@ -102,6 +117,7 @@ class ApplicationImpl : public InterfaceImpl<Application> {
ServiceRegistryList outgoing_service_registries_;
ApplicationDelegate* delegate_;
ShellPtr shell_;
+ ShellPtrWatcher shell_watch_;
MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
};

Powered by Google App Engine
This is Rietveld 408576698