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

Side by Side Diff: base/task_queue.h

Issue 6081007: Start sorting methods in class declarations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/synchronization/waitable_event_watcher_win.cc ('k') | base/threading/simple_thread.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_QUEUE_H_ 5 #ifndef BASE_TASK_QUEUE_H_
6 #define BASE_TASK_QUEUE_H_ 6 #define BASE_TASK_QUEUE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 10
11 #include "base/task.h" 11 #include "base/task.h"
12 12
13 // A TaskQueue is a queue of tasks waiting to be run. To run the tasks, call 13 // A TaskQueue is a queue of tasks waiting to be run. To run the tasks, call
14 // the Run method. A task queue is itself a Task so that it can be placed in a 14 // the Run method. A task queue is itself a Task so that it can be placed in a
15 // message loop or another task queue. 15 // message loop or another task queue.
16 class TaskQueue : public Task { 16 class TaskQueue : public Task {
17 public: 17 public:
18 TaskQueue(); 18 TaskQueue();
19 ~TaskQueue(); 19 ~TaskQueue();
20 20
21 // Run all the tasks in the queue. New tasks pushed onto the queue during
22 // a run will be run next time |Run| is called.
23 virtual void Run();
24
25 // Push the specified task onto the queue. When the queue is run, the tasks 21 // Push the specified task onto the queue. When the queue is run, the tasks
26 // will be run in the order they are pushed. 22 // will be run in the order they are pushed.
27 // 23 //
28 // This method takes ownership of |task| and will delete task after it is run 24 // This method takes ownership of |task| and will delete task after it is run
29 // (or when the TaskQueue is destroyed, if we never got a chance to run it). 25 // (or when the TaskQueue is destroyed, if we never got a chance to run it).
30 void Push(Task* task); 26 void Push(Task* task);
31 27
32 // Remove all tasks from the queue. The tasks are deleted. 28 // Remove all tasks from the queue. The tasks are deleted.
33 void Clear(); 29 void Clear();
34 30
35 // Returns true if this queue contains no tasks. 31 // Returns true if this queue contains no tasks.
36 bool IsEmpty() const; 32 bool IsEmpty() const;
37 33
34 // Run all the tasks in the queue. New tasks pushed onto the queue during
35 // a run will be run next time |Run| is called.
36 virtual void Run();
37
38 private: 38 private:
39 // The list of tasks we are waiting to run. 39 // The list of tasks we are waiting to run.
40 std::deque<Task*> queue_; 40 std::deque<Task*> queue_;
41 }; 41 };
42 42
43 #endif // BASE_TASK_QUEUE_H_ 43 #endif // BASE_TASK_QUEUE_H_
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event_watcher_win.cc ('k') | base/threading/simple_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698