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

Unified Diff: base/task_scheduler/scheduler_worker.h

Issue 2430633003: TaskScheduler: Record TaskScheduler.NumTasksBeforeDetach.* from OnDetach(). (Closed)
Patch Set: CR gab #3 rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/task_scheduler/scheduler_worker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/scheduler_worker.h
diff --git a/base/task_scheduler/scheduler_worker.h b/base/task_scheduler/scheduler_worker.h
index b9958be019bd479419367fae739a3808a972d92e..a9b891ad772d433865cb25611b4694e0083b0445 100644
--- a/base/task_scheduler/scheduler_worker.h
+++ b/base/task_scheduler/scheduler_worker.h
@@ -38,7 +38,7 @@ class TaskTracker;
class BASE_EXPORT SchedulerWorker {
public:
// Delegate interface for SchedulerWorker. The methods are always called from
- // a thread managed by the SchedulerWorker instance.
+ // the thread managed by the SchedulerWorker instance.
class Delegate {
public:
virtual ~Delegate() = default;
@@ -47,8 +47,7 @@ class BASE_EXPORT SchedulerWorker {
// If a thread is recreated after detachment, |detach_duration| is the time
// elapsed since detachment. Otherwise, if this is the first thread created
// for |worker|, |detach_duration| is TimeDelta::Max().
- virtual void OnMainEntry(SchedulerWorker* worker,
- const TimeDelta& detach_duration) = 0;
+ virtual void OnMainEntry(SchedulerWorker* worker) = 0;
// Called by a thread managed by |worker| to get a Sequence from which to
// run a Task.
@@ -83,6 +82,11 @@ class BASE_EXPORT SchedulerWorker {
// This MUST return false if SchedulerWorker::JoinForTesting() is in
// progress.
virtual bool CanDetach(SchedulerWorker* worker) = 0;
+
+ // Called by a thread before it detaches. This method is not allowed to
+ // acquire a SchedulerLock because it is called within the scope of another
+ // SchedulerLock.
+ virtual void OnDetach() = 0;
};
enum class InitialState { ALIVE, DETACHED };
@@ -143,10 +147,6 @@ class BASE_EXPORT SchedulerWorker {
// The underlying thread for this SchedulerWorker.
std::unique_ptr<Thread> thread_;
- // Time of the last successful Detach(). Is only accessed from the thread
- // managed by this SchedulerWorker.
- TimeTicks last_detach_time_;
-
const ThreadPriority priority_hint_;
const std::unique_ptr<Delegate> delegate_;
TaskTracker* const task_tracker_;
« no previous file with comments | « no previous file | base/task_scheduler/scheduler_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698