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

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

Issue 2077093002: Rename SchedulerWorkerThread* to SchedulerWorker* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rename2
Patch Set: Created 4 years, 6 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_thread_stack.h" 5 #include "base/task_scheduler/scheduler_worker_stack.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace base { 11 namespace base {
12 namespace internal { 12 namespace internal {
13 13
14 SchedulerWorkerThreadStack::SchedulerWorkerThreadStack() = default; 14 SchedulerWorkerStack::SchedulerWorkerStack() = default;
15 15
16 SchedulerWorkerThreadStack::~SchedulerWorkerThreadStack() = default; 16 SchedulerWorkerStack::~SchedulerWorkerStack() = default;
17 17
18 void SchedulerWorkerThreadStack::Push(SchedulerWorkerThread* worker_thread) { 18 void SchedulerWorkerStack::Push(SchedulerWorker* worker) {
19 DCHECK(std::find(stack_.begin(), stack_.end(), worker_thread) == stack_.end()) 19 DCHECK(std::find(stack_.begin(), stack_.end(), worker) == stack_.end())
20 << "SchedulerWorkerThread already on stack"; 20 << "SchedulerWorker already on stack";
21 stack_.push_back(worker_thread); 21 stack_.push_back(worker);
22 } 22 }
23 23
24 SchedulerWorkerThread* SchedulerWorkerThreadStack::Pop() { 24 SchedulerWorker* SchedulerWorkerStack::Pop() {
25 if (IsEmpty()) 25 if (IsEmpty())
26 return nullptr; 26 return nullptr;
27 SchedulerWorkerThread* const worker_thread = stack_.back(); 27 SchedulerWorker* const worker = stack_.back();
28 stack_.pop_back(); 28 stack_.pop_back();
29 return worker_thread; 29 return worker;
30 } 30 }
31 31
32 void SchedulerWorkerThreadStack::Remove( 32 void SchedulerWorkerStack::Remove(const SchedulerWorker* worker) {
33 const SchedulerWorkerThread* worker_thread) { 33 auto it = std::find(stack_.begin(), stack_.end(), worker);
34 auto it = std::find(stack_.begin(), stack_.end(), worker_thread);
35 if (it != stack_.end()) 34 if (it != stack_.end())
36 stack_.erase(it); 35 stack_.erase(it);
37 } 36 }
38 37
39 } // namespace internal 38 } // namespace internal
40 } // namespace base 39 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698