OLD | NEW |
---|---|
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/task_scheduler_impl.h" | 5 #include "base/task_scheduler/task_scheduler_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 | 114 |
115 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraitsAndExecutionMode( | 115 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraitsAndExecutionMode( |
116 TaskScheduler* scheduler, | 116 TaskScheduler* scheduler, |
117 const TaskTraits& traits, | 117 const TaskTraits& traits, |
118 test::ExecutionMode execution_mode) { | 118 test::ExecutionMode execution_mode) { |
119 switch (execution_mode) { | 119 switch (execution_mode) { |
120 case test::ExecutionMode::PARALLEL: | 120 case test::ExecutionMode::PARALLEL: |
121 return scheduler->CreateTaskRunnerWithTraits(traits); | 121 return scheduler->CreateTaskRunnerWithTraits(traits); |
122 case test::ExecutionMode::SEQUENCED: | 122 case test::ExecutionMode::SEQUENCED: |
123 return scheduler->CreateSequencedTaskRunnerWithTraits(traits); | 123 return scheduler->CreateSequencedTaskRunnerWithTraits(traits); |
124 case test::ExecutionMode::SINGLE_THREADED: | 124 case test::ExecutionMode::SINGLE_THREADED: { |
gab
2017/05/15 21:02:26
In CL which will introduce real sharding we should
robliao
2017/05/15 21:19:10
Agreed.
| |
125 return scheduler->CreateSingleThreadTaskRunnerWithTraits(traits); | 125 return scheduler->CreateSingleThreadTaskRunnerWithTraits( |
126 traits, SingleThreadTaskRunnerThreadMode::SHARED); | |
127 } | |
126 } | 128 } |
127 ADD_FAILURE() << "Unknown ExecutionMode"; | 129 ADD_FAILURE() << "Unknown ExecutionMode"; |
128 return nullptr; | 130 return nullptr; |
129 } | 131 } |
130 | 132 |
131 class ThreadPostingTasks : public SimpleThread { | 133 class ThreadPostingTasks : public SimpleThread { |
132 public: | 134 public: |
133 // Creates a thread that posts Tasks to |scheduler| with |traits| and | 135 // Creates a thread that posts Tasks to |scheduler| with |traits| and |
134 // |execution_mode|. | 136 // |execution_mode|. |
135 ThreadPostingTasks(TaskSchedulerImpl* scheduler, | 137 ThreadPostingTasks(TaskSchedulerImpl* scheduler, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 // Give a chance for the file watcher to fire before closing the handles. | 517 // Give a chance for the file watcher to fire before closing the handles. |
516 PlatformThread::Sleep(TestTimeouts::tiny_timeout()); | 518 PlatformThread::Sleep(TestTimeouts::tiny_timeout()); |
517 | 519 |
518 EXPECT_EQ(0, IGNORE_EINTR(close(pipes[0]))); | 520 EXPECT_EQ(0, IGNORE_EINTR(close(pipes[0]))); |
519 EXPECT_EQ(0, IGNORE_EINTR(close(pipes[1]))); | 521 EXPECT_EQ(0, IGNORE_EINTR(close(pipes[1]))); |
520 } | 522 } |
521 #endif // defined(OS_POSIX) | 523 #endif // defined(OS_POSIX) |
522 | 524 |
523 } // namespace internal | 525 } // namespace internal |
524 } // namespace base | 526 } // namespace base |
OLD | NEW |