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

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: 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 <map>
8 #include <memory> 9 #include <memory>
10 #include <string>
9 11
10 #include "base/base_export.h" 12 #include "base/base_export.h"
11 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/task_runner.h" 15 #include "base/task_runner.h"
14 #include "base/task_scheduler/task_traits.h" 16 #include "base/task_scheduler/task_traits.h"
15 17
16 namespace tracked_objects { 18 namespace tracked_objects {
17 class Location; 19 class Location;
18 } 20 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // registered TaskScheduler will only be deleted when a new TaskScheduler is 55 // registered TaskScheduler will only be deleted when a new TaskScheduler is
54 // registered (i.e. otherwise leaked on shutdown). The methods must not be 56 // registered (i.e. otherwise leaked on shutdown). The methods must not be
55 // called when TaskRunners created by the previous TaskScheduler are still 57 // called when TaskRunners created by the previous TaskScheduler are still
56 // alive. The methods are not thread-safe; proper synchronization is required 58 // alive. The methods are not thread-safe; proper synchronization is required
57 // to use the post_task.h API after registering a new TaskScheduler. 59 // to use the post_task.h API after registering a new TaskScheduler.
58 60
59 // Registers |task_scheduler| to handle tasks posted through the post_task.h 61 // Registers |task_scheduler| to handle tasks posted through the post_task.h
60 // API for this process. 62 // API for this process.
61 static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler); 63 static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler);
62 64
63 // Initializes the default task scheduler for this process. 65 // Initializes the default task scheduler for this process. |variation_params|
64 static void InitializeDefaultTaskScheduler(); 66 // is used to configure the scheduler (can be empty).
67 static void InitializeDefaultTaskScheduler(
robliao 2016/06/14 21:43:44 Can TaskSchedulerImpl pick these up without the ca
fdoray 2016/06/15 17:14:32 No because variations::GetVariationParams() is in
robliao 2016/06/15 17:32:37 Looking a bit more broadly, it's conceivable that
fdoray 2016/06/15 19:54:53 What do you think of this? class SchedulerThreadP
gab 2016/06/15 19:56:03 I think it's fine to match our variations to finch
fdoray 2016/06/16 13:02:05 gab@: WDYT of my new idea? (2016/06/15 19:54:53 ht
gab 2016/06/16 15:07:07 As discussed in person, this SGTM as a customizabl
fdoray 2016/06/16 18:10:53 Our design doc says that we'll have a TestTaskSche
68 const std::map<std::string, std::string>& variation_params);
65 69
66 // Retrieve the TaskScheduler set via SetInstance() or 70 // Retrieve the TaskScheduler set via SetInstance() or
67 // InitializeDefaultTaskScheduler(). This should be used very rarely; most 71 // InitializeDefaultTaskScheduler(). This should be used very rarely; most
68 // users of TaskScheduler should use the post_task.h API. 72 // users of TaskScheduler should use the post_task.h API.
69 static TaskScheduler* GetInstance(); 73 static TaskScheduler* GetInstance();
70 }; 74 };
71 75
72 } // namespace base 76 } // namespace base
73 77
74 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 78 #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