Bug 1323100 - Use nsThreadPoolNaming::GetNextThreadName and NS_NewNamedThread for the mozStorage thread. r?froydnj draft
authorMarkus Stange <mstange@themasta.com>
Tue, 20 Dec 2016 14:20:15 +0100
changeset 456879 58e73a3fe700792b823c740503b093df38afe67d
parent 456878 b46e3762c296756eeaa2ed30db27f74260c74dfc
child 456880 321deb0a3e81511e3e4c5a042ebbbb19c3b036f3
push id40636
push userbmo:mstange@themasta.com
push dateFri, 06 Jan 2017 12:38:48 +0000
reviewersfroydnj
bugs1323100
milestone53.0a1
Bug 1323100 - Use nsThreadPoolNaming::GetNextThreadName and NS_NewNamedThread for the mozStorage thread. r?froydnj MozReview-Commit-ID: 145CjwiQawB
storage/mozStorageConnection.cpp
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -584,24 +584,23 @@ Connection::getAsyncExecutionTarget()
   MutexAutoLock lockedScope(sharedAsyncExecutionMutex);
 
   // If we are shutting down the asynchronous thread, don't hand out any more
   // references to the thread.
   if (mAsyncExecutionThreadShuttingDown)
     return nullptr;
 
   if (!mAsyncExecutionThread) {
-    nsresult rv = ::NS_NewThread(getter_AddRefs(mAsyncExecutionThread));
+    static nsThreadPoolNaming naming;
+    nsresult rv = NS_NewNamedThread(naming.GetNextThreadName("mozStorage"),
+                                    getter_AddRefs(mAsyncExecutionThread));
     if (NS_FAILED(rv)) {
       NS_WARNING("Failed to create async thread.");
       return nullptr;
     }
-    static nsThreadPoolNaming naming;
-    naming.SetThreadPoolName(NS_LITERAL_CSTRING("mozStorage"),
-                             mAsyncExecutionThread);
   }
 
 #ifdef DEBUG
   mAsyncExecutionThreadIsAlive = true;
 #endif
 
   return mAsyncExecutionThread;
 }