LCOV - code coverage report
Current view: directory - netwerk/ipc - ChannelEventQueue.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 12 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  * vim: set sw=2 ts=8 et tw=80 :
       3                 :  */
       4                 : /* ***** BEGIN LICENSE BLOCK *****
       5                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       6                 :  *
       7                 :  * The contents of this file are subject to the Mozilla Public License Version
       8                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       9                 :  * the License. You may obtain a copy of the License at:
      10                 :  * http://www.mozilla.org/MPL/
      11                 :  *
      12                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      13                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      14                 :  * for the specific language governing rights and limitations under the
      15                 :  * License.
      16                 :  *
      17                 :  * The Original Code is Mozilla Code.
      18                 :  *
      19                 :  * The Initial Developer of the Original Code is
      20                 :  *   The Mozilla Foundation
      21                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      22                 :  * the Initial Developer. All Rights Reserved.
      23                 :  *
      24                 :  * Contributor(s):
      25                 :  *   Josh Matthews <josh@joshmatthews.net> (initial developer)
      26                 :  *   Jason Duell <jduell.mcbugs@gmail.com>
      27                 :  *
      28                 :  * Alternatively, the contents of this file may be used under the terms of
      29                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      30                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      31                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      32                 :  * of those above. If you wish to allow use of your version of this file only
      33                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      34                 :  * use your version of this file under the terms of the MPL, indicate your
      35                 :  * decision by deleting the provisions above and replace them with the notice
      36                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      37                 :  * the provisions above, a recipient may use your version of this file under
      38                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      39                 :  *
      40                 :  * ***** END LICENSE BLOCK ***** */
      41                 : 
      42                 : #include "nsISupports.h"
      43                 : #include "mozilla/net/ChannelEventQueue.h"
      44                 : 
      45                 : namespace mozilla {
      46                 : namespace net {
      47                 : 
      48                 : void
      49               0 : ChannelEventQueue::FlushQueue()
      50                 : {
      51                 :   // Events flushed could include destruction of channel (and our own
      52                 :   // destructor) unless we make sure its refcount doesn't drop to 0 while this
      53                 :   // method is running.
      54               0 :   nsCOMPtr<nsISupports> kungFuDeathGrip(mOwner);
      55                 : 
      56                 :   // Prevent flushed events from flushing the queue recursively
      57               0 :   mFlushing = true;
      58                 : 
      59                 :   PRUint32 i;
      60               0 :   for (i = 0; i < mEventQueue.Length(); i++) {
      61               0 :     mEventQueue[i]->Run();
      62               0 :     if (mSuspended)
      63               0 :       break;
      64                 :   }
      65                 : 
      66                 :   // We will always want to remove at least one finished callback.
      67               0 :   if (i < mEventQueue.Length())
      68               0 :     i++;
      69                 : 
      70                 :   // It is possible for new callbacks to be enqueued as we are
      71                 :   // flushing the queue, so the queue must not be cleared until
      72                 :   // all callbacks have run.
      73               0 :   mEventQueue.RemoveElementsAt(0, i);
      74                 : 
      75               0 :   mFlushing = false;
      76               0 : }
      77                 : 
      78                 : 
      79                 : }
      80                 : }

Generated by: LCOV version 1.7