mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 897910 - Trace data sent or received by Firefox. r=mcmanus
This commit is contained in:
parent
25917e751e
commit
2c2e4875ec
@ -42,8 +42,11 @@ Dashboard::RequestSockets(NetDashboardCallback* cb)
|
||||
void
|
||||
Dashboard::GetSocketsDispatch()
|
||||
{
|
||||
if (gSocketTransportService)
|
||||
if (gSocketTransportService) {
|
||||
gSocketTransportService->GetSocketConnections(&mSock.data);
|
||||
mSock.totalSent = gSocketTransportService->GetSentBytes();
|
||||
mSock.totalRecv = gSocketTransportService->GetReceivedBytes();
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &Dashboard::GetSockets);
|
||||
mSock.thread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
@ -91,6 +94,9 @@ Dashboard::GetSockets()
|
||||
dict.mReceived += mSock.data[i].received;
|
||||
}
|
||||
|
||||
dict.mSent += mSock.totalSent;
|
||||
dict.mReceived += mSock.totalRecv;
|
||||
|
||||
JS::RootedValue val(cx);
|
||||
if (!dict.ToObject(cx, JS::NullPtr(), &val)) {
|
||||
mSock.cb = nullptr;
|
||||
|
@ -59,6 +59,8 @@ nsSocketTransportService::nsSocketTransportService()
|
||||
, mIdleListSize(SOCKET_LIMIT_MIN)
|
||||
, mActiveCount(0)
|
||||
, mIdleCount(0)
|
||||
, mSentBytesCount(0)
|
||||
, mReceivedBytesCount(0)
|
||||
, mSendBufferSize(0)
|
||||
, mProbedMaxCount(false)
|
||||
{
|
||||
@ -178,6 +180,8 @@ nsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *s
|
||||
|
||||
// inform the handler that this socket is going away
|
||||
sock->mHandler->OnSocketDetached(sock->mFD);
|
||||
mSentBytesCount += sock->mHandler->ByteCountSent();
|
||||
mReceivedBytesCount += sock->mHandler->ByteCountReceived();
|
||||
|
||||
// cleanup
|
||||
sock->mFD = nullptr;
|
||||
|
@ -74,9 +74,11 @@ public:
|
||||
return mActiveCount + mIdleCount < gMaxCount;
|
||||
}
|
||||
|
||||
// Called by the networking dashboard
|
||||
// Called by the networking dashboard on the socket thread only
|
||||
// Fills the passed array with socket information
|
||||
void GetSocketConnections(nsTArray<mozilla::net::SocketInfo> *);
|
||||
uint64_t GetSentBytes() { return mSentBytesCount; }
|
||||
uint64_t GetReceivedBytes() { return mReceivedBytesCount; }
|
||||
protected:
|
||||
|
||||
virtual ~nsSocketTransportService();
|
||||
@ -154,7 +156,10 @@ private:
|
||||
bool GrowActiveList();
|
||||
bool GrowIdleList();
|
||||
void InitMaxCount();
|
||||
|
||||
|
||||
// Total bytes number transfered through all the sockets except active ones
|
||||
uint64_t mSentBytesCount;
|
||||
uint64_t mReceivedBytesCount;
|
||||
//-------------------------------------------------------------------------
|
||||
// poll list (socket thread only)
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user