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

Side by Side Diff: base/task_scheduler/scheduler_worker_thread_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/task_scheduler/scheduler_worker_thread_stack.h"
6
7 #include <algorithm>
8
9 #include "base/logging.h"
10
11 namespace base {
12 namespace internal {
13
14 SchedulerWorkerThreadStack::SchedulerWorkerThreadStack() = default;
15
16 SchedulerWorkerThreadStack::~SchedulerWorkerThreadStack() = default;
17
18 void SchedulerWorkerThreadStack::Push(SchedulerWorkerThread* worker_thread) {
19 DCHECK(std::find(stack_.begin(), stack_.end(), worker_thread) == stack_.end())
20 << "SchedulerWorkerThread already on stack";
21 stack_.push_back(worker_thread);
22 }
23
24 SchedulerWorkerThread* SchedulerWorkerThreadStack::Pop() {
25 if (IsEmpty())
26 return nullptr;
27 SchedulerWorkerThread* const worker_thread = stack_.back();
28 stack_.pop_back();
29 return worker_thread;
30 }
31
32 void SchedulerWorkerThreadStack::Remove(
33 const SchedulerWorkerThread* worker_thread) {
34 auto it = std::find(stack_.begin(), stack_.end(), worker_thread);
35 if (it != stack_.end())
36 stack_.erase(it);
37 }
38
39 } // namespace internal
40 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698