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

Side by Side Diff: mojo/edk/system/message_pipe_perftest.cc

Issue 1529303004: Convert Pass()→std::move() in mojo/edk/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <utility>
6
5 #include "base/bind.h" 7 #include "base/bind.h"
6 #include "base/logging.h" 8 #include "base/logging.h"
7 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
8 #include "base/test/perf_time_logger.h" 10 #include "base/test/perf_time_logger.h"
9 #include "mojo/edk/embedder/embedder.h" 11 #include "mojo/edk/embedder/embedder.h"
10 #include "mojo/edk/embedder/scoped_platform_handle.h" 12 #include "mojo/edk/embedder/scoped_platform_handle.h"
11 #include "mojo/edk/system/handle_signals_state.h" 13 #include "mojo/edk/system/handle_signals_state.h"
12 #include "mojo/edk/system/message_pipe_test_utils.h" 14 #include "mojo/edk/system/message_pipe_test_utils.h"
13 #include "mojo/edk/system/test_utils.h" 15 #include "mojo/edk/system/test_utils.h"
14 #include "mojo/edk/test/test_utils.h" 16 #include "mojo/edk/test/test_utils.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 std::string read_buffer_; 81 std::string read_buffer_;
80 scoped_ptr<base::PerfTimeLogger> perf_logger_; 82 scoped_ptr<base::PerfTimeLogger> perf_logger_;
81 }; 83 };
82 84
83 // For each message received, sends a reply message with the same contents 85 // For each message received, sends a reply message with the same contents
84 // repeated twice, until the other end is closed or it receives "quitquitquit" 86 // repeated twice, until the other end is closed or it receives "quitquitquit"
85 // (which it doesn't reply to). It'll return the number of messages received, 87 // (which it doesn't reply to). It'll return the number of messages received,
86 // not including any "quitquitquit" message, modulo 100. 88 // not including any "quitquitquit" message, modulo 100.
87 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) { 89 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
88 ScopedPlatformHandle client_platform_handle = 90 ScopedPlatformHandle client_platform_handle =
89 test::MultiprocessTestHelper::client_platform_handle.Pass(); 91 std::move(test::MultiprocessTestHelper::client_platform_handle);
90 CHECK(client_platform_handle.is_valid()); 92 CHECK(client_platform_handle.is_valid());
91 ScopedMessagePipeHandle mp = 93 ScopedMessagePipeHandle mp =
92 CreateMessagePipe(client_platform_handle.Pass()); 94 CreateMessagePipe(std::move(client_platform_handle));
93 95
94 std::string buffer(1000000, '\0'); 96 std::string buffer(1000000, '\0');
95 int rv = 0; 97 int rv = 0;
96 while (true) { 98 while (true) {
97 // Wait for our end of the message pipe to be readable. 99 // Wait for our end of the message pipe to be readable.
98 HandleSignalsState hss; 100 HandleSignalsState hss;
99 MojoResult result = 101 MojoResult result =
100 MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE, 102 MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
101 MOJO_DEADLINE_INDEFINITE, &hss); 103 MOJO_DEADLINE_INDEFINITE, &hss);
102 if (result != MOJO_RESULT_OK) { 104 if (result != MOJO_RESULT_OK) {
(...skipping 25 matching lines...) Expand all
128 // number of messages has been sent. 130 // number of messages has been sent.
129 #if defined(OS_ANDROID) 131 #if defined(OS_ANDROID)
130 // Android multi-process tests are not executing the new process. This is flaky. 132 // Android multi-process tests are not executing the new process. This is flaky.
131 #define MAYBE_PingPong DISABLED_PingPong 133 #define MAYBE_PingPong DISABLED_PingPong
132 #else 134 #else
133 #define MAYBE_PingPong PingPong 135 #define MAYBE_PingPong PingPong
134 #endif // defined(OS_ANDROID) 136 #endif // defined(OS_ANDROID)
135 TEST_F(MultiprocessMessagePipePerfTest, MAYBE_PingPong) { 137 TEST_F(MultiprocessMessagePipePerfTest, MAYBE_PingPong) {
136 helper()->StartChild("PingPongClient"); 138 helper()->StartChild("PingPongClient");
137 139
138 ScopedMessagePipeHandle mp = CreateMessagePipe( 140 ScopedMessagePipeHandle mp =
139 helper()->server_platform_handle.Pass()); 141 CreateMessagePipe(std::move(helper()->server_platform_handle));
140 142
141 // This values are set to align with one at ipc_pertests.cc for comparison. 143 // This values are set to align with one at ipc_pertests.cc for comparison.
142 const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832}; 144 const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832};
143 const int kMessageCount[5] = {50000, 50000, 50000, 12000, 1000}; 145 const int kMessageCount[5] = {50000, 50000, 50000, 12000, 1000};
144 146
145 for (size_t i = 0; i < 5; i++) { 147 for (size_t i = 0; i < 5; i++) {
146 SetUpMeasurement(kMessageCount[i], kMsgSize[i]); 148 SetUpMeasurement(kMessageCount[i], kMsgSize[i]);
147 Measure(mp.get().value()); 149 Measure(mp.get().value());
148 } 150 }
149 151
150 SendQuitMessage(mp.get().value()); 152 SendQuitMessage(mp.get().value());
151 EXPECT_EQ(0, helper()->WaitForChildShutdown()); 153 EXPECT_EQ(0, helper()->WaitForChildShutdown());
152 } 154 }
153 155
154 } // namespace 156 } // namespace
155 } // namespace edk 157 } // namespace edk
156 } // namespace mojo 158 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698