security/sandbox/chromium/base/pending_task.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef PENDING_TASK_H_
michael@0 6 #define PENDING_TASK_H_
michael@0 7
michael@0 8 #include <queue>
michael@0 9
michael@0 10 #include "base/base_export.h"
michael@0 11 #include "base/callback.h"
michael@0 12 #include "base/location.h"
michael@0 13 #include "base/time/time.h"
michael@0 14 #include "base/tracking_info.h"
michael@0 15
michael@0 16 namespace base {
michael@0 17
michael@0 18 // Contains data about a pending task. Stored in TaskQueue and DelayedTaskQueue
michael@0 19 // for use by classes that queue and execute tasks.
michael@0 20 struct BASE_EXPORT PendingTask : public TrackingInfo {
michael@0 21 #if _MSC_VER >= 1700
michael@0 22 PendingTask();
michael@0 23 #endif
michael@0 24 PendingTask(const tracked_objects::Location& posted_from,
michael@0 25 const Closure& task);
michael@0 26 PendingTask(const tracked_objects::Location& posted_from,
michael@0 27 const Closure& task,
michael@0 28 TimeTicks delayed_run_time,
michael@0 29 bool nestable);
michael@0 30 ~PendingTask();
michael@0 31
michael@0 32 // Used to support sorting.
michael@0 33 bool operator<(const PendingTask& other) const;
michael@0 34
michael@0 35 // The task to run.
michael@0 36 Closure task;
michael@0 37
michael@0 38 // The site this PendingTask was posted from.
michael@0 39 tracked_objects::Location posted_from;
michael@0 40
michael@0 41 // Secondary sort key for run time.
michael@0 42 int sequence_num;
michael@0 43
michael@0 44 // OK to dispatch from a nested loop.
michael@0 45 bool nestable;
michael@0 46 };
michael@0 47
michael@0 48 // Wrapper around std::queue specialized for PendingTask which adds a Swap
michael@0 49 // helper method.
michael@0 50 class BASE_EXPORT TaskQueue : public std::queue<PendingTask> {
michael@0 51 public:
michael@0 52 void Swap(TaskQueue* queue);
michael@0 53 };
michael@0 54
michael@0 55 // PendingTasks are sorted by their |delayed_run_time| property.
michael@0 56 typedef std::priority_queue<base::PendingTask> DelayedTaskQueue;
michael@0 57
michael@0 58 } // namespace base
michael@0 59
michael@0 60 #endif // PENDING_TASK_H_

mercurial