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

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

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Regenerate correctly Created 4 years, 12 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 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "mojo/public/cpp/bindings/associated_group.h" 13 #include "mojo/public/cpp/bindings/associated_group.h"
13 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" 14 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
14 #include "mojo/public/cpp/bindings/associated_interface_request.h" 15 #include "mojo/public/cpp/bindings/associated_interface_request.h"
15 #include "mojo/public/cpp/bindings/callback.h" 16 #include "mojo/public/cpp/bindings/callback.h"
16 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" 17 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h"
17 18
18 namespace mojo { 19 namespace mojo {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void Bind(AssociatedInterfacePtrInfo<GenericInterface> info) { 60 void Bind(AssociatedInterfacePtrInfo<GenericInterface> info) {
60 reset(); 61 reset();
61 62
62 bool is_local = 63 bool is_local =
63 internal::AssociatedInterfacePtrInfoHelper::GetHandle(&info).is_local(); 64 internal::AssociatedInterfacePtrInfoHelper::GetHandle(&info).is_local();
64 65
65 DCHECK(is_local) << "The AssociatedInterfacePtrInfo is supposed to be used " 66 DCHECK(is_local) << "The AssociatedInterfacePtrInfo is supposed to be used "
66 "at the other side of the message pipe."; 67 "at the other side of the message pipe.";
67 68
68 if (info.is_valid() && is_local) 69 if (info.is_valid() && is_local)
69 internal_state_.Bind(info.Pass()); 70 internal_state_.Bind(std::move(info));
70 } 71 }
71 72
72 bool is_bound() const { return internal_state_.is_bound(); } 73 bool is_bound() const { return internal_state_.is_bound(); }
73 74
74 Interface* get() const { return internal_state_.instance(); } 75 Interface* get() const { return internal_state_.instance(); }
75 76
76 // Functions like a pointer to Interface. Must already be bound. 77 // Functions like a pointer to Interface. Must already be bound.
77 Interface* operator->() const { return get(); } 78 Interface* operator->() const { return get(); }
78 Interface& operator*() const { return *get(); } 79 Interface& operator*() const { return *get(); }
79 80
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // until the request is bound to an implementation at the remote side. 179 // until the request is bound to an implementation at the remote side.
179 template <typename Interface> 180 template <typename Interface>
180 AssociatedInterfaceRequest<typename Interface::GenericInterface> GetProxy( 181 AssociatedInterfaceRequest<typename Interface::GenericInterface> GetProxy(
181 AssociatedInterfacePtr<Interface>* ptr, 182 AssociatedInterfacePtr<Interface>* ptr,
182 AssociatedGroup* group) { 183 AssociatedGroup* group) {
183 AssociatedInterfaceRequest<typename Interface::GenericInterface> request; 184 AssociatedInterfaceRequest<typename Interface::GenericInterface> request;
184 AssociatedInterfacePtrInfo<typename Interface::GenericInterface> ptr_info; 185 AssociatedInterfacePtrInfo<typename Interface::GenericInterface> ptr_info;
185 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, 186 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST,
186 &ptr_info, &request); 187 &ptr_info, &request);
187 188
188 ptr->Bind(ptr_info.Pass()); 189 ptr->Bind(std::move(ptr_info));
189 return request.Pass(); 190 return std::move(request);
190 } 191 }
191 192
192 } // namespace mojo 193 } // namespace mojo
193 194
194 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ 195 #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