OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ASSOCIATED_GROUP_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 11 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
12 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 12 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
13 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" | 13 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 | 16 |
17 namespace internal { | 17 class AssociatedGroupController; |
18 class MultiplexRouter; | |
19 } | |
20 | 18 |
21 // AssociatedGroup refers to all the interface endpoints running at one end of a | 19 // AssociatedGroup refers to all the interface endpoints running at one end of a |
22 // message pipe. It is used to create associated interfaces for that message | 20 // message pipe. It is used to create associated interfaces for that message |
23 // pipe. | 21 // pipe. |
24 // It is thread safe and cheap to make copies. | 22 // It is thread safe and cheap to make copies. |
25 class AssociatedGroup { | 23 class AssociatedGroup { |
26 public: | 24 public: |
27 // Configuration used by CreateAssociatedInterface(). Please see the comments | 25 // Configuration used by CreateAssociatedInterface(). Please see the comments |
28 // of that method for more details. | 26 // of that method for more details. |
29 enum AssociatedInterfaceConfig { WILL_PASS_PTR, WILL_PASS_REQUEST }; | 27 enum AssociatedInterfaceConfig { WILL_PASS_PTR, WILL_PASS_REQUEST }; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ptr_info->set_handle(std::move(local)); | 69 ptr_info->set_handle(std::move(local)); |
72 | 70 |
73 // The implementation is remote, we don't know about its actual version | 71 // The implementation is remote, we don't know about its actual version |
74 // yet. | 72 // yet. |
75 ptr_info->set_version(0u); | 73 ptr_info->set_version(0u); |
76 request->Bind(std::move(remote)); | 74 request->Bind(std::move(remote)); |
77 } | 75 } |
78 } | 76 } |
79 | 77 |
80 private: | 78 private: |
81 friend class internal::MultiplexRouter; | 79 friend class AssociatedGroupController; |
82 | 80 |
83 void CreateEndpointHandlePair( | 81 void CreateEndpointHandlePair( |
84 ScopedInterfaceEndpointHandle* local_endpoint, | 82 ScopedInterfaceEndpointHandle* local_endpoint, |
85 ScopedInterfaceEndpointHandle* remote_endpoint); | 83 ScopedInterfaceEndpointHandle* remote_endpoint); |
86 | 84 |
87 scoped_refptr<internal::MultiplexRouter> router_; | 85 scoped_refptr<AssociatedGroupController> controller_; |
88 }; | 86 }; |
89 | 87 |
90 } // namespace mojo | 88 } // namespace mojo |
91 | 89 |
92 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_H_ | 90 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_H_ |
OLD | NEW |