1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/src/NetworkActivityMonitor.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef NetworkActivityMonitor_h___ 1.11 +#define NetworkActivityMonitor_h___ 1.12 + 1.13 +#include <stdint.h> 1.14 +#include "nscore.h" 1.15 +#include "prio.h" 1.16 +#include "prinrval.h" 1.17 + 1.18 +namespace mozilla { namespace net { 1.19 + 1.20 +class NetworkActivityMonitor 1.21 +{ 1.22 +public: 1.23 + enum Direction { 1.24 + kUpload = 0, 1.25 + kDownload = 1 1.26 + }; 1.27 + 1.28 + NetworkActivityMonitor(); 1.29 + ~NetworkActivityMonitor(); 1.30 + 1.31 + static nsresult Init(int32_t blipInterval); 1.32 + static nsresult Shutdown(); 1.33 + 1.34 + static nsresult AttachIOLayer(PRFileDesc *fd); 1.35 + static nsresult DataInOut(Direction direction); 1.36 + 1.37 +private: 1.38 + nsresult Init_Internal(int32_t blipInterval); 1.39 + void PostNotification(Direction direction); 1.40 + 1.41 + static NetworkActivityMonitor * gInstance; 1.42 + PRDescIdentity mLayerIdentity; 1.43 + PRIOMethods mLayerMethods; 1.44 + PRIntervalTime mBlipInterval; 1.45 + PRIntervalTime mLastNotificationTime[2]; 1.46 +}; 1.47 + 1.48 +}} // namespace mozilla::net 1.49 + 1.50 +#endif /* NetworkActivityMonitor_h___ */