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

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

Issue 1869803002: TaskScheduler: Small improvements in SchedulerWorkerThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2_gab_unittest_comments
Patch Set: Created 4 years, 8 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
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "base/task_scheduler/scheduler_worker_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 SchedulerWorkerThread::SchedulerWorkerThread( 48 SchedulerWorkerThread::SchedulerWorkerThread(
49 ThreadPriority thread_priority, 49 ThreadPriority thread_priority,
50 SchedulerWorkerThreadDelegate* delegate, 50 SchedulerWorkerThreadDelegate* delegate,
51 TaskTracker* task_tracker) 51 TaskTracker* task_tracker)
52 : wake_up_event_(false, false), 52 : wake_up_event_(false, false),
53 delegate_(delegate), 53 delegate_(delegate),
54 task_tracker_(task_tracker) { 54 task_tracker_(task_tracker) {
55 DCHECK(delegate_); 55 DCHECK(delegate_);
56 DCHECK(task_tracker_); 56 DCHECK(task_tracker_);
57 57
58 static const size_t kDefaultStackSize = 0; 58 const size_t kDefaultStackSize = 0;
59 PlatformThread::CreateWithPriority(kDefaultStackSize, this, &thread_handle_, 59 PlatformThread::CreateWithPriority(kDefaultStackSize, this, &thread_handle_,
60 thread_priority); 60 thread_priority);
61 } 61 }
62 62
63 void SchedulerWorkerThread::ThreadMain() { 63 void SchedulerWorkerThread::ThreadMain() {
64 delegate_->OnMainEntry(); 64 delegate_->OnMainEntry();
65 65
66 // A SchedulerWorkerThread starts out sleeping. 66 // A SchedulerWorkerThread starts out sleeping.
67 wake_up_event_.Wait(); 67 wake_up_event_.Wait();
68 68
(...skipping 20 matching lines...) Expand all
89 delegate_->OnMainExit(); 89 delegate_->OnMainExit();
90 } 90 }
91 91
92 bool SchedulerWorkerThread::ShouldExitForTesting() const { 92 bool SchedulerWorkerThread::ShouldExitForTesting() const {
93 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); 93 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_);
94 return should_exit_for_testing_; 94 return should_exit_for_testing_;
95 } 95 }
96 96
97 } // namespace internal 97 } // namespace internal
98 } // namespace base 98 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698