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.h" | 5 #include "base/task_scheduler/scheduler_worker.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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 scoped_refptr<Sequence> sequence(new Sequence); | 443 scoped_refptr<Sequence> sequence(new Sequence); |
444 std::unique_ptr<Task> task(new Task( | 444 std::unique_ptr<Task> task(new Task( |
445 FROM_HERE, | 445 FROM_HERE, |
446 BindOnce( | 446 BindOnce( |
447 [](WaitableEvent* work_processed, WaitableEvent* work_running) { | 447 [](WaitableEvent* work_processed, WaitableEvent* work_running) { |
448 work_processed->Signal(); | 448 work_processed->Signal(); |
449 work_running->Wait(); | 449 work_running->Wait(); |
450 }, | 450 }, |
451 Unretained(&controls_->work_processed_), | 451 Unretained(&controls_->work_processed_), |
452 Unretained(&controls_->work_running_)), | 452 Unretained(&controls_->work_running_)), |
453 TaskTraits().WithBaseSyncPrimitives().WithShutdownBehavior( | 453 {WithBaseSyncPrimitives(), TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
454 TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), | |
455 TimeDelta())); | 454 TimeDelta())); |
456 EXPECT_TRUE(task_tracker_->WillPostTask(task.get())); | 455 EXPECT_TRUE(task_tracker_->WillPostTask(task.get())); |
457 sequence->PushTask(std::move(task)); | 456 sequence->PushTask(std::move(task)); |
458 return sequence; | 457 return sequence; |
459 } | 458 } |
460 | 459 |
461 void DidRunTask() override {} | 460 void DidRunTask() override {} |
462 | 461 |
463 bool CanDetach(SchedulerWorker* worker) override { | 462 bool CanDetach(SchedulerWorker* worker) override { |
464 // Saving |can_detach_| now so that callers waiting on |detach_requested_| | 463 // Saving |can_detach_| now so that callers waiting on |detach_requested_| |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 // COM library wasn't already initialized on the thread. | 954 // COM library wasn't already initialized on the thread. |
956 EXPECT_EQ(S_OK, delegate_raw->coinitialize_hresult()); | 955 EXPECT_EQ(S_OK, delegate_raw->coinitialize_hresult()); |
957 | 956 |
958 worker->JoinForTesting(); | 957 worker->JoinForTesting(); |
959 } | 958 } |
960 | 959 |
961 #endif // defined(OS_WIN) | 960 #endif // defined(OS_WIN) |
962 | 961 |
963 } // namespace internal | 962 } // namespace internal |
964 } // namespace base | 963 } // namespace base |
OLD | NEW |