ipc/chromium/src/chrome/common/task_queue.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 // Copyright (c) 2006-2008 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 CHROME_COMMON_TASK_QUEUE_H__
     6 #define CHROME_COMMON_TASK_QUEUE_H__
     8 #include <deque>
    10 #include "base/task.h"
    12 // A TaskQueue is a queue of tasks waiting to be run.  To run the tasks, call
    13 // the Run method.  A task queue is itself a Task so that it can be placed in a
    14 // message loop or another task queue.
    15 class TaskQueue : public Task {
    16  public:
    17   TaskQueue();
    18   ~TaskQueue();
    20   // Run all the tasks in the queue.  New tasks pushed onto the queue during
    21   // a run will be run next time |Run| is called.
    22   virtual void Run();
    24   // Push the specified task onto the queue.  When the queue is run, the tasks
    25   // will be run in the order they are pushed.
    26   //
    27   // This method takes ownership of |task| and will delete task after it is run
    28   // (or when the TaskQueue is destroyed, if we never got a chance to run it).
    29   void Push(Task* task);
    31   // Remove all tasks from the queue.  The tasks are deleted.
    32   void Clear();
    34   // Returns true if this queue contains no tasks.
    35   bool Empty() const;
    37  private:
    38    // The list of tasks we are waiting to run.
    39    std::deque<Task*> queue_;
    40 };
    42 #endif  // CHROME_COMMON_TASK_QUEUE_H__

mercurial