| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 target_->WaitUntilThreadStarted(); | 88 target_->WaitUntilThreadStarted(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::vector<std::unique_ptr<Thread>> scheduling_threads; | 91 std::vector<std::unique_ptr<Thread>> scheduling_threads; |
| 92 scheduling_times_.reset(new base::TimeDelta[num_scheduling_threads]); | 92 scheduling_times_.reset(new base::TimeDelta[num_scheduling_threads]); |
| 93 scheduling_thread_times_.reset(new base::TimeDelta[num_scheduling_threads]); | 93 scheduling_thread_times_.reset(new base::TimeDelta[num_scheduling_threads]); |
| 94 min_batch_times_.reset(new base::TimeDelta[num_scheduling_threads]); | 94 min_batch_times_.reset(new base::TimeDelta[num_scheduling_threads]); |
| 95 max_batch_times_.reset(new base::TimeDelta[num_scheduling_threads]); | 95 max_batch_times_.reset(new base::TimeDelta[num_scheduling_threads]); |
| 96 | 96 |
| 97 for (int i = 0; i < num_scheduling_threads; ++i) { | 97 for (int i = 0; i < num_scheduling_threads; ++i) { |
| 98 scheduling_threads.push_back( | 98 scheduling_threads.push_back(MakeUnique<Thread>("posting thread")); |
| 99 WrapUnique(new Thread("posting thread"))); | |
| 100 scheduling_threads[i]->Start(); | 99 scheduling_threads[i]->Start(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 for (int i = 0; i < num_scheduling_threads; ++i) { | 102 for (int i = 0; i < num_scheduling_threads; ++i) { |
| 104 scheduling_threads[i]->task_runner()->PostTask( | 103 scheduling_threads[i]->task_runner()->PostTask( |
| 105 FROM_HERE, | 104 FROM_HERE, |
| 106 base::Bind(&ScheduleWorkTest::Schedule, base::Unretained(this), i)); | 105 base::Bind(&ScheduleWorkTest::Schedule, base::Unretained(this), i)); |
| 107 } | 106 } |
| 108 | 107 |
| 109 for (int i = 0; i < num_scheduling_threads; ++i) { | 108 for (int i = 0; i < num_scheduling_threads; ++i) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 295 |
| 297 TEST_F(PostTaskTest, TenTasksPerReload) { | 296 TEST_F(PostTaskTest, TenTasksPerReload) { |
| 298 Run(10000, 10); | 297 Run(10000, 10); |
| 299 } | 298 } |
| 300 | 299 |
| 301 TEST_F(PostTaskTest, OneHundredTasksPerReload) { | 300 TEST_F(PostTaskTest, OneHundredTasksPerReload) { |
| 302 Run(1000, 100); | 301 Run(1000, 100); |
| 303 } | 302 } |
| 304 | 303 |
| 305 } // namespace base | 304 } // namespace base |
| OLD | NEW |