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

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

Issue 1991463002: Mojo: Expose untyped associated endpoints through public API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // scheduling. 61 // scheduling.
62 // 62 //
63 // NOTE: Please see the comments of 63 // NOTE: Please see the comments of
64 // AssociatedGroup.CreateAssociatedInterface() about when you can use this 64 // AssociatedGroup.CreateAssociatedInterface() about when you can use this
65 // object to make calls. 65 // object to make calls.
66 void Bind(AssociatedInterfacePtrInfo<Interface> info, 66 void Bind(AssociatedInterfacePtrInfo<Interface> info,
67 scoped_refptr<base::SingleThreadTaskRunner> runner = 67 scoped_refptr<base::SingleThreadTaskRunner> runner =
68 base::ThreadTaskRunnerHandle::Get()) { 68 base::ThreadTaskRunnerHandle::Get()) {
69 reset(); 69 reset();
70 70
71 bool is_local = 71 bool is_local = info.handle().is_local();
72 internal::AssociatedInterfacePtrInfoHelper::GetHandle(&info).is_local();
73 72
74 DCHECK(is_local) << "The AssociatedInterfacePtrInfo is supposed to be used " 73 DCHECK(is_local) << "The AssociatedInterfacePtrInfo is supposed to be used "
75 "at the other side of the message pipe."; 74 "at the other side of the message pipe.";
76 75
77 if (info.is_valid() && is_local) 76 if (info.is_valid() && is_local)
78 internal_state_.Bind(std::move(info), std::move(runner)); 77 internal_state_.Bind(std::move(info), std::move(runner));
79 } 78 }
80 79
81 bool is_bound() const { return internal_state_.is_bound(); } 80 bool is_bound() const { return internal_state_.is_bound(); }
82 81
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, 198 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST,
200 &ptr_info, &request); 199 &ptr_info, &request);
201 200
202 ptr->Bind(std::move(ptr_info), std::move(runner)); 201 ptr->Bind(std::move(ptr_info), std::move(runner));
203 return request; 202 return request;
204 } 203 }
205 204
206 } // namespace mojo 205 } // namespace mojo
207 206
208 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ 207 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/associated_group.h ('k') | mojo/public/cpp/bindings/associated_interface_ptr_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698