bug 975750 - remove httpdatausage r=jduell
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 25 Feb 2014 20:39:08 -0500
changeset 188827 a4c51a14aaf2a1bce896cc833fdcdf51fe812dcb
parent 188826 655aaacbacba9f8da6d4ef8f065529cc53d55fcd
child 188828 c9f4f70e46e17db15c78caed8621d8cc4774010b
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs975750
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 975750 - remove httpdatausage r=jduell
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
mobile/android/installer/package-manifest.in
netwerk/protocol/http/HttpDataUsage.js
netwerk/protocol/http/HttpDataUsage.manifest
netwerk/protocol/http/moz.build
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnection.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsIHttpDataUsage.idl
toolkit/components/telemetry/Histograms.json
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -374,18 +374,16 @@
 @BINPATH@/components/passwordmgr.manifest
 @BINPATH@/components/nsLoginInfo.js
 @BINPATH@/components/nsLoginManager.js
 @BINPATH@/components/nsLoginManagerPrompter.js
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest
 #endif
-@BINPATH@/components/HttpDataUsage.manifest
-@BINPATH@/components/HttpDataUsage.js
 @BINPATH@/components/SiteSpecificUserAgent.js
 @BINPATH@/components/SiteSpecificUserAgent.manifest
 @BINPATH@/components/storage-mozStorage.js
 @BINPATH@/components/crypto-SDR.js
 @BINPATH@/components/jsconsole-clhandler.manifest
 @BINPATH@/components/jsconsole-clhandler.js
 @BINPATH@/components/nsDownloadManagerUI.manifest
 @BINPATH@/components/nsDownloadManagerUI.js
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -554,19 +554,16 @@
 @BINPATH@/components/PaymentFlowInfo.js
 @BINPATH@/components/Payment.manifest
 
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest
 #endif
 
-@BINPATH@/components/HttpDataUsage.manifest
-@BINPATH@/components/HttpDataUsage.js
-
 @BINPATH@/chrome/marionette@JAREXT@
 @BINPATH@/chrome/marionette.manifest
 @BINPATH@/components/MarionetteComponents.manifest
 @BINPATH@/components/marionettecomponent.js
 
 #ifdef MOZ_WEBSPEECH
 @BINPATH@/components/dom_webspeechsynth.xpt
 #endif
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -401,19 +401,16 @@
 @BINPATH@/components/TCPServerSocket.js
 @BINPATH@/components/TCPSocket.manifest
 
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest
 #endif
 
-@BINPATH@/components/HttpDataUsage.manifest
-@BINPATH@/components/HttpDataUsage.js
-
 #ifdef MOZ_SERVICES_HEALTHREPORT
 @BINPATH@/components/HealthReportComponents.manifest
 @BINPATH@/components/HealthReportService.js
 #endif
 
 #ifdef MOZ_CAPTIVEDETECT
 @BINPATH@/components/CaptivePortalDetectComponents.manifest
 @BINPATH@/components/captivedetect.js
