Bug 1320289 - register STS thread to gecko profiler. r=mayhemer,cyu
MozReview-Commit-ID: IzDNHDYAgsT
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -819,16 +819,21 @@ void
nsSocketTransportService::MarkTheLastElementOfPendingQueue()
{
mServingPendingQueue = false;
}
NS_IMETHODIMP
nsSocketTransportService::Run()
{
+#ifdef MOZ_ENABLE_PROFILER_SPS
+ char stackBaseGuess; // Need to be the first variable of main loop function.
+ profiler_register_thread(PR_GetThreadName(PR_GetCurrentThread()), &stackBaseGuess);
+#endif // MOZ_ENABLE_PROFILER_SPS
+
SOCKET_LOG(("STS thread init %d sockets\n", gMaxCount));
psm::InitializeSSLServerCertVerificationThreads();
gSocketThread = PR_GetCurrentThread();
{
MutexAutoLock lock(mLock);
@@ -999,16 +1004,21 @@ nsSocketTransportService::Run()
// socket detach handlers get processed.
NS_ProcessPendingEvents(mRawThread);
gSocketThread = nullptr;
psm::StopSSLServerCertVerificationThreads();
SOCKET_LOG(("STS thread exit\n"));
+
+#ifdef MOZ_ENABLE_PROFILER_SPS
+ profiler_unregister_thread();
+#endif // MOZ_ENABLE_PROFILER_SPS
+
return NS_OK;
}
void
nsSocketTransportService::DetachSocketWithGuard(bool aGuardLocals,
SocketContext *socketList,
int32_t index)
{