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

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

Issue 2258713003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 protected: 61 protected:
62 TaskSchedulerWorkerTest() 62 TaskSchedulerWorkerTest()
63 : main_entry_called_(WaitableEvent::ResetPolicy::MANUAL, 63 : main_entry_called_(WaitableEvent::ResetPolicy::MANUAL,
64 WaitableEvent::InitialState::NOT_SIGNALED), 64 WaitableEvent::InitialState::NOT_SIGNALED),
65 num_get_work_cv_(lock_.CreateConditionVariable()), 65 num_get_work_cv_(lock_.CreateConditionVariable()),
66 worker_set_(WaitableEvent::ResetPolicy::MANUAL, 66 worker_set_(WaitableEvent::ResetPolicy::MANUAL,
67 WaitableEvent::InitialState::NOT_SIGNALED) {} 67 WaitableEvent::InitialState::NOT_SIGNALED) {}
68 68
69 void SetUp() override { 69 void SetUp() override {
70 worker_ = SchedulerWorker::Create( 70 worker_ = SchedulerWorker::Create(
71 ThreadPriority::NORMAL, 71 ThreadPriority::NORMAL, MakeUnique<TestSchedulerWorkerDelegate>(this),
72 WrapUnique(new TestSchedulerWorkerDelegate(this)), 72 &task_tracker_, SchedulerWorker::InitialState::ALIVE);
73 &task_tracker_,
74 SchedulerWorker::InitialState::ALIVE);
75 ASSERT_TRUE(worker_); 73 ASSERT_TRUE(worker_);
76 worker_set_.Signal(); 74 worker_set_.Signal();
77 main_entry_called_.Wait(); 75 main_entry_called_.Wait();
78 } 76 }
79 77
80 void TearDown() override { 78 void TearDown() override {
81 worker_->JoinForTesting(); 79 worker_->JoinForTesting();
82 } 80 }
83 81
84 size_t TasksPerSequence() const { return GetParam(); } 82 size_t TasksPerSequence() const { return GetParam(); }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 // OnMainEntry() and GetWork() are called. 544 // OnMainEntry() and GetWork() are called.
547 worker->WakeUp(); 545 worker->WakeUp();
548 delegate_raw->WaitForPriorityVerifiedInGetWork(); 546 delegate_raw->WaitForPriorityVerifiedInGetWork();
549 547
550 worker->JoinForTesting(); 548 worker->JoinForTesting();
551 } 549 }
552 550
553 } // namespace 551 } // namespace
554 } // namespace internal 552 } // namespace internal
555 } // namespace base 553 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698