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/scheduler_worker_pool_impl.h" | 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 constexpr size_t kNumWorkersInWorkerPool = 4; | 46 constexpr size_t kNumWorkersInWorkerPool = 4; |
47 constexpr size_t kNumThreadsPostingTasks = 4; | 47 constexpr size_t kNumThreadsPostingTasks = 4; |
48 constexpr size_t kNumTasksPostedPerThread = 150; | 48 constexpr size_t kNumTasksPostedPerThread = 150; |
49 // This can't be lower because Windows' WaitableEvent wakes up too early when a | 49 // This can't be lower because Windows' WaitableEvent wakes up too early when a |
50 // small timeout is used. This results in many spurious wake ups before a worker | 50 // small timeout is used. This results in many spurious wake ups before a worker |
51 // is allowed to detach. | 51 // is allowed to detach. |
52 constexpr TimeDelta kReclaimTimeForDetachTests = | 52 constexpr TimeDelta kReclaimTimeForDetachTests = |
53 TimeDelta::FromMilliseconds(500); | 53 TimeDelta::FromMilliseconds(500); |
54 constexpr TimeDelta kExtraTimeToWaitForDetach = | 54 constexpr TimeDelta kExtraTimeToWaitForDetach = |
55 TimeDelta::FromMilliseconds(200); | 55 TimeDelta::FromSeconds(1); |
56 | 56 |
57 using IORestriction = SchedulerWorkerPoolParams::IORestriction; | 57 using IORestriction = SchedulerWorkerPoolParams::IORestriction; |
58 | 58 |
59 class TestDelayedTaskManager : public DelayedTaskManager { | 59 class TestDelayedTaskManager : public DelayedTaskManager { |
60 public: | 60 public: |
61 TestDelayedTaskManager() : DelayedTaskManager(Bind(&DoNothing)) {} | 61 TestDelayedTaskManager() : DelayedTaskManager(Bind(&DoNothing)) {} |
62 | 62 |
63 void SetCurrentTime(TimeTicks now) { now_ = now; } | 63 void SetCurrentTime(TimeTicks now) { now_ = now; } |
64 | 64 |
65 // DelayedTaskManager: | 65 // DelayedTaskManager: |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 ->SnapshotSamples() | 718 ->SnapshotSamples() |
719 ->GetCount(10)); | 719 ->GetCount(10)); |
720 | 720 |
721 tasks_can_exit_event.Signal(); | 721 tasks_can_exit_event.Signal(); |
722 worker_pool_->WaitForAllWorkersIdleForTesting(); | 722 worker_pool_->WaitForAllWorkersIdleForTesting(); |
723 worker_pool_->DisallowWorkerDetachmentForTesting(); | 723 worker_pool_->DisallowWorkerDetachmentForTesting(); |
724 } | 724 } |
725 | 725 |
726 } // namespace internal | 726 } // namespace internal |
727 } // namespace base | 727 } // namespace base |
OLD | NEW |