Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: mojo/public/cpp/bindings/associated_interface_ptr.h

Issue 2324623003: Revert of Mojo C++ Bindings: Additional support for associated binding sets (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/binding_set.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <utility> 9 #include <utility>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "mojo/public/cpp/bindings/associated_group.h" 17 #include "mojo/public/cpp/bindings/associated_group.h"
18 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" 18 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
19 #include "mojo/public/cpp/bindings/associated_interface_request.h" 19 #include "mojo/public/cpp/bindings/associated_interface_request.h"
20 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" 20 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h"
21 #include "mojo/public/cpp/bindings/lib/multiplex_router.h"
22 #include "mojo/public/cpp/system/message_pipe.h"
23 21
24 namespace mojo { 22 namespace mojo {
25 23
26 // Represents the client side of an associated interface. It is similar to 24 // Represents the client side of an associated interface. It is similar to
27 // InterfacePtr, except that it doesn't own a message pipe handle. 25 // InterfacePtr, except that it doesn't own a message pipe handle.
28 template <typename Interface> 26 template <typename Interface>
29 class AssociatedInterfacePtr { 27 class AssociatedInterfacePtr {
30 public: 28 public:
31 // Constructs an unbound AssociatedInterfacePtr. 29 // Constructs an unbound AssociatedInterfacePtr.
32 AssociatedInterfacePtr() {} 30 AssociatedInterfacePtr() {}
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::ThreadTaskRunnerHandle::Get()) { 202 base::ThreadTaskRunnerHandle::Get()) {
205 AssociatedInterfaceRequest<Interface> request; 203 AssociatedInterfaceRequest<Interface> request;
206 AssociatedInterfacePtrInfo<Interface> ptr_info; 204 AssociatedInterfacePtrInfo<Interface> ptr_info;
207 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, 205 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST,
208 &ptr_info, &request); 206 &ptr_info, &request);
209 207
210 ptr->Bind(std::move(ptr_info), std::move(runner)); 208 ptr->Bind(std::move(ptr_info), std::move(runner));
211 return request; 209 return request;
212 } 210 }
213 211
214 // Creates an associated interface proxy which casts its messages into the void.
215 template <typename Interface>
216 void GetDummyProxyForTesting(AssociatedInterfacePtr<Interface>* proxy) {
217 MessagePipe pipe;
218 scoped_refptr<internal::MultiplexRouter> router =
219 new internal::MultiplexRouter(false, std::move(pipe.handle0),
220 base::ThreadTaskRunnerHandle::Get());
221 std::unique_ptr<AssociatedGroup> group = router->CreateAssociatedGroup();
222 GetProxy(proxy, group.get());
223 }
224
225 } // namespace mojo 212 } // namespace mojo
226 213
227 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ 214 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/binding_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698