| 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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 // beginning of the test. | 712 // beginning of the test. |
| 713 EXPECT_EQ(static_cast<int>(kNumWorkersInWorkerPool), | 713 EXPECT_EQ(static_cast<int>(kNumWorkersInWorkerPool), |
| 714 histogram->SnapshotSamples()->GetCount(1)); | 714 histogram->SnapshotSamples()->GetCount(1)); |
| 715 EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); | 715 EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); |
| 716 | 716 |
| 717 tasks_can_exit_event.Signal(); | 717 tasks_can_exit_event.Signal(); |
| 718 worker_pool_->WaitForAllWorkersIdleForTesting(); | 718 worker_pool_->WaitForAllWorkersIdleForTesting(); |
| 719 worker_pool_->DisallowWorkerDetachmentForTesting(); | 719 worker_pool_->DisallowWorkerDetachmentForTesting(); |
| 720 } | 720 } |
| 721 | 721 |
| 722 TEST_F(TaskSchedulerWorkerPoolHistogramTest, NumTasksBeforeDetach) { | 722 // TODO(crbug.com/698046): disabled due to flakyness. |
| 723 TEST_F(TaskSchedulerWorkerPoolHistogramTest, DISABLED_NumTasksBeforeDetach) { |
| 723 InitializeWorkerPool(kReclaimTimeForDetachTests, kNumWorkersInWorkerPool); | 724 InitializeWorkerPool(kReclaimTimeForDetachTests, kNumWorkersInWorkerPool); |
| 724 | 725 |
| 725 auto histogrammed_thread_task_runner = | 726 auto histogrammed_thread_task_runner = |
| 726 worker_pool_->CreateSequencedTaskRunnerWithTraits( | 727 worker_pool_->CreateSequencedTaskRunnerWithTraits( |
| 727 TaskTraits().WithBaseSyncPrimitives()); | 728 TaskTraits().WithBaseSyncPrimitives()); |
| 728 | 729 |
| 729 // Post 3 tasks and hold the thread for idle thread stack ordering. | 730 // Post 3 tasks and hold the thread for idle thread stack ordering. |
| 730 // This test assumes |histogrammed_thread_task_runner| gets assigned the same | 731 // This test assumes |histogrammed_thread_task_runner| gets assigned the same |
| 731 // thread for each of its tasks. | 732 // thread for each of its tasks. |
| 732 PlatformThreadRef thread_ref; | 733 PlatformThreadRef thread_ref; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 StandbyThreadPolicy::ONE, 8U, TimeDelta::Max()), | 851 StandbyThreadPolicy::ONE, 8U, TimeDelta::Max()), |
| 851 Bind(&NotReachedReEnqueueSequenceCallback), &task_tracker, | 852 Bind(&NotReachedReEnqueueSequenceCallback), &task_tracker, |
| 852 &delayed_task_manager); | 853 &delayed_task_manager); |
| 853 ASSERT_TRUE(worker_pool); | 854 ASSERT_TRUE(worker_pool); |
| 854 EXPECT_EQ(1U, worker_pool->NumberOfAliveWorkersForTesting()); | 855 EXPECT_EQ(1U, worker_pool->NumberOfAliveWorkersForTesting()); |
| 855 worker_pool->JoinForTesting(); | 856 worker_pool->JoinForTesting(); |
| 856 } | 857 } |
| 857 | 858 |
| 858 } // namespace internal | 859 } // namespace internal |
| 859 } // namespace base | 860 } // namespace base |
| OLD | NEW |