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

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

Issue 1886453003: Make PendingTask move-only and pass it by value on retaining params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 void SetThreadTaskRunnerHandle(); 439 void SetThreadTaskRunnerHandle();
440 440
441 // Invokes the actual run loop using the message pump. 441 // Invokes the actual run loop using the message pump.
442 void RunHandler(); 442 void RunHandler();
443 443
444 // Called to process any delayed non-nestable tasks. 444 // Called to process any delayed non-nestable tasks.
445 bool ProcessNextDelayedNonNestableTask(); 445 bool ProcessNextDelayedNonNestableTask();
446 446
447 // Calls RunTask or queues the pending_task on the deferred task list if it 447 // Calls RunTask or queues the pending_task on the deferred task list if it
448 // cannot be run right now. Returns true if the task was run. 448 // cannot be run right now. Returns true if the task was run.
449 bool DeferOrRunPendingTask(const PendingTask& pending_task); 449 bool DeferOrRunPendingTask(PendingTask pending_task);
450 450
451 // Adds the pending task to delayed_work_queue_. 451 // Adds the pending task to delayed_work_queue_.
452 void AddToDelayedWorkQueue(const PendingTask& pending_task); 452 void AddToDelayedWorkQueue(PendingTask pending_task);
453 453
454 // Delete tasks that haven't run yet without running them. Used in the 454 // Delete tasks that haven't run yet without running them. Used in the
455 // destructor to make sure all the task's destructors get called. Returns 455 // destructor to make sure all the task's destructors get called. Returns
456 // true if some work was done. 456 // true if some work was done.
457 bool DeletePendingTasks(); 457 bool DeletePendingTasks();
458 458
459 // Loads tasks from the incoming queue to |work_queue_| if the latter is 459 // Loads tasks from the incoming queue to |work_queue_| if the latter is
460 // empty. 460 // empty.
461 void ReloadWorkQueue(); 461 void ReloadWorkQueue();
462 462
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 691
692 // Do not add any member variables to MessageLoopForIO! This is important b/c 692 // Do not add any member variables to MessageLoopForIO! This is important b/c
693 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra 693 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra
694 // data that you need should be stored on the MessageLoop's pump_ instance. 694 // data that you need should be stored on the MessageLoop's pump_ instance.
695 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), 695 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO),
696 "MessageLoopForIO should not have extra member variables"); 696 "MessageLoopForIO should not have extra member variables");
697 697
698 } // namespace base 698 } // namespace base
699 699
700 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ 700 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698