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

Side by Side Diff: base/pending_task.h

Issue 8565024: base: Refactor PendingTask out of MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years, 1 month 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/message_loop.cc ('k') | base/pending_task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PENDING_TASK_H_
6 #define PENDING_TASK_H_
7 #pragma once
8
9 #include <queue>
10
11 #include "base/callback.h"
12 #include "base/location.h"
13 #include "base/time.h"
14 #include "base/tracking_info.h"
15
16 namespace base {
17
18 // Contains data about a pending task. Stored in TaskQueue and DelayedTaskQueue
19 // for use by classes that queue and execute tasks.
20 struct PendingTask : public TrackingInfo {
21 PendingTask(const tracked_objects::Location& posted_from,
22 const Closure& task);
23 PendingTask(const tracked_objects::Location& posted_from,
24 const Closure& task,
25 TimeTicks delayed_run_time,
26 bool nestable);
27 ~PendingTask();
28
29 // Used to support sorting.
30 bool operator<(const PendingTask& other) const;
31
32 // The task to run.
33 Closure task;
34
35 // The site this PendingTask was posted from.
36 tracked_objects::Location posted_from;
37
38 // Secondary sort key for run time.
39 int sequence_num;
40
41 // OK to dispatch from a nested loop.
42 bool nestable;
43 };
44
45 // Wrapper around std::queue specialized for PendingTask which adds a Swap
46 // helper method.
47 class TaskQueue : public std::queue<PendingTask> {
48 public:
49 void Swap(TaskQueue* queue);
50 };
51
52 } // namespace base
53
54 #endif // PENDING_TASK_H_
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/pending_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698