| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |