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

Side by Side Diff: base/task_scheduler/scheduler_worker_thread_unittest.cc

Issue 1890163003: TaskScheduler: Add delayed run time to the constructor of Task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@7_sequenced
Patch Set: self review Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/task_scheduler/scheduler_worker_thread.h" 5 #include "base/task_scheduler/scheduler_worker_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return nullptr; 111 return nullptr;
112 --num_sequences_to_create_; 112 --num_sequences_to_create_;
113 } 113 }
114 114
115 // Create a Sequence with TasksPerSequence() Tasks. 115 // Create a Sequence with TasksPerSequence() Tasks.
116 scoped_refptr<Sequence> sequence(new Sequence); 116 scoped_refptr<Sequence> sequence(new Sequence);
117 for (size_t i = 0; i < TasksPerSequence(); ++i) { 117 for (size_t i = 0; i < TasksPerSequence(); ++i) {
118 std::unique_ptr<Task> task(new Task( 118 std::unique_ptr<Task> task(new Task(
119 FROM_HERE, Bind(&TaskSchedulerWorkerThreadTest::RunTaskCallback, 119 FROM_HERE, Bind(&TaskSchedulerWorkerThreadTest::RunTaskCallback,
120 Unretained(this)), 120 Unretained(this)),
121 TaskTraits())); 121 TaskTraits(), TimeTicks()));
122 EXPECT_TRUE(task_tracker_.WillPostTask(task.get())); 122 EXPECT_TRUE(task_tracker_.WillPostTask(task.get()));
123 sequence->PushTask(std::move(task)); 123 sequence->PushTask(std::move(task));
124 } 124 }
125 125
126 { 126 {
127 // Add the Sequence to the vector of created Sequences. 127 // Add the Sequence to the vector of created Sequences.
128 AutoSchedulerLock auto_lock(lock_); 128 AutoSchedulerLock auto_lock(lock_);
129 created_sequences_.push_back(sequence); 129 created_sequences_.push_back(sequence);
130 } 130 }
131 131
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 INSTANTIATE_TEST_CASE_P(OneTaskPerSequence, 255 INSTANTIATE_TEST_CASE_P(OneTaskPerSequence,
256 TaskSchedulerWorkerThreadTest, 256 TaskSchedulerWorkerThreadTest,
257 ::testing::Values(1)); 257 ::testing::Values(1));
258 INSTANTIATE_TEST_CASE_P(TwoTasksPerSequence, 258 INSTANTIATE_TEST_CASE_P(TwoTasksPerSequence,
259 TaskSchedulerWorkerThreadTest, 259 TaskSchedulerWorkerThreadTest,
260 ::testing::Values(2)); 260 ::testing::Values(2));
261 261
262 } // namespace 262 } // namespace
263 } // namespace internal 263 } // namespace internal
264 } // namespace base 264 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/priority_queue_unittest.cc ('k') | base/task_scheduler/sequence_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698