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

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: Remove self-move checks to avoid triggering clang warning. Created 5 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 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 <utility>
9
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "mojo/public/cpp/bindings/associated_group.h" 12 #include "mojo/public/cpp/bindings/associated_group.h"
11 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" 13 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
12 #include "mojo/public/cpp/bindings/associated_interface_request.h" 14 #include "mojo/public/cpp/bindings/associated_interface_request.h"
13 #include "mojo/public/cpp/bindings/callback.h" 15 #include "mojo/public/cpp/bindings/callback.h"
14 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" 16 #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h"
15 17
16 namespace mojo { 18 namespace mojo {
17 19
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void Bind(AssociatedInterfacePtrInfo<GenericInterface> info) { 59 void Bind(AssociatedInterfacePtrInfo<GenericInterface> info) {
58 reset(); 60 reset();
59 61
60 bool is_local = 62 bool is_local =
61 internal::AssociatedInterfacePtrInfoHelper::GetHandle(&info).is_local(); 63 internal::AssociatedInterfacePtrInfoHelper::GetHandle(&info).is_local();
62 64
63 DCHECK(is_local) << "The AssociatedInterfacePtrInfo is supposed to be used " 65 DCHECK(is_local) << "The AssociatedInterfacePtrInfo is supposed to be used "
64 "at the other side of the message pipe."; 66 "at the other side of the message pipe.";
65 67
66 if (info.is_valid() && is_local) 68 if (info.is_valid() && is_local)
67 internal_state_.Bind(info.Pass()); 69 internal_state_.Bind(std::move(info));
68 } 70 }
69 71
70 bool is_bound() const { return internal_state_.is_bound(); } 72 bool is_bound() const { return internal_state_.is_bound(); }
71 73
72 Interface* get() const { return internal_state_.instance(); } 74 Interface* get() const { return internal_state_.instance(); }
73 75
74 // Functions like a pointer to Interface. Must already be bound. 76 // Functions like a pointer to Interface. Must already be bound.
75 Interface* operator->() const { return get(); } 77 Interface* operator->() const { return get(); }
76 Interface& operator*() const { return *get(); } 78 Interface& operator*() const { return *get(); }
77 79
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // until the request is bound to an implementation at the remote side. 178 // until the request is bound to an implementation at the remote side.
177 template <typename Interface> 179 template <typename Interface>
178 AssociatedInterfaceRequest<typename Interface::GenericInterface> GetProxy( 180 AssociatedInterfaceRequest<typename Interface::GenericInterface> GetProxy(
179 AssociatedInterfacePtr<Interface>* ptr, 181 AssociatedInterfacePtr<Interface>* ptr,
180 AssociatedGroup* group) { 182 AssociatedGroup* group) {
181 AssociatedInterfaceRequest<typename Interface::GenericInterface> request; 183 AssociatedInterfaceRequest<typename Interface::GenericInterface> request;
182 AssociatedInterfacePtrInfo<typename Interface::GenericInterface> ptr_info; 184 AssociatedInterfacePtrInfo<typename Interface::GenericInterface> ptr_info;
183 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST, 185 group->CreateAssociatedInterface(AssociatedGroup::WILL_PASS_REQUEST,
184 &ptr_info, &request); 186 &ptr_info, &request);
185 187
186 ptr->Bind(ptr_info.Pass()); 188 ptr->Bind(std::move(ptr_info));
187 return request.Pass(); 189 return std::move(request);
188 } 190 }
189 191
190 } // namespace mojo 192 } // namespace mojo
191 193
192 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_ 194 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_INTERFACE_PTR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698