deleted file mode 100644
--- a/netwerk/protocol/http/HttpDataUsage.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -*- indent-tabs-mode: nil -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* HTTPDATA_* telemetry producer
-   every 3 minutes of idle time we update a data file and report it
-   once a day. this avoids adding io to the shutdown path
-*/
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
-const CC = Components.Constructor;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "idleService",
-                                   "@mozilla.org/widget/idleservice;1",
-                                   "nsIIdleService");
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
-                                  "resource://gre/modules/FileUtils.jsm");
-
-const MB = 1000000;
-
-var gDataUsage;
-function HttpDataUsage() {}
-HttpDataUsage.prototype = {
-    classID: Components.ID("{6d72bfca-2747-4859-887f-6f06d4ce6787}"),
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-    contractID: "@mozilla.org/network/HttpDataUsage;1",
-
-    _isIdleObserver: false,
-    _locked : false,
-    _idle_timeout : 15,
-    _quanta : 86400000, // per day
-
-    _logtime : new Date(),
-    _ethernetRead : 0,
-    _ethernetWritten : 0,
-    _cellRead : 0,
-    _cellWritten : 0,
-
-    _dataFile : FileUtils.getFile("ProfD", ["httpDataUsage.dat"], true),
-    _dataUsage : Cc["@mozilla.org/network/protocol;1?name=http"]
-        .getService(Ci.nsIHttpProtocolHandler)
-        .QueryInterface(Ci.nsIHttpDataUsage),
-    _pipe : CC("@mozilla.org/pipe;1", "nsIPipe", "init"),
-    _outputStream : CC("@mozilla.org/network/file-output-stream;1",
-                       "nsIFileOutputStream", "init"),
-
-    setup: function setup() {
-        gDataUsage = this;
-
-        var enabled = false;
-        try {
-            if (Services.prefs.getBoolPref("toolkit.telemetry.enabled"))
-                enabled = true;
-        } catch (e) { }
-        try {
-            if (Services.prefs.getBoolPref("toolkit.telemetry.enabledPreRelease"))
-                enabled = true;
-        } catch (e) { }
-
-        // this isn't important enough to worry about getting a
-        // runtime telemetry config change for
-        if (!enabled)
-            return;
-
-        if (this._dataUsage == null)
-            return;
-
-        Services.obs.addObserver(this, "quit-application", false);
-        idleService.addIdleObserver(this, this._idle_timeout);
-        this._isIdleObserver = true;
-    },
-    
-    shutdown: function shutdown() {
-        if (this._isIdleObserver) {
-            idleService.removeIdleObserver(this, this._idle_timeout);
-            Services.obs.removeObserver(this, "quit-application");
-        }
-        this._isIdleObserver = false;
-    },
-
-    sUpdateStats2: function sUpdateStats2(stream, result) {
-        gDataUsage.updateStats2(stream, result);
-    },
-
-    readCounters: function readCounters(stream, result) {
-        if (Components.isSuccessCode(result)) {
-            let count = stream.available();
-            let data = NetUtil.readInputStreamToString(stream, count);
-            var list = data.split(",");
-            if (list.length == 5) {
-                this._logtime = new Date(Number(list[0]));
-                this._ethernetRead = Number(list[1]);
-                this._ethernetWritten = Number(list[2]);
-                this._cellRead = Number(list[3]);
-                this._cellWritten = Number(list[4]);
-            }
-        }
-
-        this._ethernetRead += this._dataUsage.ethernetBytesRead;
-        this._ethernetWritten += this._dataUsage.ethernetBytesWritten;
-        this._cellRead += this._dataUsage.cellBytesRead;
-        this._cellWritten += this._dataUsage.cellBytesWritten;
-        this._dataUsage.resetHttpDataUsage();
-    },
-
-    writeCounters: function writeCounters() {
-        var dataout = this._logtime.getTime().toString() + "," +
-            this._ethernetRead.toString() + "," +
-            this._ethernetWritten.toString() + "," +
-            this._cellRead.toString() + "," +
-            this._cellWritten.toString() + "\n";
-
-        var buffer = new this._pipe(true, false, 4096, 1, null);
-        buffer.outputStream.write(dataout, dataout.length);
-        buffer.outputStream.close();
-        var fileOut = new this._outputStream(this._dataFile, -1, -1, 0);
-
-        NetUtil.asyncCopy(buffer.inputStream, fileOut,
-                          function (result) { gDataUsage.finishedWriting(); });
-    },
-
-    updateStats2: function updateStats2(stream, result) {
-        this.readCounters(stream, result);
-        this.submitTelemetry();
-    },
-
-    submitTelemetry: function submitTelemetry() {
-        var now = new Date();
-        var elapsed = now.getTime() - this._logtime.getTime();
-        // make sure we have at least 1 day of data.. if not just write new data out
-        if (elapsed < this._quanta) {
-            this.writeCounters();
-            return;
-        }
-
-        var days = elapsed / this._quanta;
-        var eInPerQuanta = Math.floor(this._ethernetRead / days);
-        var eOutPerQuanta = Math.floor(this._ethernetWritten / days);
-        var cInPerQuanta = Math.floor(this._cellRead / days);
-        var cOutPerQuanta = Math.floor(this._cellWritten / days);
-        
-        var histogram;
-
-        while (elapsed >= this._quanta) {
-            histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_ETHERNET_IN");
-            histogram.add(Math.round(eInPerQuanta / MB));
-            histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_ETHERNET_OUT");
-            histogram.add(Math.round(eOutPerQuanta / MB));
-            histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_CELL_IN");
-            histogram.add(Math.round(cInPerQuanta / MB));
-            histogram = Services.telemetry.getHistogramById("HTTPDATA_DAILY_CELL_OUT");
-            histogram.add(Math.round(cOutPerQuanta / MB));
-
-            elapsed -= this._quanta;
-            this._ethernetRead -= eInPerQuanta;
-            this._ethernetWritten -= eOutPerQuanta;
-            this._cellRead -= cInPerQuanta;
-            this._cellWritten -= cOutPerQuanta;
-        }
-        this._logtime = new Date(now.getTime() - elapsed);
-
-        // need to write back the decremented counters
-        this.writeCounters();
-    },
-
-    finishedWriting : function finishedWriting() {
-        this._locked = false; // all done
-    },
-
-    updateStats: function updateStats() {
-        if (this._locked)
-            return;
-        this._locked = true;
-        
-        NetUtil.asyncFetch(this._dataFile, this.sUpdateStats2);
-    },
-
-    observe: function (aSubject, aTopic, aData) {
-        switch (aTopic) {
-        case "profile-after-change":
-            this.setup();
-            break;
-        case "idle":
-            this.updateStats();
-            break;
-        case "quit-application":
-            this.updateStats();
-            this.shutdown();
-            break;
-        }
-    },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([HttpDataUsage]);
deleted file mode 100644
--- a/netwerk/protocol/http/HttpDataUsage.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-component {6d72bfca-2747-4859-887f-6f06d4ce6787} HttpDataUsage.js
-contract @mozilla.org/network/HttpDataUsage;1 {6d72bfca-2747-4859-887f-6f06d4ce6787}
-category profile-after-change HttpDataUsage @mozilla.org/network/HttpDataUsage;1
--- a/netwerk/protocol/http/moz.build
+++ b/netwerk/protocol/http/moz.build
@@ -8,17 +8,16 @@ XPIDL_SOURCES += [
     'nsIHttpActivityObserver.idl',
     'nsIHttpAuthenticableChannel.idl',
     'nsIHttpAuthenticator.idl',
     'nsIHttpAuthManager.idl',
     'nsIHttpChannel.idl',
     'nsIHttpChannelAuthProvider.idl',
     'nsIHttpChannelChild.idl',
     'nsIHttpChannelInternal.idl',
-    'nsIHttpDataUsage.idl',
     'nsIHttpEventSink.idl',
     'nsIHttpHeaderVisitor.idl',
     'nsIHttpProtocolHandler.idl',
 ]
 
 XPIDL_MODULE = 'necko_http'
 
 EXPORTS += [
@@ -89,21 +88,16 @@ IPDL_SOURCES += [
     'PHttpChannel.ipdl',
 ]
 
 EXTRA_JS_MODULES += [
     'UserAgentOverrides.jsm',
     'UserAgentUpdates.jsm',
 ]
 
-EXTRA_COMPONENTS += [
-    'HttpDataUsage.js',
-    'HttpDataUsage.manifest',
-]
-
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'necko'
 
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -49,18 +49,16 @@ nsHttpConnection::nsHttpConnection()
     , mCallbacksLock("nsHttpConnection::mCallbacksLock")
     , mIdleTimeout(0)
     , mConsiderReusedAfterInterval(0)
     , mConsiderReusedAfterEpoch(0)
     , mCurrentBytesRead(0)
     , mMaxBytesRead(0)
     , mTotalBytesRead(0)
     , mTotalBytesWritten(0)
-    , mUnreportedBytesRead(0)
-    , mUnreportedBytesWritten(0)
     , mKeepAlive(true) // assume to keep-alive by default
     , mKeepAliveMask(true)
     , mDontReuse(false)
     , mSupportsPipelining(false) // assume low-grade server
     , mIsReused(false)
     , mCompletedProxyConnect(false)
     , mLastTransactionExpectedNoContent(false)
     , mIdleMonitoring(false)
@@ -82,17 +80,16 @@ nsHttpConnection::nsHttpConnection()
 {
     LOG(("Creating nsHttpConnection @%x\n", this));
 }
 
 nsHttpConnection::~nsHttpConnection()
 {
     LOG(("Destroying nsHttpConnection @%x\n", this));
 
-    ReportDataUsage(false);
     if (!mEverUsedSpdy) {
         LOG(("nsHttpConnection %p performed %d HTTP/1.x transactions\n",
              this, mHttp1xTransactionCount));
         Telemetry::Accumulate(Telemetry::HTTP_REQUEST_PER_CONN,
                               mHttp1xTransactionCount);
     }
 
     if (mTotalBytesRead) {
@@ -1271,18 +1268,16 @@ nsHttpConnection::CloseTransaction(nsAHt
         mTransaction = nullptr;
     }
 
     {
         MutexAutoLock lock(mCallbacksLock);
         mCallbacks = nullptr;
     }
 
-    ReportDataUsage(false);
-
     if (NS_FAILED(reason))
         Close(reason);
 
     // flag the connection as reused here for convenience sake.  certainly
     // it might be going away instead ;-)
     mIsReused = true;
 }
 
@@ -1315,21 +1310,18 @@ nsHttpConnection::OnReadSegment(const ch
     nsresult rv = mSocketOut->Write(buf, count, countRead);
     if (NS_FAILED(rv))
         mSocketOutCondition = rv;
     else if (*countRead == 0)
         mSocketOutCondition = NS_BASE_STREAM_CLOSED;
     else {
         mLastWriteTime = PR_IntervalNow();
         mSocketOutCondition = NS_OK; // reset condition
-        if (!mProxyConnectInProgress) {
+        if (!mProxyConnectInProgress)
             mTotalBytesWritten += *countRead;
-            mUnreportedBytesWritten += *countRead;
-            ReportDataUsage(true);
-        }
     }
 
     return mSocketOutCondition;
 }
 
 nsresult
 nsHttpConnection::OnSocketWritable()
 {
@@ -1540,18 +1532,16 @@ nsHttpConnection::OnSocketReadable()
             // wait for the transaction to call ResumeRecv.
             if (rv == NS_BASE_STREAM_WOULD_BLOCK)
                 rv = NS_OK;
             again = false;
         }
         else {
             mCurrentBytesRead += n;
             mTotalBytesRead += n;
-            mUnreportedBytesRead += n;
-            ReportDataUsage(true);
             if (NS_FAILED(mSocketInCondition)) {
                 // continue waiting for the socket if necessary...
                 if (mSocketInCondition == NS_BASE_STREAM_WOULD_BLOCK)
                     rv = ResumeRecv();
                 else
                     rv = mSocketInCondition;
                 again = false;
             }
@@ -1606,37 +1596,16 @@ nsHttpConnection::SetupProxyConnect()
 
     buf.Truncate();
     request.Flatten(buf, false);
     buf.AppendLiteral("\r\n");
 
     return NS_NewCStringInputStream(getter_AddRefs(mProxyConnectStream), buf);
 }
 
-void
-nsHttpConnection::ReportDataUsage(bool allowDefer)
-{
-    static const uint64_t kDeferThreshold = 128000;
-
-    if (!mUnreportedBytesRead && !mUnreportedBytesWritten)
-        return;
-
-    if (!gHttpHandler->IsTelemetryEnabled())
-        return;
-
-    if (allowDefer &&
-        (mUnreportedBytesRead + mUnreportedBytesWritten) < kDeferThreshold) {
-        return;
-    }
-
-    gHttpHandler->UpdateDataUsage(mCallbacks,
-                                  mUnreportedBytesRead, mUnreportedBytesWritten);
-    mUnreportedBytesRead = mUnreportedBytesWritten = 0;
-}
-
 nsresult
 nsHttpConnection::StartShortLivedTCPKeepalives()
 {
     if (mUsingSpdyVersion) {
         return NS_OK;
     }
     MOZ_ASSERT(mSocketTransport);
     if (!mSocketTransport) {
--- a/netwerk/protocol/http/nsHttpConnection.h
+++ b/netwerk/protocol/http/nsHttpConnection.h
@@ -201,25 +201,23 @@ private:
     void     SetupSSL(uint32_t caps);
 
     // Start the Spdy transaction handler when NPN indicates spdy/*
     void     StartSpdy(uint8_t versionLevel);
 
     // Directly Add a transaction to an active connection for SPDY
     nsresult AddTransaction(nsAHttpTransaction *, int32_t);
 
-    // used to inform nsIHttpDataUsage of transfer
-    void ReportDataUsage(bool);
-
     // Used to set TCP keepalives for fast detection of dead connections during
     // an initial period, and slower detection for long-lived connections.
     nsresult StartShortLivedTCPKeepalives();
     nsresult StartLongLivedTCPKeepalives();
     nsresult DisableTCPKeepalives();
 
+private:
     nsCOMPtr<nsISocketTransport>    mSocketTransport;
     nsCOMPtr<nsIAsyncInputStream>   mSocketIn;
     nsCOMPtr<nsIAsyncOutputStream>  mSocketOut;
 
     nsresult                        mSocketInCondition;
     nsresult                        mSocketOutCondition;
 
     nsCOMPtr<nsIInputStream>        mProxyConnectStream;
@@ -242,20 +240,16 @@ private:
     PRIntervalTime                  mIdleTimeout;    // value of keep-alive: timeout=
     PRIntervalTime                  mConsiderReusedAfterInterval;
     PRIntervalTime                  mConsiderReusedAfterEpoch;
     int64_t                         mCurrentBytesRead;   // data read per activation
     int64_t                         mMaxBytesRead;       // max read in 1 activation
     int64_t                         mTotalBytesRead;     // total data read
     int64_t                         mTotalBytesWritten;  // does not include CONNECT tunnel
 
-    // for nsIHttpDataUsage
-    uint64_t                        mUnreportedBytesRead;     // subset of totalBytesRead
-    uint64_t                        mUnreportedBytesWritten;  // subset of totalBytesWritten
-
     nsRefPtr<nsIAsyncInputStream>   mInputOverflow;
 
     PRIntervalTime                  mRtt;
 
     bool                            mKeepAlive;
     bool                            mKeepAliveMask;
     bool                            mDontReuse;
     bool                            mSupportsPipelining;
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -57,20 +57,16 @@
 #include <windows.h>
 #endif
 
 #if defined(XP_MACOSX)
 #include <CoreServices/CoreServices.h>
 #include "nsCocoaFeatures.h"
 #endif
 
-#if defined(MOZ_WIDGET_GONK)
-#include "nsINetworkManager.h"
-#endif
-
 //-----------------------------------------------------------------------------
 #include "mozilla/net/HttpChannelChild.h"
 
 
 #ifdef DEBUG
 // defined by the socket transport service while active
 extern PRThread *gSocketThread;
 #endif
@@ -196,28 +192,21 @@ nsHttpHandler::nsHttpHandler()
     , mSpdyPingTimeout(PR_SecondsToInterval(8))
     , mConnectTimeout(90000)
     , mBypassCacheLockThreshold(250.0)
     , mParallelSpeculativeConnectLimit(6)
     , mRequestTokenBucketEnabled(true)
     , mRequestTokenBucketMinParallelism(6)
     , mRequestTokenBucketHz(100)
     , mRequestTokenBucketBurst(32)
-    , mCriticalRequestPrioritization(true)
     , mTCPKeepaliveShortLivedEnabled(false)
     , mTCPKeepaliveShortLivedTimeS(60)
     , mTCPKeepaliveShortLivedIdleTimeS(10)
     , mTCPKeepaliveLongLivedEnabled(false)
     , mTCPKeepaliveLongLivedIdleTimeS(600)
-    , mEthernetBytesRead(0)
-    , mEthernetBytesWritten(0)
-    , mCellBytesRead(0)
-    , mCellBytesWritten(0)
-    , mNetworkTypeKnown(false)
-    , mNetworkTypeWasEthernet(true)
 {
 #if defined(PR_LOGGING)
     gHttpLog = PR_NewLogModule("nsHttp");
 #endif
 
     LOG(("Creating nsHttpHandler [this=%p].\n", this));
 
     MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!");
@@ -1579,24 +1568,23 @@ nsHttpHandler::SetAcceptEncodings(const 
     mAcceptEncodings = aAcceptEncodings;
     return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler::nsISupports
 //-----------------------------------------------------------------------------
 
-NS_IMPL_ISUPPORTS7(nsHttpHandler,
+NS_IMPL_ISUPPORTS6(nsHttpHandler,
                    nsIHttpProtocolHandler,
                    nsIProxiedProtocolHandler,
                    nsIProtocolHandler,
                    nsIObserver,
                    nsISupportsWeakReference,
-                   nsISpeculativeConnect,
-                   nsIHttpDataUsage)
+                   nsISpeculativeConnect)
 
 //-----------------------------------------------------------------------------
 // nsHttpHandler::nsIProtocolHandler
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpHandler::GetScheme(nsACString &aScheme)
 {
@@ -1910,258 +1898,55 @@ nsHttpHandler::SpeculativeConnect(nsIURI
         return rv;
 
     nsHttpConnectionInfo *ci =
         new nsHttpConnectionInfo(host, port, nullptr, usingSSL);
 
     return SpeculativeConnect(ci, aCallbacks);
 }
 
-// nsIHttpDataUsage
-
-NS_IMETHODIMP
-nsHttpHandler::GetEthernetBytesRead(uint64_t *aEthernetBytesRead)
-{
-    MOZ_ASSERT(NS_IsMainThread());
-    *aEthernetBytesRead = mEthernetBytesRead;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHttpHandler::GetEthernetBytesWritten(uint64_t *aEthernetBytesWritten)
-{
-    MOZ_ASSERT(NS_IsMainThread());
-    *aEthernetBytesWritten = mEthernetBytesWritten;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHttpHandler::GetCellBytesRead(uint64_t *aCellBytesRead)
-{
-    MOZ_ASSERT(NS_IsMainThread());
-    *aCellBytesRead = mCellBytesRead;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHttpHandler::GetCellBytesWritten(uint64_t *aCellBytesWritten)
+void
+nsHttpHandler::TickleWifi(nsIInterfaceRequestor *cb)
 {
-    MOZ_ASSERT(NS_IsMainThread());
-    *aCellBytesWritten = mCellBytesWritten;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHttpHandler::ResetHttpDataUsage()
-{
-    MOZ_ASSERT(NS_IsMainThread());
-    mEthernetBytesRead = mEthernetBytesWritten = 0;
-    mCellBytesRead = mCellBytesWritten = 0;
-    return NS_OK;
-}
-
-class DataUsageEvent : public nsRunnable
-{
-public:
-    explicit DataUsageEvent(nsIInterfaceRequestor *cb,
-                            uint64_t bytesRead,
-                            uint64_t bytesWritten)
-        : mCB(cb), mRead(bytesRead), mWritten(bytesWritten) { }
-    
-  NS_IMETHOD Run() MOZ_OVERRIDE
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-    if (gHttpHandler)
-        gHttpHandler->UpdateDataUsage(mCB, mRead, mWritten);
-    return NS_OK;
-  }
-
-private:
-  ~DataUsageEvent() { }
-  nsCOMPtr<nsIInterfaceRequestor> mCB;
-  uint64_t mRead;
-  uint64_t mWritten;
-};
-
-void
-nsHttpHandler::UpdateDataUsage(nsIInterfaceRequestor *cb,
-                               uint64_t bytesRead, uint64_t bytesWritten)
-{
-    if (!IsTelemetryEnabled())
+    if (!cb || !mWifiTickler)
         return;
 
-    if (!NS_IsMainThread()) {
-        nsRefPtr<nsIRunnable> event = new DataUsageEvent(cb, bytesRead, bytesWritten);
-        NS_DispatchToMainThread(event);
-        return;
-    }
-    
-    bool isEthernet = true;
-
-    if (NS_FAILED(GetNetworkEthernetInfo(cb, &isEthernet))) {
-        // without a window it is hard for android to determine the network type
-        // so on failures we will just use the last value
-        if (!mNetworkTypeKnown)
-            return;
-        isEthernet = mNetworkTypeWasEthernet;
-    }
-
-    if (isEthernet) {
-        mEthernetBytesRead += bytesRead;
-        mEthernetBytesWritten += bytesWritten;
-    } else {
-        mCellBytesRead += bytesRead;
-        mCellBytesWritten += bytesWritten;
-    }
-}
-
-nsresult
-nsHttpHandler::GetNetworkEthernetInfo(nsIInterfaceRequestor *cb,
-                                      bool *aEthernet)
-{
-    NS_ENSURE_ARG_POINTER(aEthernet);
-
-    nsresult rv = GetNetworkEthernetInfoInner(cb, aEthernet);
-    if (NS_SUCCEEDED(rv)) {
-        mNetworkTypeKnown = true;
-        mNetworkTypeWasEthernet = *aEthernet;
-    }
-    return rv;
-}
-
-// aEthernet and aGateway are required out parameters
-// on b2g and desktop gateway cannot be determined yet and
-// this function returns ERROR_NOT_IMPLEMENTED.
-nsresult
-nsHttpHandler::GetNetworkInfo(nsIInterfaceRequestor *cb,
-                              bool *aEthernet,
-                              uint32_t *aGateway)
-{
-    NS_ENSURE_ARG_POINTER(aEthernet);
-    NS_ENSURE_ARG_POINTER(aGateway);
-
-    nsresult rv = GetNetworkInfoInner(cb, aEthernet, aGateway);
-    if (NS_SUCCEEDED(rv)) {
-        mNetworkTypeKnown = true;
-        mNetworkTypeWasEthernet = *aEthernet;
-    }
-    return rv;
-}
-
-nsresult
-nsHttpHandler::GetNetworkInfoInner(nsIInterfaceRequestor *cb,
-                                   bool *aEthernet,
-                                   uint32_t *aGateway)
-{
-    NS_ENSURE_ARG_POINTER(aEthernet);
-    NS_ENSURE_ARG_POINTER(aGateway);
-
-    *aGateway = 0;
-    *aEthernet = true;
-    
-#if defined(MOZ_WIDGET_GONK)
-    // b2g only allows you to ask for ethernet or not right now.
-    return NS_ERROR_NOT_IMPLEMENTED;
-#endif
-
-#if defined(ANDROID)
-    if (!cb)
-        return NS_ERROR_FAILURE;
+    // If B2G requires a similar mechanism nsINetworkManager, currently only avail
+    // on B2G, contains the necessary information on wifi and gateway
 
     nsCOMPtr<nsIDOMWindow> domWindow;
     cb->GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
     if (!domWindow)
-        return NS_ERROR_FAILURE;
+        return;
 
     nsCOMPtr<nsIDOMNavigator> domNavigator;
     domWindow->GetNavigator(getter_AddRefs(domNavigator));
     nsCOMPtr<nsIMozNavigatorNetwork> networkNavigator =
         do_QueryInterface(domNavigator);
     if (!networkNavigator)
-        return NS_ERROR_FAILURE;
+        return;
 
     nsCOMPtr<nsISupports> mozConnection;
     networkNavigator->GetMozConnection(getter_AddRefs(mozConnection));
     nsCOMPtr<nsINetworkProperties> networkProperties =
         do_QueryInterface(mozConnection);
     if (!networkProperties)
-        return NS_ERROR_FAILURE;
-
-    nsresult rv;
-    rv = networkProperties->GetDhcpGateway(aGateway);
-    if (NS_FAILED(rv))
-        return rv;
-
-    return networkProperties->GetIsWifi(aEthernet);
-#endif
-
-    // desktop does not currently know about the gateway
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-nsresult
-nsHttpHandler::GetNetworkEthernetInfoInner(nsIInterfaceRequestor *cb,
-                                           bool *aEthernet)
-{
-    *aEthernet = true;
-    
-#if defined(MOZ_WIDGET_GONK)
-    int32_t networkType;
-    nsCOMPtr<nsINetworkManager> networkManager = 
-        do_GetService("@mozilla.org/network/manager;1");
-    if (!networkManager)
-        return NS_ERROR_FAILURE;
-    if (NS_FAILED(networkManager->GetPreferredNetworkType(&networkType)))
-        return NS_ERROR_FAILURE;
-    *aEthernet = networkType == nsINetworkInterface::NETWORK_TYPE_WIFI;
-    return NS_OK;
-#endif
-
-#if defined(ANDROID)
-    if (!cb)
-        return NS_ERROR_FAILURE;
-
-    nsCOMPtr<nsIDOMWindow> domWindow;
-    cb->GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
-    if (!domWindow)
-        return NS_ERROR_FAILURE;
-
-    nsCOMPtr<nsIDOMNavigator> domNavigator;
-    domWindow->GetNavigator(getter_AddRefs(domNavigator));
-    nsCOMPtr<nsIMozNavigatorNetwork> networkNavigator =
-        do_QueryInterface(domNavigator);
-    if (!networkNavigator)
-        return NS_ERROR_FAILURE;
-
-    nsCOMPtr<nsISupports> mozConnection;
-    networkNavigator->GetMozConnection(getter_AddRefs(mozConnection));
-    nsCOMPtr<nsINetworkProperties> networkProperties =
-        do_QueryInterface(mozConnection);
-    if (!networkProperties)
-        return NS_ERROR_FAILURE;
-
-    return networkProperties->GetIsWifi(aEthernet);
-#endif
-
-    // desktop assumes never on cell data
-    *aEthernet = true;
-    return NS_OK;
-}
-
-void
-nsHttpHandler::TickleWifi(nsIInterfaceRequestor *cb)
-{
-    if (!cb || !mWifiTickler)
         return;
 
     uint32_t gwAddress;
     bool isWifi;
+    nsresult rv;
 
-    nsresult rv = GetNetworkInfo(cb, &isWifi, &gwAddress);
-    if (NS_FAILED(rv) || !gwAddress || !isWifi)
+    rv = networkProperties->GetDhcpGateway(&gwAddress);
+    if (NS_SUCCEEDED(rv))
+        rv = networkProperties->GetIsWifi(&isWifi);
+    if (NS_FAILED(rv))
+        return;
+
+    if (!gwAddress || !isWifi)
         return;
 
     mWifiTickler->SetIPV4Address(gwAddress);
     mWifiTickler->Tickle();
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpsHandler implementation
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -10,17 +10,16 @@
 #include "nsHttpAuthCache.h"
 #include "nsHttpConnectionMgr.h"
 #include "ASpdySession.h"
 
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsWeakReference.h"
 
-#include "nsIHttpDataUsage.h"
 #include "nsIHttpProtocolHandler.h"
 #include "nsIObserver.h"
 #include "nsISpeculativeConnect.h"
 #include "nsICache.h"
 
 class nsIHttpChannel;
 class nsIPrefBranch;
 class nsICancelable;
@@ -43,26 +42,24 @@ class nsHttpTransaction;
 //-----------------------------------------------------------------------------
 // nsHttpHandler - protocol handler for HTTP and HTTPS
 //-----------------------------------------------------------------------------
 
 class nsHttpHandler : public nsIHttpProtocolHandler
                     , public nsIObserver
                     , public nsSupportsWeakReference
                     , public nsISpeculativeConnect
-                    , public nsIHttpDataUsage
 {
 public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIPROXIEDPROTOCOLHANDLER
     NS_DECL_NSIHTTPPROTOCOLHANDLER
     NS_DECL_NSIOBSERVER
     NS_DECL_NSISPECULATIVECONNECT
-    NS_DECL_NSIHTTPDATAUSAGE
 
     nsHttpHandler();
     virtual ~nsHttpHandler();
 
     nsresult Init();
     nsresult AddStandardRequestHeaders(nsHttpHeaderArray *);
     nsresult AddConnectionHeader(nsHttpHeaderArray *,
                                  uint32_t capabilities);
@@ -523,40 +520,18 @@ public:
 
     // Socket thread only
     void SetRequestTokenBucket(EventTokenBucket *aTokenBucket)
     {
         mRequestTokenBucket = aTokenBucket;
     }
 
 private:
-    // for nsIHttpDataUsage
-    uint64_t mEthernetBytesRead;
-    uint64_t mEthernetBytesWritten;
-    uint64_t mCellBytesRead;
-    uint64_t mCellBytesWritten;
-    bool     mNetworkTypeKnown;
-    bool     mNetworkTypeWasEthernet;
-
     nsRefPtr<Tickler> mWifiTickler;
-    nsresult GetNetworkEthernetInfo(nsIInterfaceRequestor *cb,
-                                    bool *ethernet);
-    nsresult GetNetworkEthernetInfoInner(nsIInterfaceRequestor *cb,
-                                         bool *ethernet);
-    nsresult GetNetworkInfo(nsIInterfaceRequestor *cb,
-                            bool *ethernet, uint32_t *gw);
-    nsresult GetNetworkInfoInner(nsIInterfaceRequestor *cb,
-                                 bool *ethernet, uint32_t *gw);
     void TickleWifi(nsIInterfaceRequestor *cb);
-
-public:
-    // this is called to update the member variables used for nsIHttpDataUsage
-    // it can be called from any thread
-    void UpdateDataUsage(nsIInterfaceRequestor *cb,
-                         uint64_t bytesRead, uint64_t bytesWritten);
 };
 
 extern nsHttpHandler *gHttpHandler;
 
 //-----------------------------------------------------------------------------
 // nsHttpsHandler - thin wrapper to distinguish the HTTP handler from the
 //                  HTTPS handler (even though they share the same impl).
 //-----------------------------------------------------------------------------
deleted file mode 100644
--- a/netwerk/protocol/http/nsIHttpDataUsage.idl
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-/**
- * nsIHttpDataUsage contains counters for the amount of HTTP data transferred
- * in and out of this session since the last time it was reset with the
- * resetHttpDataUsage() method. These counters are normally reset on each
- * telemetry ping.
- *
- * Data is split into ethernet and cell. ethernet includes wifi.
- *
- */
-
-[scriptable, uuid(79dee3eb-9323-4d5c-b0a8-1baa18934d9e)]
-interface nsIHttpDataUsage : nsISupports
-{
-    readonly attribute unsigned long long ethernetBytesRead;
-    readonly attribute unsigned long long ethernetBytesWritten;
-    readonly attribute unsigned long long cellBytesRead;
-    readonly attribute unsigned long long cellBytesWritten;
-    
-    void resetHttpDataUsage();
-};
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -1135,48 +1135,16 @@
     "kind": "boolean",
     "description": "Whether a HTTP transaction was over SSL or not."
   },
   "HTTP_PAGELOAD_IS_SSL": {
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "Whether a HTTP base page load was over SSL or not."
   },
-  "HTTPDATA_DAILY_ETHERNET_IN": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "10000",
-    "n_buckets": 200,
-    "extended_statistics_ok": true,
-    "description": "MB of http ethernet data recvd in one day"
-  },
-  "HTTPDATA_DAILY_ETHERNET_OUT": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "10000",
-    "n_buckets": 200,
-    "extended_statistics_ok": true,
-    "description": "MB of http ethernet data sent in one day"
-  },
-  "HTTPDATA_DAILY_CELL_IN": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "10000",
-    "n_buckets": 200,
-    "extended_statistics_ok": true,
-    "description": "MB of http cell data recvd in one day"
-  },
-  "HTTPDATA_DAILY_CELL_OUT": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "10000",
-    "n_buckets": 200,
-    "extended_statistics_ok": true,
-    "description": "MB of http cell data sent in one day"
-  },
   "SSL_HANDSHAKE_VERSION": {
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 16,
     "description": "SSL Version (0=ssl3, 1=tls1, 2=tls1.1, 3=tls1.2)"
   },
   "SSL_TIME_UNTIL_READY": {
     "expires_in_version": "never",