LCOV - code coverage report
Current view: directory - ipc/chromium/src/chrome/common - task_queue.cc (source / functions) Found Hit Coverage
Test: app.info Lines: 22 0 0.0 %
Date: 2012-06-02 Functions: 7 0 0.0 %

       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.
       4                 : 
       5                 : #include "chrome/common/task_queue.h"
       6                 : 
       7                 : #include "base/stl_util-inl.h"
       8                 : 
       9               0 : TaskQueue::TaskQueue() {
      10               0 : }
      11                 : 
      12               0 : TaskQueue::~TaskQueue() {
      13                 :   // We own all the pointes in |queue_|.  It is our job to delete them.
      14               0 :   STLDeleteElements(&queue_);
      15               0 : }
      16                 : 
      17               0 : void TaskQueue::Run() {
      18                 :   // Nothing to run if our queue is empty.
      19               0 :   if (queue_.empty())
      20               0 :     return;
      21                 : 
      22               0 :   std::deque<Task*> ready;
      23               0 :   queue_.swap(ready);
      24                 : 
      25                 :   // Run the tasks that are ready.
      26               0 :   std::deque<Task*>::const_iterator task;
      27               0 :   for (task = ready.begin(); task != ready.end(); ++task) {
      28                 :     // Run the task and then delete it.
      29               0 :     (*task)->Run();
      30               0 :     delete (*task);
      31                 :   }
      32                 : }
      33                 : 
      34               0 : void TaskQueue::Push(Task* task) {
      35                 :   // Add the task to the back of the queue.
      36               0 :   queue_.push_back(task);
      37               0 : }
      38                 : 
      39               0 : void TaskQueue::Clear() {
      40                 :   // Delete all the elements in the queue and clear the dead pointers.
      41               0 :   STLDeleteElements(&queue_);
      42               0 : }
      43                 : 
      44               0 : bool TaskQueue::Empty() const {
      45               0 :   return queue_.empty();
      46                 : }

Generated by: LCOV version 1.7