netwerk/base/src/NetworkActivityMonitor.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  *
     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 NetworkActivityMonitor_h___
     8 #define NetworkActivityMonitor_h___
    10 #include <stdint.h>
    11 #include "nscore.h"
    12 #include "prio.h"
    13 #include "prinrval.h"
    15 namespace mozilla { namespace net {
    17 class NetworkActivityMonitor
    18 {
    19 public:
    20   enum Direction {
    21     kUpload   = 0,
    22     kDownload = 1
    23   };
    25   NetworkActivityMonitor();
    26   ~NetworkActivityMonitor();
    28   static nsresult Init(int32_t blipInterval);
    29   static nsresult Shutdown();
    31   static nsresult AttachIOLayer(PRFileDesc *fd);
    32   static nsresult DataInOut(Direction direction);
    34 private:
    35   nsresult Init_Internal(int32_t blipInterval);
    36   void PostNotification(Direction direction);
    38   static NetworkActivityMonitor * gInstance;
    39   PRDescIdentity                  mLayerIdentity;
    40   PRIOMethods                     mLayerMethods;
    41   PRIntervalTime                  mBlipInterval;
    42   PRIntervalTime                  mLastNotificationTime[2];
    43 };
    45 }} // namespace mozilla::net
    47 #endif /* NetworkActivityMonitor_h___ */

mercurial