summaryrefslogtreecommitdiffstats
path: root/mojo/application/public/cpp/lib/application_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/application/public/cpp/lib/application_impl.cc')
-rw-r--r--mojo/application/public/cpp/lib/application_impl.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc
index 0a558ef..69bcd79 100644
--- a/mojo/application/public/cpp/lib/application_impl.cc
+++ b/mojo/application/public/cpp/lib/application_impl.cc
@@ -12,24 +12,10 @@
namespace mojo {
-class ApplicationImpl::ShellPtrWatcher : public ErrorHandler {
- public:
- ShellPtrWatcher(ApplicationImpl* impl) : impl_(impl) {}
-
- ~ShellPtrWatcher() override {}
-
- void OnConnectionError() override { impl_->OnShellError(); }
-
- private:
- ApplicationImpl* impl_;
- MOJO_DISALLOW_COPY_AND_ASSIGN(ShellPtrWatcher);
-};
-
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
InterfaceRequest<Application> request)
: delegate_(delegate),
- binding_(this, request.Pass()),
- shell_watch_(nullptr) {
+ binding_(this, request.Pass()) {
}
void ApplicationImpl::ClearConnections() {
@@ -47,7 +33,6 @@ void ApplicationImpl::ClearConnections() {
ApplicationImpl::~ApplicationImpl() {
ClearConnections();
- delete shell_watch_;
}
ApplicationConnection* ApplicationImpl::ConnectToApplication(
@@ -72,8 +57,7 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
shell_ = shell.Pass();
- shell_watch_ = new ShellPtrWatcher(this);
- shell_.set_error_handler(shell_watch_);
+ shell_.set_error_handler(this);
url_ = url;
delegate_->Initialize(this);
}
@@ -114,4 +98,10 @@ void ApplicationImpl::RequestQuit() {
Terminate();
}
+void ApplicationImpl::OnConnectionError() {
+ delegate_->Quit();
+ ClearConnections();
+ Terminate();
+}
+
} // namespace mojo