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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 MessagePipe pipe; | 49 MessagePipe pipe; |
50 ptr->Bind(pipe.handle0.Pass(), waiter); | 50 ptr->Bind(pipe.handle0.Pass(), waiter); |
51 Bind(pipe.handle1.Pass(), waiter); | 51 Bind(pipe.handle1.Pass(), waiter); |
52 } | 52 } |
53 | 53 |
54 void Bind(ScopedMessagePipeHandle handle, | 54 void Bind(ScopedMessagePipeHandle handle, |
55 MojoAsyncWaiter* waiter) { | 55 MojoAsyncWaiter* waiter) { |
56 assert(!router_); | 56 assert(!router_); |
57 | 57 |
58 FilterChain filters; | 58 FilterChain filters; |
59 filters.Append(new MessageHeaderValidator) | 59 filters.Append<MessageHeaderValidator>(); |
60 .Append(new typename Interface::RequestValidator_) | 60 filters.Append<typename Interface::RequestValidator_>(); |
61 .Append(new typename Interface::Client::ResponseValidator_); | 61 filters.Append<typename Interface::Client::ResponseValidator_>(); |
62 | 62 |
63 router_ = new Router(handle.Pass(), filters.Pass(), waiter); | 63 router_ = new Router(handle.Pass(), filters.Pass(), waiter); |
64 router_->set_incoming_receiver(&stub_); | 64 router_->set_incoming_receiver(&stub_); |
65 router_->set_error_handler(this); | 65 router_->set_error_handler(this); |
66 | 66 |
67 proxy_ = new typename Client::Proxy_(router_); | 67 proxy_ = new typename Client::Proxy_(router_); |
68 | 68 |
69 instance()->SetClient(proxy_); | 69 instance()->SetClient(proxy_); |
70 instance()->OnConnectionEstablished(); | 70 instance()->OnConnectionEstablished(); |
71 } | 71 } |
(...skipping 17 matching lines...) Expand all Loading... |
89 typename Client::Proxy_* proxy_; | 89 typename Client::Proxy_* proxy_; |
90 typename Interface::Stub_ stub_; | 90 typename Interface::Stub_ stub_; |
91 | 91 |
92 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImplState); | 92 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImplState); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace internal | 95 } // namespace internal |
96 } // namespace mojo | 96 } // namespace mojo |
97 | 97 |
98 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ | 98 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_IMPL_INTERNAL_H_ |
OLD | NEW |