| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ |
| 7 | 7 |
| 8 #include "mojo/public/cpp/bindings/error_handler.h" | 8 #include "mojo/public/cpp/bindings/error_handler.h" |
| 9 #include "mojo/public/cpp/bindings/interface_ptr.h" | 9 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 10 #include "mojo/public/cpp/bindings/lib/filter_chain.h" | 10 #include "mojo/public/cpp/bindings/lib/filter_chain.h" |
| 11 #include "mojo/public/cpp/bindings/lib/message_header_validator.h" | 11 #include "mojo/public/cpp/bindings/lib/message_header_validator.h" |
| 12 #include "mojo/public/cpp/environment/environment.h" |
| 12 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
| 13 | 14 |
| 14 namespace mojo { | 15 namespace mojo { |
| 15 namespace internal { | 16 namespace internal { |
| 16 | 17 |
| 17 template <typename Interface> | 18 template <typename Interface> |
| 18 class InterfaceImplBase : public Interface { | 19 class InterfaceImplBase : public Interface { |
| 19 public: | 20 public: |
| 20 virtual ~InterfaceImplBase() {} | 21 virtual ~InterfaceImplBase() {} |
| 21 virtual void OnConnectionEstablished() = 0; | 22 virtual void OnConnectionEstablished() = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 virtual ~InterfaceImplState() { | 38 virtual ~InterfaceImplState() { |
| 38 delete proxy_; | 39 delete proxy_; |
| 39 if (router_) { | 40 if (router_) { |
| 40 router_->set_error_handler(NULL); | 41 router_->set_error_handler(NULL); |
| 41 delete router_; | 42 delete router_; |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 void BindProxy( | 46 void BindProxy( |
| 46 InterfacePtr<Interface>* ptr, | 47 InterfacePtr<Interface>* ptr, |
| 47 const MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()) { | 48 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
| 48 MessagePipe pipe; | 49 MessagePipe pipe; |
| 49 ptr->Bind(pipe.handle0.Pass(), waiter); | 50 ptr->Bind(pipe.handle0.Pass(), waiter); |
| 50 Bind(pipe.handle1.Pass(), waiter); | 51 Bind(pipe.handle1.Pass(), waiter); |
| 51 } | 52 } |
| 52 | 53 |
| 53 void Bind(ScopedMessagePipeHandle handle, | 54 void Bind(ScopedMessagePipeHandle handle, |
| 54 const MojoAsyncWaiter* waiter) { | 55 const MojoAsyncWaiter* waiter) { |
| 55 assert(!router_); | 56 assert(!router_); |
| 56 | 57 |
| 57 FilterChain filters; | 58 FilterChain filters; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 84 typename Client::Proxy_* proxy_; | 85 typename Client::Proxy_* proxy_; |
| 85 typename Interface::Stub_ stub_; | 86 typename Interface::Stub_ stub_; |
| 86 | 87 |
| 87 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImplState); | 88 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImplState); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace internal | 91 } // namespace internal |
| 91 } // namespace mojo | 92 } // namespace mojo |
| 92 | 93 |
| 93 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ | 94 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ |
| OLD | NEW |