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

Side by Side Diff: ipc/ipc_perftest_support.cc

Issue 2087163003: Remove calls to deprecated MessageLoop methods in ipc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual changes Created 4 years, 6 months 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
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ipc/ipc_perftest_support.h" 5 #include "ipc/ipc_perftest_support.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/pickle.h" 17 #include "base/pickle.h"
18 #include "base/run_loop.h"
18 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
19 #include "base/test/perf_time_logger.h" 20 #include "base/test/perf_time_logger.h"
20 #include "base/test/test_io_thread.h" 21 #include "base/test/test_io_thread.h"
21 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
22 #include "base/time/time.h" 23 #include "base/time/time.h"
23 #include "build/build_config.h" 24 #include "build/build_config.h"
24 #include "ipc/ipc_channel.h" 25 #include "ipc/ipc_channel.h"
25 #include "ipc/ipc_channel_proxy.h" 26 #include "ipc/ipc_channel_proxy.h"
26 #include "ipc/ipc_descriptors.h" 27 #include "ipc/ipc_descriptors.h"
27 #include "ipc/ipc_message_utils.h" 28 #include "ipc/ipc_message_utils.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 263
263 // This initial message will kick-start the ping-pong of messages. 264 // This initial message will kick-start the ping-pong of messages.
264 Message* message = 265 Message* message =
265 new Message(0, 2, Message::PRIORITY_NORMAL); 266 new Message(0, 2, Message::PRIORITY_NORMAL);
266 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); 267 message->WriteInt64(base::TimeTicks::Now().ToInternalValue());
267 message->WriteInt(-1); 268 message->WriteInt(-1);
268 message->WriteString("hello"); 269 message->WriteString("hello");
269 sender()->Send(message); 270 sender()->Send(message);
270 271
271 // Run message loop. 272 // Run message loop.
272 base::MessageLoop::current()->Run(); 273 base::RunLoop().Run();
273 } 274 }
274 275
275 // Send quit message. 276 // Send quit message.
276 Message* message = new Message(0, 2, Message::PRIORITY_NORMAL); 277 Message* message = new Message(0, 2, Message::PRIORITY_NORMAL);
277 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); 278 message->WriteInt64(base::TimeTicks::Now().ToInternalValue());
278 message->WriteInt(-1); 279 message->WriteInt(-1);
279 message->WriteString("quit"); 280 message->WriteString("quit");
280 sender()->Send(message); 281 sender()->Send(message);
281 282
282 EXPECT_TRUE(WaitForClientShutdown()); 283 EXPECT_TRUE(WaitForClientShutdown());
(...skipping 19 matching lines...) Expand all
302 303
303 // This initial message will kick-start the ping-pong of messages. 304 // This initial message will kick-start the ping-pong of messages.
304 Message* message = 305 Message* message =
305 new Message(0, 2, Message::PRIORITY_NORMAL); 306 new Message(0, 2, Message::PRIORITY_NORMAL);
306 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); 307 message->WriteInt64(base::TimeTicks::Now().ToInternalValue());
307 message->WriteInt(-1); 308 message->WriteInt(-1);
308 message->WriteString("hello"); 309 message->WriteString("hello");
309 sender()->Send(message); 310 sender()->Send(message);
310 311
311 // Run message loop. 312 // Run message loop.
312 base::MessageLoop::current()->Run(); 313 base::RunLoop().Run();
313 } 314 }
314 315
315 // Send quit message. 316 // Send quit message.
316 Message* message = new Message(0, 2, Message::PRIORITY_NORMAL); 317 Message* message = new Message(0, 2, Message::PRIORITY_NORMAL);
317 message->WriteInt64(base::TimeTicks::Now().ToInternalValue()); 318 message->WriteInt64(base::TimeTicks::Now().ToInternalValue());
318 message->WriteInt(-1); 319 message->WriteInt(-1);
319 message->WriteString("quit"); 320 message->WriteString("quit");
320 sender()->Send(message); 321 sender()->Send(message);
321 322
322 EXPECT_TRUE(WaitForClientShutdown()); 323 EXPECT_TRUE(WaitForClientShutdown());
(...skipping 14 matching lines...) Expand all
337 return Channel::CreateClient(IPCTestBase::GetChannelName("PerformanceClient"), 338 return Channel::CreateClient(IPCTestBase::GetChannelName("PerformanceClient"),
338 listener); 339 listener);
339 } 340 }
340 341
341 int PingPongTestClient::RunMain() { 342 int PingPongTestClient::RunMain() {
342 LockThreadAffinity thread_locker(kSharedCore); 343 LockThreadAffinity thread_locker(kSharedCore);
343 std::unique_ptr<Channel> channel = CreateChannel(listener_.get()); 344 std::unique_ptr<Channel> channel = CreateChannel(listener_.get());
344 listener_->Init(channel.get()); 345 listener_->Init(channel.get());
345 CHECK(channel->Connect()); 346 CHECK(channel->Connect());
346 347
347 base::MessageLoop::current()->Run(); 348 base::RunLoop().Run();
348 return 0; 349 return 0;
349 } 350 }
350 351
351 scoped_refptr<base::TaskRunner> PingPongTestClient::task_runner() { 352 scoped_refptr<base::TaskRunner> PingPongTestClient::task_runner() {
352 return main_message_loop_.task_runner(); 353 return main_message_loop_.task_runner();
353 } 354 }
354 355
355 LockThreadAffinity::LockThreadAffinity(int cpu_number) 356 LockThreadAffinity::LockThreadAffinity(int cpu_number)
356 : affinity_set_ok_(false) { 357 : affinity_set_ok_(false) {
357 #if defined(OS_WIN) 358 #if defined(OS_WIN)
(...skipping 21 matching lines...) Expand all
379 auto set_result = SetThreadAffinityMask(GetCurrentThread(), old_affinity_); 380 auto set_result = SetThreadAffinityMask(GetCurrentThread(), old_affinity_);
380 DCHECK_NE(0u, set_result); 381 DCHECK_NE(0u, set_result);
381 #elif defined(OS_LINUX) 382 #elif defined(OS_LINUX)
382 auto set_result = sched_setaffinity(0, sizeof(old_cpuset_), &old_cpuset_); 383 auto set_result = sched_setaffinity(0, sizeof(old_cpuset_), &old_cpuset_);
383 DCHECK_EQ(0, set_result); 384 DCHECK_EQ(0, set_result);
384 #endif 385 #endif
385 } 386 }
386 387
387 } // namespace test 388 } // namespace test
388 } // namespace IPC 389 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698