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

Side by Side Diff: base/task_scheduler/task_scheduler.h

Issue 2064073003: TaskScheduler: Make the worker pools of TaskSchedulerImpl configurable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delegate 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
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 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 30 matching lines...) Expand all
41 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns: 41 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns:
42 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their 42 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their
43 // execution. 43 // execution.
44 // - All posted BLOCK_SHUTDOWN tasks have completed their execution. 44 // - All posted BLOCK_SHUTDOWN tasks have completed their execution.
45 // - CONTINUE_ON_SHUTDOWN tasks might still be running. 45 // - CONTINUE_ON_SHUTDOWN tasks might still be running.
46 // Note that an implementation can keep threads and other resources alive to 46 // Note that an implementation can keep threads and other resources alive to
47 // support running CONTINUE_ON_SHUTDOWN after this returns. This can only be 47 // support running CONTINUE_ON_SHUTDOWN after this returns. This can only be
48 // called once. 48 // called once.
49 virtual void Shutdown() = 0; 49 virtual void Shutdown() = 0;
50 50
51 // SetInstance() and InitializeDefaultTaskScheduler() register a TaskScheduler
52 // to handle tasks posted through the post_task.h API for this process. The
53 // registered TaskScheduler will only be deleted when a new TaskScheduler is
54 // registered (i.e. otherwise leaked on shutdown). The methods must not be
55 // called when TaskRunners created by the previous TaskScheduler are still
56 // alive. The methods are not thread-safe; proper synchronization is required
57 // to use the post_task.h API after registering a new TaskScheduler.
58
59 // Registers |task_scheduler| to handle tasks posted through the post_task.h 51 // Registers |task_scheduler| to handle tasks posted through the post_task.h
60 // API for this process. 52 // API for this process. The registered TaskScheduler will only be deleted
53 // when a new TaskScheduler is registered (i.e. otherwise leaked on shutdown).
54 // This must not be called when TaskRunners created by the previous
55 // TaskScheduler are still alive. This method is not thread-safe; proper
56 // synchronization is required to use the post_task.h API after registering a
57 // new TaskScheduler.
61 static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler); 58 static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler);
62 59
63 // Initializes the default task scheduler for this process. 60 // Retrieve the TaskScheduler set via SetInstance(). This should be used very
64 static void InitializeDefaultTaskScheduler(); 61 // rarely; most users of TaskScheduler should use the post_task.h API.
fdoray 2016/06/16 19:33:18 I'm not convinced that we want this method if Task
robliao 2016/06/16 20:51:14 The intention here is to make it easy for tests or
fdoray 2016/06/23 14:37:21 I think we should wait until we have a set of defa
65
66 // Retrieve the TaskScheduler set via SetInstance() or
67 // InitializeDefaultTaskScheduler(). This should be used very rarely; most
68 // users of TaskScheduler should use the post_task.h API.
69 static TaskScheduler* GetInstance(); 62 static TaskScheduler* GetInstance();
70 }; 63 };
71 64
72 } // namespace base 65 } // namespace base
73 66
74 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 67 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | base/task_scheduler/task_scheduler.cc » ('j') | base/task_scheduler/task_scheduler_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698