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

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

Issue 2557083002: Run ScopedTaskScheduler tasks synchronously. (Closed)
Patch Set: rebase Created 4 years 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/BUILD.gn ('k') | base/message_loop/message_loop.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_MESSAGE_LOOP_MESSAGE_LOOP_H_ 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return task_runner_; 227 return task_runner_;
228 } 228 }
229 229
230 // Sets a new TaskRunner for this message loop. The message loop must already 230 // Sets a new TaskRunner for this message loop. The message loop must already
231 // have been bound to a thread prior to this call, and the task runner must 231 // have been bound to a thread prior to this call, and the task runner must
232 // belong to that thread. Note that changing the task runner will also affect 232 // belong to that thread. Note that changing the task runner will also affect
233 // the ThreadTaskRunnerHandle for the target thread. Must be called on the 233 // the ThreadTaskRunnerHandle for the target thread. Must be called on the
234 // thread to which the message loop is bound. 234 // thread to which the message loop is bound.
235 void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner); 235 void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner);
236 236
237 // Clears task_runner() and the ThreadTaskRunnerHandle for the target thread.
238 // Must be called on the thread to which the message loop is bound.
239 void ClearTaskRunnerForTesting();
240
237 // Enables or disables the recursive task processing. This happens in the case 241 // Enables or disables the recursive task processing. This happens in the case
238 // of recursive message loops. Some unwanted message loops may occur when 242 // of recursive message loops. Some unwanted message loops may occur when
239 // using common controls or printer functions. By default, recursive task 243 // using common controls or printer functions. By default, recursive task
240 // processing is disabled. 244 // processing is disabled.
241 // 245 //
242 // Please use |ScopedNestableTaskAllower| instead of calling these methods 246 // Please use |ScopedNestableTaskAllower| instead of calling these methods
243 // directly. In general, nestable message loops are to be avoided. They are 247 // directly. In general, nestable message loops are to be avoided. They are
244 // dangerous and difficult to get right, so please use with extreme caution. 248 // dangerous and difficult to get right, so please use with extreme caution.
245 // 249 //
246 // The specific case where tasks get queued is: 250 // The specific case where tasks get queued is:
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 609
606 // Do not add any member variables to MessageLoopForIO! This is important b/c 610 // Do not add any member variables to MessageLoopForIO! This is important b/c
607 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 611 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
608 // data that you need should be stored on the MessageLoop's pump_ instance. 612 // data that you need should be stored on the MessageLoop's pump_ instance.
609 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 613 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
610 "MessageLoopForIO should not have extra member variables"); 614 "MessageLoopForIO should not have extra member variables");
611 615
612 } // namespace base 616 } // namespace base
613 617
614 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 618 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698