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

Side by Side Diff: base/task_runner.h

Issue 2823103003: Introduce TaskRunner::RunsTasksInCurrentSequence() (Closed)
Patch Set: remove RunsTasksOnCurrentThread() overrided. Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RUNNER_H_ 5 #ifndef BASE_TASK_RUNNER_H_
6 #define BASE_TASK_RUNNER_H_ 6 #define BASE_TASK_RUNNER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // to have PostDelayedTask behave the same as PostTask. 70 // to have PostDelayedTask behave the same as PostTask.
71 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, 71 virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
72 OnceClosure task, 72 OnceClosure task,
73 base::TimeDelta delay) = 0; 73 base::TimeDelta delay) = 0;
74 74
75 // Returns true if the current thread is a thread on which a task 75 // Returns true if the current thread is a thread on which a task
76 // may be run, and false if no task will be run on the current 76 // may be run, and false if no task will be run on the current
77 // thread. 77 // thread.
78 // 78 //
79 // It is valid for an implementation to always return true, or in 79 // It is valid for an implementation to always return true, or in
80 // general to use 'true' as a default value. 80 // general to use 'true' as a default value.
gab 2017/04/18 15:00:32 // // Drepecated: favor RunsTasksInCurrentSequence
81 virtual bool RunsTasksOnCurrentThread() const = 0; 81 bool RunsTasksOnCurrentThread() const;
82
83 // Returns true iff tasks posted to this TaskRunner are sequenced
84 // with this call.
85 //
86 // In particular:
87 // - Returns true if this is a SequencedTaskRunner to which the
88 // current task was posted.
89 // - Returns true if this is a SequencedTaskRunner bound to the
90 // same sequence as the SequencedTaskRunner to which the current
91 // task was posted.
92 // - Returns true if this is a SingleThreadTaskRunner bound to
93 // the current thread.
94 // - Returns false if this is a TaskRunner that can run its tasks
95 // in parallel.
gab 2017/04/18 15:00:32 This last statement isn't true yet (SchedulerParal
96 virtual bool RunsTasksInCurrentSequence() const = 0;
82 97
83 // Posts |task| on the current TaskRunner. On completion, |reply| 98 // Posts |task| on the current TaskRunner. On completion, |reply|
84 // is posted to the thread that called PostTaskAndReply(). Both 99 // is posted to the thread that called PostTaskAndReply(). Both
85 // |task| and |reply| are guaranteed to be deleted on the thread 100 // |task| and |reply| are guaranteed to be deleted on the thread
86 // from which PostTaskAndReply() is invoked. This allows objects 101 // from which PostTaskAndReply() is invoked. This allows objects
87 // that must be deleted on the originating thread to be bound into 102 // that must be deleted on the originating thread to be bound into
88 // the |task| and |reply| Closures. In particular, it can be useful 103 // the |task| and |reply| Closures. In particular, it can be useful
89 // to use WeakPtr<> in the |reply| Closure so that the reply 104 // to use WeakPtr<> in the |reply| Closure so that the reply
90 // operation can be canceled. See the following pseudo-code: 105 // operation can be canceled. See the following pseudo-code:
91 // 106 //
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual void OnDestruct() const; 156 virtual void OnDestruct() const;
142 }; 157 };
143 158
144 struct BASE_EXPORT TaskRunnerTraits { 159 struct BASE_EXPORT TaskRunnerTraits {
145 static void Destruct(const TaskRunner* task_runner); 160 static void Destruct(const TaskRunner* task_runner);
146 }; 161 };
147 162
148 } // namespace base 163 } // namespace base
149 164
150 #endif // BASE_TASK_RUNNER_H_ 165 #endif // BASE_TASK_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698