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

Side by Side Diff: ios/web/public/web_thread.h

Issue 2637843002: Migrate base::TaskRunner from Closure to OnceClosure (Closed)
Patch Set: rebase 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
« no previous file with comments | « ios/chrome/app/application_delegate/app_state.mm ('k') | ios/web/web_thread_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 IOS_WEB_PUBLIC_WEB_THREAD_H_ 5 #ifndef IOS_WEB_PUBLIC_WEB_THREAD_H_
6 #define IOS_WEB_PUBLIC_WEB_THREAD_H_ 6 #define IOS_WEB_PUBLIC_WEB_THREAD_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // identifier. 94 // identifier.
95 ID_COUNT 95 ID_COUNT
96 }; 96 };
97 97
98 // These are the same methods as in message_loop.h, but are guaranteed to 98 // These are the same methods as in message_loop.h, but are guaranteed to
99 // either get posted to the MessageLoop if it's still alive, or be deleted 99 // either get posted to the MessageLoop if it's still alive, or be deleted
100 // otherwise. 100 // otherwise.
101 // They return true iff the thread existed and the task was posted. 101 // They return true iff the thread existed and the task was posted.
102 static bool PostTask(ID identifier, 102 static bool PostTask(ID identifier,
103 const tracked_objects::Location& from_here, 103 const tracked_objects::Location& from_here,
104 base::Closure task); 104 base::OnceClosure task);
105 static bool PostDelayedTask(ID identifier, 105 static bool PostDelayedTask(ID identifier,
106 const tracked_objects::Location& from_here, 106 const tracked_objects::Location& from_here,
107 base::Closure task, 107 base::OnceClosure task,
108 base::TimeDelta delay); 108 base::TimeDelta delay);
109 static bool PostNonNestableTask(ID identifier, 109 static bool PostNonNestableTask(ID identifier,
110 const tracked_objects::Location& from_here, 110 const tracked_objects::Location& from_here,
111 base::Closure task); 111 base::OnceClosure task);
112 static bool PostNonNestableDelayedTask( 112 static bool PostNonNestableDelayedTask(
113 ID identifier, 113 ID identifier,
114 const tracked_objects::Location& from_here, 114 const tracked_objects::Location& from_here,
115 base::Closure task, 115 base::OnceClosure task,
116 base::TimeDelta delay); 116 base::TimeDelta delay);
117 117
118 static bool PostTaskAndReply(ID identifier, 118 static bool PostTaskAndReply(ID identifier,
119 const tracked_objects::Location& from_here, 119 const tracked_objects::Location& from_here,
120 base::Closure task, 120 base::OnceClosure task,
121 base::Closure reply); 121 base::OnceClosure reply);
122 122
123 template <typename ReturnType, typename ReplyArgType> 123 template <typename ReturnType, typename ReplyArgType>
124 static bool PostTaskAndReplyWithResult( 124 static bool PostTaskAndReplyWithResult(
125 ID identifier, 125 ID identifier,
126 const tracked_objects::Location& from_here, 126 const tracked_objects::Location& from_here,
127 base::Callback<ReturnType()> task, 127 base::OnceCallback<ReturnType()> task,
128 base::Callback<void(ReplyArgType)> reply) { 128 base::OnceCallback<void(ReplyArgType)> reply) {
129 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 129 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
130 GetTaskRunnerForThread(identifier); 130 GetTaskRunnerForThread(identifier);
131 return base::PostTaskAndReplyWithResult(task_runner.get(), from_here, 131 return base::PostTaskAndReplyWithResult(task_runner.get(), from_here,
132 std::move(task), std::move(reply)); 132 std::move(task), std::move(reply));
133 } 133 }
134 134
135 template <class T> 135 template <class T>
136 static bool DeleteSoon(ID identifier, 136 static bool DeleteSoon(ID identifier,
137 const tracked_objects::Location& from_here, 137 const tracked_objects::Location& from_here,
138 const T* object) { 138 const T* object) {
(...skipping 15 matching lines...) Expand all
154 // something slow and noncritical that doesn't need to block shutdown), 154 // something slow and noncritical that doesn't need to block shutdown),
155 // or you want to manually provide a sequence token (which saves a map 155 // or you want to manually provide a sequence token (which saves a map
156 // lookup and is guaranteed unique without you having to come up with a 156 // lookup and is guaranteed unique without you having to come up with a
157 // unique string), you can access the sequenced worker pool directly via 157 // unique string), you can access the sequenced worker pool directly via
158 // GetBlockingPool(). 158 // GetBlockingPool().
159 // 159 //
160 // If you need to PostTaskAndReplyWithResult, use 160 // If you need to PostTaskAndReplyWithResult, use
161 // base::PostTaskAndReplyWithResult() with GetBlockingPool() as the task 161 // base::PostTaskAndReplyWithResult() with GetBlockingPool() as the task
162 // runner. 162 // runner.
163 static bool PostBlockingPoolTask(const tracked_objects::Location& from_here, 163 static bool PostBlockingPoolTask(const tracked_objects::Location& from_here,
164 base::Closure task); 164 base::OnceClosure task);
165 static bool PostBlockingPoolTaskAndReply( 165 static bool PostBlockingPoolTaskAndReply(
166 const tracked_objects::Location& from_here, 166 const tracked_objects::Location& from_here,
167 base::Closure task, 167 base::OnceClosure task,
168 base::Closure reply); 168 base::OnceClosure reply);
169 static bool PostBlockingPoolSequencedTask( 169 static bool PostBlockingPoolSequencedTask(
170 const std::string& sequence_token_name, 170 const std::string& sequence_token_name,
171 const tracked_objects::Location& from_here, 171 const tracked_objects::Location& from_here,
172 base::Closure task); 172 base::OnceClosure task);
173 173
174 // Returns the thread pool used for blocking file I/O. Use this object to 174 // Returns the thread pool used for blocking file I/O. Use this object to
175 // perform random blocking operations such as file writes. 175 // perform random blocking operations such as file writes.
176 static base::SequencedWorkerPool* GetBlockingPool() WARN_UNUSED_RESULT; 176 static base::SequencedWorkerPool* GetBlockingPool() WARN_UNUSED_RESULT;
177 177
178 // Callable on any thread. Returns whether the given well-known thread is 178 // Callable on any thread. Returns whether the given well-known thread is
179 // initialized. 179 // initialized.
180 static bool IsThreadInitialized(ID identifier) WARN_UNUSED_RESULT; 180 static bool IsThreadInitialized(ID identifier) WARN_UNUSED_RESULT;
181 181
182 // Callable on any thread. Returns whether execution is currently on the 182 // Callable on any thread. Returns whether execution is currently on the
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 private: 260 private:
261 friend class WebThreadImpl; 261 friend class WebThreadImpl;
262 262
263 WebThread() {} 263 WebThread() {}
264 DISALLOW_COPY_AND_ASSIGN(WebThread); 264 DISALLOW_COPY_AND_ASSIGN(WebThread);
265 }; 265 };
266 266
267 } // namespace web 267 } // namespace web
268 268
269 #endif // IOS_WEB_PUBLIC_WEB_THREAD_H_ 269 #endif // IOS_WEB_PUBLIC_WEB_THREAD_H_
OLDNEW
« no previous file with comments | « ios/chrome/app/application_delegate/app_state.mm ('k') | ios/web/web_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698