| Index: mojo/public/cpp/application/lib/application_impl.cc
|
| diff --git a/mojo/public/cpp/application/lib/application_impl.cc b/mojo/public/cpp/application/lib/application_impl.cc
|
| index f47b58fdf3a538c523c24c37d1bca864d75d24bb..469ba3a9417f242f218b274c707892ff740b70e2 100644
|
| --- a/mojo/public/cpp/application/lib/application_impl.cc
|
| +++ b/mojo/public/cpp/application/lib/application_impl.cc
|
| @@ -10,24 +10,31 @@
|
|
|
| namespace mojo {
|
|
|
| -ApplicationImpl::ShellPtrWatcher::ShellPtrWatcher(ApplicationImpl* impl)
|
| +class ApplicationImpl::ShellPtrWatcher : public ErrorHandler {
|
| + public:
|
| + ShellPtrWatcher(ApplicationImpl* impl)
|
| : impl_(impl) {}
|
|
|
| -ApplicationImpl::ShellPtrWatcher::~ShellPtrWatcher() {}
|
| + virtual ~ShellPtrWatcher() {}
|
|
|
| -void ApplicationImpl::ShellPtrWatcher::OnConnectionError() {
|
| - impl_->OnShellError();
|
| -}
|
| + virtual void OnConnectionError() MOJO_OVERRIDE {
|
| + impl_->OnShellError();
|
| + }
|
| +
|
| + private:
|
| + ApplicationImpl* impl_;
|
| + MOJO_DISALLOW_COPY_AND_ASSIGN(ShellPtrWatcher);
|
| +};
|
|
|
| ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
|
| ScopedMessagePipeHandle shell_handle)
|
| - : delegate_(delegate), shell_watch_(this) {
|
| + : delegate_(delegate), shell_watch_(NULL) {
|
| BindShell(shell_handle.Pass());
|
| }
|
|
|
| ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
|
| MojoHandle shell_handle)
|
| - : delegate_(delegate), shell_watch_(this) {
|
| + : delegate_(delegate), shell_watch_(NULL) {
|
| BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle)));
|
| }
|
|
|
| @@ -44,6 +51,7 @@ void ApplicationImpl::ClearConnections() {
|
|
|
| ApplicationImpl::~ApplicationImpl() {
|
| ClearConnections();
|
| + delete shell_watch_;
|
| }
|
|
|
| ApplicationConnection* ApplicationImpl::ConnectToApplication(
|
| @@ -63,9 +71,10 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
|
| }
|
|
|
| void ApplicationImpl::BindShell(ScopedMessagePipeHandle shell_handle) {
|
| + shell_watch_ = new ShellPtrWatcher(this);
|
| shell_.Bind(shell_handle.Pass());
|
| shell_.set_client(this);
|
| - shell_.set_error_handler(&shell_watch_);
|
| + shell_.set_error_handler(shell_watch_);
|
| delegate_->Initialize(this);
|
| }
|
|
|
|
|