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

Unified Diff: base/task_scheduler/scheduler_worker_thread.h

Issue 1903103007: TaskScheduler: Make SchedulerWorkerThread own its delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sched_2b_remove_utils
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 side-by-side diff with in-line comments
Download patch
Index: base/task_scheduler/scheduler_worker_thread.h
diff --git a/base/task_scheduler/scheduler_worker_thread.h b/base/task_scheduler/scheduler_worker_thread.h
index 87941f8dc431d6684d7b1d12579f83df56511dc5..3022d100c61239b863c51d95b64e0252ef1360f1 100644
--- a/base/task_scheduler/scheduler_worker_thread.h
+++ b/base/task_scheduler/scheduler_worker_thread.h
@@ -53,9 +53,9 @@ class BASE_EXPORT SchedulerWorkerThread : public PlatformThread::Delegate {
// Tasks from Sequences returned by |delegate|. |task_tracker| is used to
// handle shutdown behavior of Tasks. Returns nullptr if creating the
// underlying platform thread fails.
- static std::unique_ptr<SchedulerWorkerThread> CreateSchedulerWorkerThread(
+ static std::unique_ptr<SchedulerWorkerThread> Create(
ThreadPriority thread_priority,
- Delegate* delegate,
+ std::unique_ptr<Delegate> delegate,
TaskTracker* task_tracker);
// Destroying a SchedulerWorkerThread in production is not allowed; it is
@@ -74,7 +74,7 @@ class BASE_EXPORT SchedulerWorkerThread : public PlatformThread::Delegate {
private:
SchedulerWorkerThread(ThreadPriority thread_priority,
- Delegate* delegate,
+ std::unique_ptr<Delegate> delegate,
TaskTracker* task_tracker);
// PlatformThread::Delegate:
@@ -88,7 +88,7 @@ class BASE_EXPORT SchedulerWorkerThread : public PlatformThread::Delegate {
// Event signaled to wake up this SchedulerWorkerThread.
WaitableEvent wake_up_event_;
- Delegate* const delegate_;
+ const std::unique_ptr<Delegate> delegate_;
TaskTracker* const task_tracker_;
// Synchronizes access to |should_exit_for_testing_|.
« no previous file with comments | « base/task_scheduler/scheduler_thread_pool_impl_unittest.cc ('k') | base/task_scheduler/scheduler_worker_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698