Bug 1323076 - Part 5: Necko with flag checking for TaskTracer. r=mayhemer
authorThinker K.F. Li <thinker@codemud.net>
Wed, 22 Mar 2017 21:53:00 +0100
changeset 400016 26ba1913fa356f3e31d344305f4739e8415bd901
parent 400015 425695abf3088c19367f087298b155f2d0a07cb3
child 400017 75e1cfcb595bb6ab867b540cba453c402f2e6ef5
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1323076
milestone55.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 1323076 - Part 5: Necko with flag checking for TaskTracer. r=mayhemer
netwerk/cache2/CacheIOThread.cpp
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpHandler.cpp
--- a/netwerk/cache2/CacheIOThread.cpp
+++ b/netwerk/cache2/CacheIOThread.cpp
@@ -322,18 +322,20 @@ nsresult CacheIOThread::DispatchAfterPen
   return DispatchInternal(do_AddRef(aRunnable), OPEN_PRIORITY);
 }
 
 nsresult CacheIOThread::DispatchInternal(already_AddRefed<nsIRunnable> aRunnable,
 					 uint32_t aLevel)
 {
   nsCOMPtr<nsIRunnable> runnable(aRunnable);
 #ifdef MOZ_TASK_TRACER
-  runnable = tasktracer::CreateTracedRunnable(runnable.forget());
-  (static_cast<tasktracer::TracedRunnable*>(runnable.get()))->DispatchTask();
+  if (tasktracer::IsStartLogging()) {
+      runnable = tasktracer::CreateTracedRunnable(runnable.forget());
+      (static_cast<tasktracer::TracedRunnable*>(runnable.get()))->DispatchTask();
+  }
 #endif
 
   if (NS_WARN_IF(!runnable))
     return NS_ERROR_NULL_POINTER;
 
   mMonitor.AssertCurrentThreadOwns();
 
   ++mQueueLength[aLevel];
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1973,21 +1973,23 @@ HttpChannelChild::AsyncOpen(nsIStreamLis
 
   NS_ENSURE_TRUE(gNeckoChild != nullptr, NS_ERROR_FAILURE);
   NS_ENSURE_ARG_POINTER(listener);
   NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS);
   NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_ALREADY_OPENED);
 
   mAsyncOpenTime = TimeStamp::Now();
 #ifdef MOZ_TASK_TRACER
-  nsCOMPtr<nsIURI> uri;
-  GetURI(getter_AddRefs(uri));
-  nsAutoCString urispec;
-  uri->GetSpec(urispec);
-  tasktracer::AddLabel("HttpChannelChild::AsyncOpen %s", urispec.get());
+  if (tasktracer::IsStartLogging()) {
+    nsCOMPtr<nsIURI> uri;
+    GetURI(getter_AddRefs(uri));
+    nsAutoCString urispec;
+    uri->GetSpec(urispec);
+    tasktracer::AddLabel("HttpChannelChild::AsyncOpen %s", urispec.get());
+  }
 #endif
   
 
   // Port checked in parent, but duplicate here so we can return with error
   // immediately
   nsresult rv;
   rv = NS_CheckPortSafety(mURI);
   if (NS_FAILED(rv))
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -5769,17 +5769,17 @@ nsHttpChannel::AsyncOpen(nsIStreamListen
                mLoadInfo->GetInitialSecurityCheckDone() ||
                (mLoadInfo->GetSecurityMode() == nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL &&
                 nsContentUtils::IsSystemPrincipal(mLoadInfo->LoadingPrincipal())),
                "security flags in loadInfo but asyncOpen2() not called");
 
     LOG(("nsHttpChannel::AsyncOpen [this=%p]\n", this));
 
 #ifdef MOZ_TASK_TRACER
-    {
+    if (tasktracer::IsStartLogging()) {
         uint64_t sourceEventId, parentTaskId;
         tasktracer::SourceEventType sourceEventType;
         GetCurTraceInfo(&sourceEventId, &parentTaskId, &sourceEventType);
         nsCOMPtr<nsIURI> uri;
         GetURI(getter_AddRefs(uri));
         nsAutoCString urispec;
         uri->GetSpec(urispec);
         tasktracer::AddLabel("nsHttpChannel::AsyncOpen %s", urispec.get());
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -1918,17 +1918,17 @@ nsHttpHandler::NewProxiedChannel2(nsIURI
                                   nsIChannel** result)
 {
     RefPtr<HttpBaseChannel> httpChannel;
 
     LOG(("nsHttpHandler::NewProxiedChannel [proxyInfo=%p]\n",
         givenProxyInfo));
 
 #ifdef MOZ_TASK_TRACER
-    {
+    if (tasktracer::IsStartLogging()) {
         nsAutoCString urispec;
         uri->GetSpec(urispec);
         tasktracer::AddLabel("nsHttpHandler::NewProxiedChannel2 %s", urispec.get());
     }
 #endif
 
     nsCOMPtr<nsProxyInfo> proxyInfo;
     if (givenProxyInfo) {