summaryrefslogtreecommitdiffstats
path: root/mojo/edk/embedder
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2015-12-18 13:07:16 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-18 21:08:36 +0000
commit2a370ee9320230d59b317e23e1778846c8d8035d (patch)
treeced6714341746502230134cfdd57a09236c5bf00 /mojo/edk/embedder
parent60b2cdd0d6238b60eb92c120970a7612a2841141 (diff)
downloadchromium_src-2a370ee9320230d59b317e23e1778846c8d8035d.zip
chromium_src-2a370ee9320230d59b317e23e1778846c8d8035d.tar.gz
chromium_src-2a370ee9320230d59b317e23e1778846c8d8035d.tar.bz2
Convert Pass()→std::move() in //mojo/edk
BUG=557422 R=avi@chromium.org TBR=ben@chromium.org Review URL: https://codereview.chromium.org/1529303004 Cr-Commit-Position: refs/heads/master@{#366167}
Diffstat (limited to 'mojo/edk/embedder')
-rw-r--r--mojo/edk/embedder/embedder.cc18
-rw-r--r--mojo/edk/embedder/embedder_unittest.cc16
-rw-r--r--mojo/edk/embedder/platform_channel_pair.cc6
-rw-r--r--mojo/edk/embedder/platform_channel_pair_posix_unittest.cc22
-rw-r--r--mojo/edk/embedder/simple_platform_shared_buffer.cc6
-rw-r--r--mojo/edk/embedder/simple_platform_shared_buffer_posix.cc4
-rw-r--r--mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc4
-rw-r--r--mojo/edk/embedder/simple_platform_support.cc4
8 files changed, 45 insertions, 35 deletions
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc
index b5363f3..10452369 100644
--- a/mojo/edk/embedder/embedder.cc
+++ b/mojo/edk/embedder/embedder.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/embedder/embedder.h"
+#include <utility>
+
#include "base/atomicops.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -64,11 +66,11 @@ ScopedPlatformHandle ChildProcessLaunched(base::ProcessHandle child_process) {
void ChildProcessLaunched(base::ProcessHandle child_process,
ScopedPlatformHandle server_pipe) {
- new ChildBrokerHost(child_process, server_pipe.Pass());
+ new ChildBrokerHost(child_process, std::move(server_pipe));
}
void SetParentPipeHandle(ScopedPlatformHandle pipe) {
- ChildBroker::GetInstance()->SetChildBrokerHostHandle(pipe.Pass());
+ ChildBroker::GetInstance()->SetChildBrokerHostHandle(std::move(pipe));
}
void Init() {
@@ -96,7 +98,7 @@ MojoResult CreatePlatformHandleWrapper(
DCHECK(platform_handle_wrapper_handle);
scoped_refptr<Dispatcher> dispatcher =
- PlatformHandleDispatcher::Create(platform_handle.Pass());
+ PlatformHandleDispatcher::Create(std::move(platform_handle));
DCHECK(internal::g_core);
MojoHandle h = internal::g_core->AddDispatcher(dispatcher);
@@ -123,10 +125,8 @@ MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
if (dispatcher->GetType() != Dispatcher::Type::PLATFORM_HANDLE)
return MOJO_RESULT_INVALID_ARGUMENT;
- *platform_handle =
- static_cast<PlatformHandleDispatcher*>(dispatcher.get())
- ->PassPlatformHandle()
- .Pass();
+ *platform_handle = static_cast<PlatformHandleDispatcher*>(dispatcher.get())
+ ->PassPlatformHandle();
return MOJO_RESULT_OK;
}
@@ -157,11 +157,11 @@ ScopedMessagePipeHandle CreateMessagePipe(
ScopedMessagePipeHandle rv(
MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher)));
CHECK(rv.is_valid());
- dispatcher->Init(platform_handle.Pass(), nullptr, 0, nullptr, 0, nullptr,
+ dispatcher->Init(std::move(platform_handle), nullptr, 0, nullptr, 0, nullptr,
nullptr);
// TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it
// once that's fixed.
- return rv.Pass();
+ return rv;
}
} // namespace edk
diff --git a/mojo/edk/embedder/embedder_unittest.cc b/mojo/edk/embedder/embedder_unittest.cc
index 4f6493f..eaab3b9 100644
--- a/mojo/edk/embedder/embedder_unittest.cc
+++ b/mojo/edk/embedder/embedder_unittest.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/embedder/embedder.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -357,9 +359,11 @@ TEST_F(EmbedderTest, MAYBE_MultiprocessChannels) {
multiprocess_test_helper.StartChild("MultiprocessChannelsClient");
{
- MojoHandle server_mp = CreateMessagePipe(
- multiprocess_test_helper.server_platform_handle.Pass()).release().
- value();
+ MojoHandle server_mp =
+ CreateMessagePipe(
+ std::move(multiprocess_test_helper.server_platform_handle))
+ .release()
+ .value();
// 1. Write a message to |server_mp| (attaching nothing).
const char kHello[] = "hello";
@@ -465,11 +469,11 @@ TEST_F(EmbedderTest, MAYBE_MultiprocessChannels) {
MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
ScopedPlatformHandle client_platform_handle =
- test::MultiprocessTestHelper::client_platform_handle.Pass();
+ std::move(test::MultiprocessTestHelper::client_platform_handle);
EXPECT_TRUE(client_platform_handle.is_valid());
- MojoHandle client_mp = CreateMessagePipe(
- client_platform_handle.Pass()).release().value();
+ MojoHandle client_mp =
+ CreateMessagePipe(std::move(client_platform_handle)).release().value();
// 1. Read the first message from |client_mp|.
MojoHandleSignalsState state;
diff --git a/mojo/edk/embedder/platform_channel_pair.cc b/mojo/edk/embedder/platform_channel_pair.cc
index b083df6..ee1905a 100644
--- a/mojo/edk/embedder/platform_channel_pair.cc
+++ b/mojo/edk/embedder/platform_channel_pair.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/embedder/platform_channel_pair.h"
+#include <utility>
+
#include "base/logging.h"
namespace mojo {
@@ -16,11 +18,11 @@ PlatformChannelPair::~PlatformChannelPair() {
}
ScopedPlatformHandle PlatformChannelPair::PassServerHandle() {
- return server_handle_.Pass();
+ return std::move(server_handle_);
}
ScopedPlatformHandle PlatformChannelPair::PassClientHandle() {
- return client_handle_.Pass();
+ return std::move(client_handle_);
}
void PlatformChannelPair::ChildProcessLaunched() {
diff --git a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
index 1874e42..179efb1 100644
--- a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
+++ b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
@@ -12,8 +12,8 @@
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
-
#include <deque>
+#include <utility>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -64,8 +64,8 @@ class PlatformChannelPairPosixTest : public testing::Test {
TEST_F(PlatformChannelPairPosixTest, NoSigPipe) {
PlatformChannelPair channel_pair;
- ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
- ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+ ScopedPlatformHandle server_handle = channel_pair.PassServerHandle();
+ ScopedPlatformHandle client_handle = channel_pair.PassClientHandle();
// Write to the client.
static const char kHello[] = "hello";
@@ -105,8 +105,8 @@ TEST_F(PlatformChannelPairPosixTest, NoSigPipe) {
TEST_F(PlatformChannelPairPosixTest, SendReceiveData) {
PlatformChannelPair channel_pair;
- ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
- ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+ ScopedPlatformHandle server_handle = channel_pair.PassServerHandle();
+ ScopedPlatformHandle client_handle = channel_pair.PassClientHandle();
for (size_t i = 0; i < 10; i++) {
std::string send_string(1 << i, 'A' + i);
@@ -134,8 +134,8 @@ TEST_F(PlatformChannelPairPosixTest, SendReceiveFDs) {
static const char kHello[] = "hello";
PlatformChannelPair channel_pair;
- ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
- ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+ ScopedPlatformHandle server_handle = channel_pair.PassServerHandle();
+ ScopedPlatformHandle client_handle = channel_pair.PassClientHandle();
// Reduce the number of FDs opened on OS X to avoid test flake.
#if defined(OS_MACOSX)
@@ -156,7 +156,7 @@ TEST_F(PlatformChannelPairPosixTest, SendReceiveFDs) {
ASSERT_TRUE(fp);
ASSERT_EQ(j, fwrite(std::string(j, c).data(), 1, j, fp.get()));
platform_handles->push_back(
- test::PlatformHandleFromFILE(fp.Pass()).release());
+ test::PlatformHandleFromFILE(std::move(fp)).release());
ASSERT_TRUE(platform_handles->back().is_valid());
}
@@ -200,8 +200,8 @@ TEST_F(PlatformChannelPairPosixTest, AppendReceivedFDs) {
static const char kHello[] = "hello";
PlatformChannelPair channel_pair;
- ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
- ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+ ScopedPlatformHandle server_handle = channel_pair.PassServerHandle();
+ ScopedPlatformHandle client_handle = channel_pair.PassClientHandle();
const std::string file_contents("hello world");
@@ -214,7 +214,7 @@ TEST_F(PlatformChannelPairPosixTest, AppendReceivedFDs) {
fwrite(file_contents.data(), 1, file_contents.size(), fp.get()));
ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector);
platform_handles->push_back(
- test::PlatformHandleFromFILE(fp.Pass()).release());
+ test::PlatformHandleFromFILE(std::move(fp)).release());
ASSERT_TRUE(platform_handles->back().is_valid());
// Send the FD (+ "hello").
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer.cc b/mojo/edk/embedder/simple_platform_shared_buffer.cc
index c09eb80..b33e5cd 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+#include <utility>
+
#include "base/logging.h"
#include "mojo/edk/embedder/platform_handle_utils.h"
@@ -34,7 +36,7 @@ SimplePlatformSharedBuffer::CreateFromPlatformHandle(
DCHECK_GT(num_bytes, 0u);
SimplePlatformSharedBuffer* rv = new SimplePlatformSharedBuffer(num_bytes);
- if (!rv->InitFromPlatformHandle(platform_handle.Pass())) {
+ if (!rv->InitFromPlatformHandle(std::move(platform_handle))) {
// We can't just delete it directly, due to the "in destructor" (debug)
// check.
scoped_refptr<SimplePlatformSharedBuffer> deleter(rv);
@@ -82,7 +84,7 @@ ScopedPlatformHandle SimplePlatformSharedBuffer::DuplicatePlatformHandle() {
ScopedPlatformHandle SimplePlatformSharedBuffer::PassPlatformHandle() {
DCHECK(HasOneRef());
- return handle_.Pass();
+ return std::move(handle_);
}
SimplePlatformSharedBuffer::SimplePlatformSharedBuffer(size_t num_bytes)
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc b/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
index 6759774..c3c1193 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
@@ -10,8 +10,8 @@
#include <sys/stat.h>
#include <sys/types.h> // For |off_t|.
#include <unistd.h>
-
#include <limits>
+#include <utility>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -114,7 +114,7 @@ bool SimplePlatformSharedBuffer::InitFromPlatformHandle(
// TODO(vtl): More checks?
- handle_ = platform_handle.Pass();
+ handle_ = std::move(platform_handle);
return true;
}
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
index f8b0d2d..4fa0a09 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
@@ -179,8 +179,8 @@ TEST(SimplePlatformSharedBufferTest, MappingsOutliveBuffer) {
{
scoped_refptr<SimplePlatformSharedBuffer> buffer(
SimplePlatformSharedBuffer::Create(100));
- mapping1 = buffer->Map(0, 100).Pass();
- mapping2 = buffer->Map(50, 50).Pass();
+ mapping1 = buffer->Map(0, 100);
+ mapping2 = buffer->Map(50, 50);
static_cast<char*>(mapping1->GetBase())[50] = 'x';
}
diff --git a/mojo/edk/embedder/simple_platform_support.cc b/mojo/edk/embedder/simple_platform_support.cc
index 814cd68..c17a7c8 100644
--- a/mojo/edk/embedder/simple_platform_support.cc
+++ b/mojo/edk/embedder/simple_platform_support.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/embedder/simple_platform_support.h"
+#include <utility>
+
#include "base/rand_util.h"
#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
@@ -24,7 +26,7 @@ PlatformSharedBuffer* SimplePlatformSupport::CreateSharedBufferFromHandle(
size_t num_bytes,
ScopedPlatformHandle platform_handle) {
return SimplePlatformSharedBuffer::CreateFromPlatformHandle(
- num_bytes, platform_handle.Pass());
+ num_bytes, std::move(platform_handle));
}
} // namespace edk