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

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

Issue 2589663003: mojo:: Rename mojo::GetProxy() to mojo::MakeRequest() (Closed)
Patch Set: Rebase Created 4 years 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 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_BINDING_SET_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_BINDING_SET_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_SET_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_SET_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "mojo/public/cpp/bindings/connection_error_callback.h" 15 #include "mojo/public/cpp/bindings/connection_error_callback.h"
16 #include "mojo/public/cpp/bindings/interface_ptr.h" 16 #include "mojo/public/cpp/bindings/interface_ptr.h"
17 #include "mojo/public/cpp/bindings/interface_request.h" 17 #include "mojo/public/cpp/bindings/interface_request.h"
18 #include "mojo/public/cpp/bindings/message.h" 18 #include "mojo/public/cpp/bindings/message.h"
19 19
20 namespace mojo { 20 namespace mojo {
21 21
22 template <typename BindingType> 22 template <typename BindingType>
23 struct BindingSetTraits; 23 struct BindingSetTraits;
24 24
25 template <typename Interface> 25 template <typename Interface>
26 struct BindingSetTraits<Binding<Interface>> { 26 struct BindingSetTraits<Binding<Interface>> {
27 using ProxyType = InterfacePtr<Interface>; 27 using ProxyType = InterfacePtr<Interface>;
28 using RequestType = InterfaceRequest<Interface>; 28 using RequestType = InterfaceRequest<Interface>;
29 29
30 static RequestType GetProxy(ProxyType* proxy) { 30 static RequestType MakeRequest(ProxyType* proxy) {
31 return mojo::GetProxy(proxy); 31 return mojo::MakeRequest(proxy);
32 } 32 }
33 }; 33 };
34 34
35 enum class BindingSetDispatchMode { 35 enum class BindingSetDispatchMode {
36 WITHOUT_CONTEXT, 36 WITHOUT_CONTEXT,
37 WITH_CONTEXT, 37 WITH_CONTEXT,
38 }; 38 };
39 39
40 using BindingId = size_t; 40 using BindingId = size_t;
41 41
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 bindings_.erase(it); 107 bindings_.erase(it);
108 return true; 108 return true;
109 } 109 }
110 110
111 // Returns a proxy bound to one end of a pipe whose other end is bound to 111 // Returns a proxy bound to one end of a pipe whose other end is bound to
112 // |this|. If |id_storage| is not null, |*id_storage| will be set to the ID 112 // |this|. If |id_storage| is not null, |*id_storage| will be set to the ID
113 // of the added binding. 113 // of the added binding.
114 ProxyType CreateInterfacePtrAndBind(Interface* impl, 114 ProxyType CreateInterfacePtrAndBind(Interface* impl,
115 BindingId* id_storage = nullptr) { 115 BindingId* id_storage = nullptr) {
116 ProxyType proxy; 116 ProxyType proxy;
117 BindingId id = AddBinding(impl, Traits::GetProxy(&proxy)); 117 BindingId id = AddBinding(impl, Traits::MakeRequest(&proxy));
118 if (id_storage) 118 if (id_storage)
119 *id_storage = id; 119 *id_storage = id;
120 return proxy; 120 return proxy;
121 } 121 }
122 122
123 void CloseAllBindings() { bindings_.clear(); } 123 void CloseAllBindings() { bindings_.clear(); }
124 124
125 bool empty() const { return bindings_.empty(); } 125 bool empty() const { return bindings_.empty(); }
126 126
127 // Implementations may call this when processing a dispatched message or 127 // Implementations may call this when processing a dispatched message or
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 BindingId next_binding_id_ = 0; 232 BindingId next_binding_id_ = 0;
233 std::map<BindingId, std::unique_ptr<Entry>> bindings_; 233 std::map<BindingId, std::unique_ptr<Entry>> bindings_;
234 void* dispatch_context_ = nullptr; 234 void* dispatch_context_ = nullptr;
235 235
236 DISALLOW_COPY_AND_ASSIGN(BindingSet); 236 DISALLOW_COPY_AND_ASSIGN(BindingSet);
237 }; 237 };
238 238
239 } // namespace mojo 239 } // namespace mojo
240 240
241 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_SET_H_ 241 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_SET_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/associated_interface_ptr.h ('k') | mojo/public/cpp/bindings/interface_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698