summaryrefslogtreecommitdiffstats
path: root/dom/network
diff options
context:
space:
mode:
Diffstat (limited to 'dom/network')
-rw-r--r--dom/network/TCPSocket.cpp72
-rw-r--r--dom/network/TCPSocket.h17
2 files changed, 1 insertions, 88 deletions
diff --git a/dom/network/TCPSocket.cpp b/dom/network/TCPSocket.cpp
index 4eb2f72f6..38827a9ac 100644
--- a/dom/network/TCPSocket.cpp
+++ b/dom/network/TCPSocket.cpp
@@ -33,11 +33,6 @@
#include "nsStringStream.h"
#include "secerr.h"
#include "sslerr.h"
-#ifdef MOZ_WIDGET_GONK
-#include "nsINetworkStatsServiceProxy.h"
-#include "nsINetworkManager.h"
-#include "nsINetworkInterface.h"
-#endif
#define BUFFER_SIZE 65536
#define NETWORK_STATS_THRESHOLD 65536
@@ -163,12 +158,6 @@ TCPSocket::TCPSocket(nsIGlobalObject* aGlobal, const nsAString& aHost, uint16_t
, mTrackingNumber(0)
, mWaitingForStartTLS(false)
, mObserversActive(false)
-#ifdef MOZ_WIDGET_GONK
- , mTxBytes(0)
- , mRxBytes(0)
- , mAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID)
- , mInIsolatedMozBrowser(false)
-#endif
{
if (aGlobal) {
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
@@ -323,13 +312,6 @@ TCPSocket::InitWithTransport(nsISocketTransport* aTransport)
mTransport->GetPort(&port);
mPort = port;
-#ifdef MOZ_WIDGET_GONK
- nsCOMPtr<nsINetworkManager> networkManager = do_GetService("@mozilla.org/network/manager;1");
- if (networkManager) {
- networkManager->GetActiveNetworkInfo(getter_AddRefs(mActiveNetworkInfo));
- }
-#endif
-
return NS_OK;
}
@@ -651,12 +633,6 @@ TCPSocket::Resume(mozilla::ErrorResult& aRv)
nsresult
TCPSocket::MaybeReportErrorAndCloseIfOpen(nsresult status) {
-#ifdef MOZ_WIDGET_GONK
- // Save network statistics once the connection is closed.
- // For now this function is Gonk-specific.
- SaveNetworkStats(true);
-#endif
-
// If we're closed, we've already reported the error or just don't need to
// report the error.
if (mReadyState == TCPReadyState::Closed) {
@@ -941,12 +917,6 @@ TCPSocket::Send(nsIInputStream* aStream, uint32_t aByteLength)
EnsureCopying();
-#ifdef MOZ_WIDGET_GONK
- // Collect transmitted amount for network statistics.
- mTxBytes += aByteLength;
- SaveNetworkStats(false);
-#endif
-
return !bufferFull;
}
@@ -1069,12 +1039,6 @@ NS_IMETHODIMP
TCPSocket::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext, nsIInputStream* aStream,
uint64_t aOffset, uint32_t aCount)
{
-#ifdef MOZ_WIDGET_GONK
- // Collect received amount for network statistics.
- mRxBytes += aCount;
- SaveNetworkStats(false);
-#endif
-
if (mUseArrayBuffers) {
nsTArray<uint8_t> buffer;
buffer.SetCapacity(aCount);
@@ -1160,10 +1124,7 @@ TCPSocket::SetSocketBridgeParent(TCPSocketParent* aBridgeParent)
void
TCPSocket::SetAppIdAndBrowser(uint32_t aAppId, bool aInIsolatedMozBrowser)
{
-#ifdef MOZ_WIDGET_GONK
- mAppId = aAppId;
- mInIsolatedMozBrowser = aInIsolatedMozBrowser;
-#endif
+ /*** STUB ***/
}
NS_IMETHODIMP
@@ -1190,37 +1151,6 @@ TCPSocket::UpdateBufferedAmount(uint32_t aBufferedAmount, uint32_t aTrackingNumb
return NS_OK;
}
-#ifdef MOZ_WIDGET_GONK
-void
-TCPSocket::SaveNetworkStats(bool aEnforce)
-{
- if (!mTxBytes && !mRxBytes) {
- // There is no traffic at all. No need to save statistics.
- return;
- }
-
- // If "enforce" is false, the traffic amount is saved to NetworkStatsServiceProxy
- // only when the total amount exceeds the predefined threshold value.
- // The purpose is to avoid too much overhead for collecting statistics.
- uint32_t totalBytes = mTxBytes + mRxBytes;
- if (!aEnforce && totalBytes < NETWORK_STATS_THRESHOLD) {
- return;
- }
-
- nsCOMPtr<nsINetworkStatsServiceProxy> nssProxy =
- do_GetService("@mozilla.org/networkstatsServiceProxy;1");
- if (!nssProxy) {
- return;
- }
-
- nssProxy->SaveAppStats(mAppId, mInIsolatedMozBrowser, mActiveNetworkInfo,
- PR_Now(), mRxBytes, mTxBytes, false, nullptr);
-
- // Reset the counters once the statistics is saved to NetworkStatsServiceProxy.
- mTxBytes = mRxBytes = 0;
-}
-#endif
-
NS_IMETHODIMP
TCPSocket::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
{
diff --git a/dom/network/TCPSocket.h b/dom/network/TCPSocket.h
index e98c03ca5..4ad425b9e 100644
--- a/dom/network/TCPSocket.h
+++ b/dom/network/TCPSocket.h
@@ -179,10 +179,6 @@ private:
void ActivateTLS();
// Dispatch an error event if necessary, then dispatch a "close" event.
nsresult MaybeReportErrorAndCloseIfOpen(nsresult status);
-#ifdef MOZ_WIDGET_GONK
- // Store and reset any saved network stats for this socket.
- void SaveNetworkStats(bool aEnforce);
-#endif
// Helper for FireDataStringEvent/FireDataArrayEvent.
nsresult FireDataEvent(JSContext* aCx, const nsAString& aType,
@@ -246,19 +242,6 @@ private:
nsTArray<nsCOMPtr<nsIInputStream>> mPendingDataWhileCopierActive;
bool mObserversActive;
-
-#ifdef MOZ_WIDGET_GONK
- // Number of bytes sent.
- uint32_t mTxBytes;
- // Number of bytes received.
- uint32_t mRxBytes;
- // The app that owns this socket.
- uint32_t mAppId;
- // Was this socket created inside of an isolated browser frame?
- bool mInIsolatedMozBrowser;
- // The name of the active network used by this socket.
- nsCOMPtr<nsINetworkInfo> mActiveNetworkInfo;
-#endif
};
} // namespace dom