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

Unified Diff: mojo/public/cpp/bindings/tests/associated_interface_unittest.cc

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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
index ccf2a4109f1454775140f7efe0cfac335ce3a783..1aa03ebfe9c0c16e4f76d14172a11f9b4726c181 100644
--- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <algorithm>
+#include <utility>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -31,7 +32,7 @@ using mojo::internal::ScopedInterfaceEndpointHandle;
class IntegerSenderImpl : public IntegerSender {
public:
explicit IntegerSenderImpl(AssociatedInterfaceRequest<IntegerSender> request)
- : binding_(this, request.Pass()) {}
+ : binding_(this, std::move(request)) {}
~IntegerSenderImpl() override {}
@@ -60,12 +61,12 @@ class IntegerSenderConnectionImpl : public IntegerSenderConnection {
public:
explicit IntegerSenderConnectionImpl(
InterfaceRequest<IntegerSenderConnection> request)
- : binding_(this, request.Pass()) {}
+ : binding_(this, std::move(request)) {}
~IntegerSenderConnectionImpl() override {}
void GetSender(AssociatedInterfaceRequest<IntegerSender> sender) override {
- IntegerSenderImpl* sender_impl = new IntegerSenderImpl(sender.Pass());
+ IntegerSenderImpl* sender_impl = new IntegerSenderImpl(std::move(sender));
sender_impl->set_connection_error_handler(
[sender_impl]() { delete sender_impl; });
}
@@ -75,8 +76,8 @@ class IntegerSenderConnectionImpl : public IntegerSenderConnection {
AssociatedInterfacePtrInfo<IntegerSender> ptr_info;
binding_.associated_group()->CreateAssociatedInterface(
AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
- GetSender(request.Pass());
- callback.Run(ptr_info.Pass());
+ GetSender(std::move(request));
+ callback.Run(std::move(ptr_info));
}
Binding<IntegerSenderConnection>* binding() { return &binding_; }
@@ -104,9 +105,9 @@ class AssociatedInterfaceTest : public testing::Test {
target->CreateLocalEndpointHandle(handle.release());
AssociatedInterfacePtrInfo<T> result;
- AssociatedInterfacePtrInfoHelper::SetHandle(&result, new_handle.Pass());
+ AssociatedInterfacePtrInfoHelper::SetHandle(&result, std::move(new_handle));
result.set_version(ptr_info.version());
- return result.Pass();
+ return std::move(result);
}
template <typename T>
@@ -121,8 +122,8 @@ class AssociatedInterfaceTest : public testing::Test {
target->CreateLocalEndpointHandle(handle.release());
AssociatedInterfaceRequest<T> result;
- AssociatedInterfaceRequestHelper::SetHandle(&result, new_handle.Pass());
- return result.Pass();
+ AssociatedInterfaceRequestHelper::SetHandle(&result, std::move(new_handle));
+ return std::move(result);
}
// Okay to call from any thread.
@@ -147,28 +148,28 @@ TEST_F(AssociatedInterfaceTest, InterfacesAtBothEnds) {
MessagePipe pipe;
scoped_refptr<MultiplexRouter> router0(
- new MultiplexRouter(true, pipe.handle0.Pass()));
+ new MultiplexRouter(true, std::move(pipe.handle0)));
scoped_refptr<MultiplexRouter> router1(
- new MultiplexRouter(false, pipe.handle1.Pass()));
+ new MultiplexRouter(false, std::move(pipe.handle1)));
AssociatedInterfaceRequest<IntegerSender> request;
AssociatedInterfacePtrInfo<IntegerSender> ptr_info;
router0->CreateAssociatedGroup()->CreateAssociatedInterface(
AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
- ptr_info = EmulatePassingAssociatedPtrInfo(ptr_info.Pass(), router1);
+ ptr_info = EmulatePassingAssociatedPtrInfo(std::move(ptr_info), router1);
- IntegerSenderImpl impl0(request.Pass());
+ IntegerSenderImpl impl0(std::move(request));
AssociatedInterfacePtr<IntegerSender> ptr0;
- ptr0.Bind(ptr_info.Pass());
+ ptr0.Bind(std::move(ptr_info));
router0->CreateAssociatedGroup()->CreateAssociatedInterface(
AssociatedGroup::WILL_PASS_REQUEST, &ptr_info, &request);
- request = EmulatePassingAssociatedRequest(request.Pass(), router1);
+ request = EmulatePassingAssociatedRequest(std::move(request), router1);
- IntegerSenderImpl impl1(request.Pass());
+ IntegerSenderImpl impl1(std::move(request));
AssociatedInterfacePtr<IntegerSender> ptr1;
- ptr1.Bind(ptr_info.Pass());
+ ptr1.Bind(std::move(ptr_info));
bool ptr0_callback_run = false;
ptr0->Echo(123, [&ptr0_callback_run](int32_t value) {
@@ -221,7 +222,7 @@ class TestSender {
int32_t max_value_to_send) {
CHECK(sender_thread_.task_runner()->BelongsToCurrentThread());
- ptr_.Bind(ptr_info.Pass());
+ ptr_.Bind(std::move(ptr_info));
next_sender_ = next_sender ? next_sender : this;
max_value_to_send_ = max_value_to_send;
}
@@ -270,10 +271,10 @@ class TestReceiver {
const base::Closure& notify_finish) {
CHECK(receiver_thread_.task_runner()->BelongsToCurrentThread());
- impl0_.reset(new IntegerSenderImpl(request0.Pass()));
+ impl0_.reset(new IntegerSenderImpl(std::move(request0)));
impl0_->set_notify_send_method_called(
base::Bind(&TestReceiver::SendMethodCalled, base::Unretained(this)));
- impl1_.reset(new IntegerSenderImpl(request1.Pass()));
+ impl1_.reset(new IntegerSenderImpl(std::move(request1)));
impl1_->set_notify_send_method_called(
base::Bind(&TestReceiver::SendMethodCalled, base::Unretained(this)));
@@ -348,9 +349,9 @@ TEST_F(AssociatedInterfaceTest, MultiThreadAccess) {
const int32_t kMaxValue = 1000;
MessagePipe pipe;
scoped_refptr<MultiplexRouter> router0(
- new MultiplexRouter(true, pipe.handle0.Pass()));
+ new MultiplexRouter(true, std::move(pipe.handle0)));
scoped_refptr<MultiplexRouter> router1(
- new MultiplexRouter(false, pipe.handle1.Pass()));
+ new MultiplexRouter(false, std::move(pipe.handle1)));
AssociatedInterfaceRequest<IntegerSender> requests[4];
AssociatedInterfacePtrInfo<IntegerSender> ptr_infos[4];
@@ -359,7 +360,7 @@ TEST_F(AssociatedInterfaceTest, MultiThreadAccess) {
router0->CreateAssociatedGroup()->CreateAssociatedInterface(
AssociatedGroup::WILL_PASS_PTR, &ptr_infos[i], &requests[i]);
ptr_infos[i] =
- EmulatePassingAssociatedPtrInfo(ptr_infos[i].Pass(), router1);
+ EmulatePassingAssociatedPtrInfo(std::move(ptr_infos[i]), router1);
}
TestSender senders[4];
@@ -437,9 +438,9 @@ TEST_F(AssociatedInterfaceTest, FIFO) {
const int32_t kMaxValue = 100;
MessagePipe pipe;
scoped_refptr<MultiplexRouter> router0(
- new MultiplexRouter(true, pipe.handle0.Pass()));
+ new MultiplexRouter(true, std::move(pipe.handle0)));
scoped_refptr<MultiplexRouter> router1(
- new MultiplexRouter(false, pipe.handle1.Pass()));
+ new MultiplexRouter(false, std::move(pipe.handle1)));
AssociatedInterfaceRequest<IntegerSender> requests[4];
AssociatedInterfacePtrInfo<IntegerSender> ptr_infos[4];
@@ -448,7 +449,7 @@ TEST_F(AssociatedInterfaceTest, FIFO) {
router0->CreateAssociatedGroup()->CreateAssociatedInterface(
AssociatedGroup::WILL_PASS_PTR, &ptr_infos[i], &requests[i]);
ptr_infos[i] =
- EmulatePassingAssociatedPtrInfo(ptr_infos[i].Pass(), router1);
+ EmulatePassingAssociatedPtrInfo(std::move(ptr_infos[i]), router1);
}
TestSender senders[4];
@@ -524,7 +525,7 @@ TEST_F(AssociatedInterfaceTest, PassAssociatedInterfaces) {
IntegerSenderAssociatedPtr sender1;
connection_ptr->AsyncGetSender(
[&sender1](AssociatedInterfacePtrInfo<IntegerSender> ptr_info) {
- sender1.Bind(ptr_info.Pass());
+ sender1.Bind(std::move(ptr_info));
});
PumpMessages();
EXPECT_TRUE(sender1);

Powered by Google App Engine
This is Rietveld 408576698