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.

     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.
     5 #ifndef PENDING_TASK_H_
     6 #define PENDING_TASK_H_
     8 #include <queue>
    10 #include "base/base_export.h"
    11 #include "base/callback.h"
    12 #include "base/location.h"
    13 #include "base/time/time.h"
    14 #include "base/tracking_info.h"
    16 namespace base {
    18 // Contains data about a pending task. Stored in TaskQueue and DelayedTaskQueue
    19 // for use by classes that queue and execute tasks.
    20 struct BASE_EXPORT PendingTask : public TrackingInfo {
    21 #if _MSC_VER >= 1700
    22   PendingTask();
    23 #endif
    24   PendingTask(const tracked_objects::Location& posted_from,
    25               const Closure& task);
    26   PendingTask(const tracked_objects::Location& posted_from,
    27               const Closure& task,
    28               TimeTicks delayed_run_time,
    29               bool nestable);
    30   ~PendingTask();
    32   // Used to support sorting.
    33   bool operator<(const PendingTask& other) const;
    35   // The task to run.
    36   Closure task;
    38   // The site this PendingTask was posted from.
    39   tracked_objects::Location posted_from;
    41   // Secondary sort key for run time.
    42   int sequence_num;
    44   // OK to dispatch from a nested loop.
    45   bool nestable;
    46 };
    48 // Wrapper around std::queue specialized for PendingTask which adds a Swap
    49 // helper method.
    50 class BASE_EXPORT TaskQueue : public std::queue<PendingTask> {
    51  public:
    52   void Swap(TaskQueue* queue);
    53 };
    55 // PendingTasks are sorted by their |delayed_run_time| property.
    56 typedef std::priority_queue<base::PendingTask> DelayedTaskQueue;
    58 }  // namespace base
    60 #endif  // PENDING_TASK_H_

mercurial