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_INTERFACE_PTR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 19 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
20 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 20 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
| 21 #include "mojo/public/cpp/bindings/bindings_export.h" |
21 #include "mojo/public/cpp/bindings/connection_error_callback.h" | 22 #include "mojo/public/cpp/bindings/connection_error_callback.h" |
22 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" | 23 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" |
23 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" | 24 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
24 #include "mojo/public/cpp/system/message_pipe.h" | 25 #include "mojo/public/cpp/system/message_pipe.h" |
25 | 26 |
26 namespace mojo { | 27 namespace mojo { |
27 | 28 |
28 // Represents the client side of an associated interface. It is similar to | 29 // Represents the client side of an associated interface. It is similar to |
29 // InterfacePtr, except that it doesn't own a message pipe handle. | 30 // InterfacePtr, except that it doesn't own a message pipe handle. |
30 template <typename Interface> | 31 template <typename Interface> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 endpoint0 = router0->CreateLocalEndpointHandle(id); | 264 endpoint0 = router0->CreateLocalEndpointHandle(id); |
264 | 265 |
265 ptr->Bind(AssociatedInterfacePtrInfo<Interface>(std::move(endpoint0), | 266 ptr->Bind(AssociatedInterfacePtrInfo<Interface>(std::move(endpoint0), |
266 Interface::Version_)); | 267 Interface::Version_)); |
267 | 268 |
268 AssociatedInterfaceRequest<Interface> request; | 269 AssociatedInterfaceRequest<Interface> request; |
269 request.Bind(std::move(endpoint1)); | 270 request.Bind(std::move(endpoint1)); |
270 return request; | 271 return request; |
271 } | 272 } |
272 | 273 |
| 274 // |handle| is supposed to be the request of an associated interface. This |
| 275 // method associates the interface with a dedicated, disconnected message pipe. |
| 276 // That way, the corresponding associated interface pointer of |handle| can |
| 277 // safely make calls (although those calls are silently dropped). |
| 278 MOJO_CPP_BINDINGS_EXPORT void GetIsolatedInterface( |
| 279 ScopedInterfaceEndpointHandle handle); |
| 280 |
273 } // namespace mojo | 281 } // namespace mojo |
274 | 282 |
275 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ | 283 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ |
OLD | NEW |