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

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: Regenerate correctly 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 419285ed2e5068166d4e3a7cc2c1548f806565cb..2c4c42ee3674236c96dabab856fee1f88b102f1a 100644
--- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -4,8 +4,8 @@
#include <stddef.h>
#include <stdint.h>
-
#include <algorithm>
+#include <utility>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -34,7 +34,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 {}
@@ -63,12 +63,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; });
}
@@ -78,8 +78,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_; }
@@ -107,9 +107,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>
@@ -124,8 +124,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.
@@ -150,28 +150,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) {
@@ -224,7 +224,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;
}
@@ -273,10 +273,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)));
@@ -351,9 +351,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];
@@ -362,7 +362,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];
@@ -440,9 +440,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];
@@ -451,7 +451,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];
@@ -527,7 +527,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);
« no previous file with comments | « mojo/public/cpp/bindings/tests/array_unittest.cc ('k') | mojo/public/cpp/bindings/tests/binding_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698