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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
99 WrapUnique(new Thread("posting thread"))); | 99 WrapUnique(new Thread("posting thread"))); |
100 scheduling_threads[i]->Start(); | 100 scheduling_threads[i]->Start(); |
101 } | 101 } |
102 | 102 |
103 for (int i = 0; i < num_scheduling_threads; ++i) { | 103 for (int i = 0; i < num_scheduling_threads; ++i) { |
104 scheduling_threads[i]->message_loop()->task_runner()->PostTask( | 104 scheduling_threads[i]->task_runner()->PostTask( |
105 FROM_HERE, | 105 FROM_HERE, |
106 base::Bind(&ScheduleWorkTest::Schedule, base::Unretained(this), i)); | 106 base::Bind(&ScheduleWorkTest::Schedule, base::Unretained(this), i)); |
107 } | 107 } |
108 | 108 |
109 for (int i = 0; i < num_scheduling_threads; ++i) { | 109 for (int i = 0; i < num_scheduling_threads; ++i) { |
110 scheduling_threads[i]->Stop(); | 110 scheduling_threads[i]->Stop(); |
111 } | 111 } |
112 #if defined(OS_ANDROID) | 112 #if defined(OS_ANDROID) |
113 if (target_type == MessageLoop::TYPE_JAVA) { | 113 if (target_type == MessageLoop::TYPE_JAVA) { |
114 java_thread_->Stop(); | 114 java_thread_->Stop(); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |