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_PTR_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/lib/filter_chain.h" | 10 #include "mojo/public/cpp/bindings/lib/filter_chain.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 std::swap(other->instance_, instance_); | 35 std::swap(other->instance_, instance_); |
36 std::swap(other->router_, router_); | 36 std::swap(other->router_, router_); |
37 } | 37 } |
38 | 38 |
39 void ConfigureProxy(ScopedMessagePipeHandle handle, | 39 void ConfigureProxy(ScopedMessagePipeHandle handle, |
40 MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()) { | 40 MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()) { |
41 assert(!instance_); | 41 assert(!instance_); |
42 assert(!router_); | 42 assert(!router_); |
43 | 43 |
44 FilterChain filters; | 44 FilterChain filters; |
45 filters.Append(new MessageHeaderValidator) | 45 filters.Append<MessageHeaderValidator>(); |
46 .Append(new typename Interface::Client::RequestValidator_) | 46 filters.Append<typename Interface::Client::RequestValidator_>(); |
47 .Append(new typename Interface::ResponseValidator_); | 47 filters.Append<typename Interface::ResponseValidator_>(); |
48 | 48 |
49 router_ = new Router(handle.Pass(), filters.Pass(), waiter); | 49 router_ = new Router(handle.Pass(), filters.Pass(), waiter); |
50 ProxyWithStub* proxy = new ProxyWithStub(router_); | 50 ProxyWithStub* proxy = new ProxyWithStub(router_); |
51 router_->set_incoming_receiver(&proxy->stub); | 51 router_->set_incoming_receiver(&proxy->stub); |
52 | 52 |
53 instance_ = proxy; | 53 instance_ = proxy; |
54 } | 54 } |
55 | 55 |
56 private: | 56 private: |
57 class ProxyWithStub : public Interface::Proxy_ { | 57 class ProxyWithStub : public Interface::Proxy_ { |
(...skipping 12 matching lines...) Expand all Loading... |
70 Interface* instance_; | 70 Interface* instance_; |
71 Router* router_; | 71 Router* router_; |
72 | 72 |
73 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); | 73 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace internal | 76 } // namespace internal |
77 } // namespace mojo | 77 } // namespace mojo |
78 | 78 |
79 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ | 79 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_INTERNAL_H_ |
OLD | NEW |