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

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

Issue 1869393002: TaskScheduler: Remove OnMainExit from SchedulerWorkerThread::Delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@5b_enqueue
Patch Set: rebase 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (!sequence_became_empty) 85 if (!sequence_became_empty)
86 delegate_->EnqueueSequence(std::move(sequence)); 86 delegate_->EnqueueSequence(std::move(sequence));
87 87
88 // Calling WakeUp() guarantees that this SchedulerWorkerThread will run 88 // Calling WakeUp() guarantees that this SchedulerWorkerThread will run
89 // Tasks from Sequences returned by the GetWork() method of |delegate_| 89 // Tasks from Sequences returned by the GetWork() method of |delegate_|
90 // until it returns nullptr. Resetting |wake_up_event_| here doesn't break 90 // until it returns nullptr. Resetting |wake_up_event_| here doesn't break
91 // this invariant and avoids a useless loop iteration before going to sleep 91 // this invariant and avoids a useless loop iteration before going to sleep
92 // if WakeUp() is called while this SchedulerWorkerThread is awake. 92 // if WakeUp() is called while this SchedulerWorkerThread is awake.
93 wake_up_event_.Reset(); 93 wake_up_event_.Reset();
94 } 94 }
95
96 delegate_->OnMainExit();
97 } 95 }
98 96
99 bool SchedulerWorkerThread::ShouldExitForTesting() const { 97 bool SchedulerWorkerThread::ShouldExitForTesting() const {
100 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); 98 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_);
101 return should_exit_for_testing_; 99 return should_exit_for_testing_;
102 } 100 }
103 101
104 } // namespace internal 102 } // namespace internal
105 } // namespace base 103 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread.h ('k') | base/task_scheduler/scheduler_worker_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698