netwerk/cache/nsCacheUtils.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 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set sw=2 ts=8 et tw=80 : */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef _nsCacheUtils_h_
     8 #define _nsCacheUtils_h_
    10 #include "nsThreadUtils.h"
    11 #include "nsCOMPtr.h"
    12 #include "mozilla/Mutex.h"
    13 #include "mozilla/CondVar.h"
    15 class nsIThread;
    17 /**
    18  * A class with utility methods for shutting down nsIThreads easily.
    19   */
    20 class nsShutdownThread : public nsRunnable {
    21 public:
    22   nsShutdownThread(nsIThread *aThread);
    23   ~nsShutdownThread();
    25   NS_IMETHOD Run();
    27 /**
    28  * Shutdown ensures that aThread->Shutdown() is called on a main thread
    29  */
    30   static nsresult Shutdown(nsIThread *aThread);
    32 /**
    33  * BlockingShutdown ensures that by the time it returns, aThread->Shutdown() has
    34  * been called and no pending events have been processed on the current thread.
    35  */
    36   static nsresult BlockingShutdown(nsIThread *aThread);
    38 private:
    39   mozilla::Mutex      mLock;
    40   mozilla::CondVar    mCondVar;
    41   nsCOMPtr<nsIThread> mThread;
    42 };
    44 #endif

mercurial