diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-05-12 16:19:33 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-05-12 16:19:58 +0200 |
commit | 6571d2ceb42930dab01677ef0e95e732d5076fb8 (patch) | |
tree | 8c593b8e09f2cfb457df72d40dc719bb0e0df066 /dom/network/TCPSocket.cpp | |
parent | 2f359ed80ccb2cab440c0cda886404ed42ad9fdf (diff) | |
download | UXP-6571d2ceb42930dab01677ef0e95e732d5076fb8.tar UXP-6571d2ceb42930dab01677ef0e95e732d5076fb8.tar.gz UXP-6571d2ceb42930dab01677ef0e95e732d5076fb8.tar.lz UXP-6571d2ceb42930dab01677ef0e95e732d5076fb8.tar.xz UXP-6571d2ceb42930dab01677ef0e95e732d5076fb8.zip |
Remove MOZ_WIDGET_GONK [1/2]
Tag #288
Diffstat (limited to 'dom/network/TCPSocket.cpp')
-rw-r--r-- | dom/network/TCPSocket.cpp | 72 |
1 files changed, 1 insertions, 71 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) { |