diff options
author | jam <jam@chromium.org> | 2015-05-26 08:49:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-26 15:50:26 +0000 |
commit | 995c2736a3096a95270e7274232f99935da0e3e4 (patch) | |
tree | 3a4c1131621f05b05827fc2978d6c844af0f0db5 /mojo | |
parent | 976cd10bb8842d853ad6ed3ab16b230ce64a89e7 (diff) | |
download | chromium_src-995c2736a3096a95270e7274232f99935da0e3e4.zip chromium_src-995c2736a3096a95270e7274232f99935da0e3e4.tar.gz chromium_src-995c2736a3096a95270e7274232f99935da0e3e4.tar.bz2 |
Remove ShellPtrWatcher and just make ApplicationImpl watch for connection errors itself.
BUG=484234
Review URL: https://codereview.chromium.org/1149723005
Cr-Commit-Position: refs/heads/master@{#331366}
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/application/public/cpp/application_impl.h | 20 | ||||
-rw-r--r-- | mojo/application/public/cpp/lib/application_impl.cc | 26 |
2 files changed, 14 insertions, 32 deletions
diff --git a/mojo/application/public/cpp/application_impl.h b/mojo/application/public/cpp/application_impl.h index 00d616f..5d55a267 100644 --- a/mojo/application/public/cpp/application_impl.h +++ b/mojo/application/public/cpp/application_impl.h @@ -49,7 +49,8 @@ namespace mojo { // app.AddService<BarImpl>(&context); // // -class ApplicationImpl : public Application { +class ApplicationImpl : public Application, + public ErrorHandler { public: // Does not take ownership of |delegate|, which must remain valid for the // lifetime of ApplicationImpl. @@ -94,27 +95,19 @@ class ApplicationImpl : public Application { // Quits the main run loop for this application. void Terminate(); - protected: + private: // Application implementation. void AcceptConnection(const String& requestor_url, InterfaceRequest<ServiceProvider> services, ServiceProviderPtr exposed_services, const String& url) override; + void RequestQuit() override; - private: - class ShellPtrWatcher; + // ErrorHandler implementation. + void OnConnectionError() override; void ClearConnections(); - void OnShellError() { - delegate_->Quit(); - ClearConnections(); - Terminate(); - } - - // Application implementation. - void RequestQuit() override; - typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList; ServiceRegistryList incoming_service_registries_; @@ -122,7 +115,6 @@ class ApplicationImpl : public Application { ApplicationDelegate* delegate_; Binding<Application> binding_; ShellPtr shell_; - ShellPtrWatcher* shell_watch_; std::string url_; MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 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 |