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

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

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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
« no previous file with comments | « base/task_scheduler/task.cc ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 // gracefully map to a default pool. 33 // gracefully map to a default pool.
34 using WorkerPoolIndexForTraitsCallback = 34 using WorkerPoolIndexForTraitsCallback =
35 Callback<size_t(const TaskTraits& traits)>; 35 Callback<size_t(const TaskTraits& traits)>;
36 36
37 virtual ~TaskScheduler() = default; 37 virtual ~TaskScheduler() = default;
38 38
39 // Posts |task| with specific |traits|. 39 // Posts |task| with specific |traits|.
40 // For one off tasks that don't require a TaskRunner. 40 // For one off tasks that don't require a TaskRunner.
41 virtual void PostTaskWithTraits(const tracked_objects::Location& from_here, 41 virtual void PostTaskWithTraits(const tracked_objects::Location& from_here,
42 const TaskTraits& traits, 42 const TaskTraits& traits,
43 const Closure& task) = 0; 43 OnceClosure task) = 0;
44 44
45 // Returns a TaskRunner whose PostTask invocations will result in scheduling 45 // Returns a TaskRunner whose PostTask invocations will result in scheduling
46 // Tasks with |traits| which will be executed according to |execution_mode|. 46 // Tasks with |traits| which will be executed according to |execution_mode|.
47 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( 47 virtual scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(
48 const TaskTraits& traits, 48 const TaskTraits& traits,
49 ExecutionMode execution_mode) = 0; 49 ExecutionMode execution_mode) = 0;
50 50
51 // Synchronously shuts down the scheduler. Once this is called, only tasks 51 // Synchronously shuts down the scheduler. Once this is called, only tasks
52 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns: 52 // posted with the BLOCK_SHUTDOWN behavior will be run. When this returns:
53 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their 53 // - All SKIP_ON_SHUTDOWN tasks that were already running have completed their
(...skipping 28 matching lines...) Expand all
82 82
83 // Retrieve the TaskScheduler set via CreateAndSetDefaultTaskScheduler() or 83 // Retrieve the TaskScheduler set via CreateAndSetDefaultTaskScheduler() or
84 // SetInstance(). This should be used very rarely; most users of TaskScheduler 84 // SetInstance(). This should be used very rarely; most users of TaskScheduler
85 // should use the post_task.h API. 85 // should use the post_task.h API.
86 static TaskScheduler* GetInstance(); 86 static TaskScheduler* GetInstance();
87 }; 87 };
88 88
89 } // namespace base 89 } // namespace base
90 90
91 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ 91 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/task.cc ('k') | base/task_scheduler/task_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698