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

Side by Side Diff: base/message_loop/message_pump_perftest.cc

Issue 1886453003: Make PendingTask move-only and pass it by value on retaining params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac test fix Created 4 years, 5 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 | « base/message_loop/message_loop.cc ('k') | base/pending_task.h » ('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 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 do { 264 do {
265 for (int i = 0; i < batch_size; ++i) { 265 for (int i = 0; i < batch_size; ++i) {
266 for (int j = 0; j < tasks_per_reload; ++j) { 266 for (int j = 0; j < tasks_per_reload; ++j) {
267 queue->AddToIncomingQueue( 267 queue->AddToIncomingQueue(
268 FROM_HERE, base::Bind(&DoNothing), base::TimeDelta(), false); 268 FROM_HERE, base::Bind(&DoNothing), base::TimeDelta(), false);
269 num_posted++; 269 num_posted++;
270 } 270 }
271 TaskQueue loop_local_queue; 271 TaskQueue loop_local_queue;
272 queue->ReloadWorkQueue(&loop_local_queue); 272 queue->ReloadWorkQueue(&loop_local_queue);
273 while (!loop_local_queue.empty()) { 273 while (!loop_local_queue.empty()) {
274 PendingTask t = loop_local_queue.front(); 274 PendingTask t = std::move(loop_local_queue.front());
275 loop_local_queue.pop(); 275 loop_local_queue.pop();
276 loop.RunTask(t); 276 loop.RunTask(t);
277 } 277 }
278 } 278 }
279 279
280 now = base::TimeTicks::Now(); 280 now = base::TimeTicks::Now();
281 } while (now - start < base::TimeDelta::FromSeconds(5)); 281 } while (now - start < base::TimeDelta::FromSeconds(5));
282 std::string trace = StringPrintf("%d_tasks_per_reload", tasks_per_reload); 282 std::string trace = StringPrintf("%d_tasks_per_reload", tasks_per_reload);
283 perf_test::PrintResult( 283 perf_test::PrintResult(
284 "task", 284 "task",
(...skipping 11 matching lines...) Expand all
296 296
297 TEST_F(PostTaskTest, TenTasksPerReload) { 297 TEST_F(PostTaskTest, TenTasksPerReload) {
298 Run(10000, 10); 298 Run(10000, 10);
299 } 299 }
300 300
301 TEST_F(PostTaskTest, OneHundredTasksPerReload) { 301 TEST_F(PostTaskTest, OneHundredTasksPerReload) {
302 Run(1000, 100); 302 Run(1000, 100);
303 } 303 }
304 304
305 } // namespace base 305 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | base/pending_task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698