Bug 1323100 - Use NS_NewNamedThread for IndexedDB threads. r=froydnj

MozReview-Commit-ID: Do4l5QL2qSG

--HG--
extra : rebase_source : ae45941a84ec25a45b796bd01d6bac48f3be6886
This commit is contained in:
Markus Stange 2016-12-21 11:26:48 +01:00
Родитель 6ec87f0dbb
Коммит d2dbdff4a9
1 изменённых файлов: 9 добавлений и 21 удалений

Просмотреть файл

@ -5720,6 +5720,11 @@ public:
return mSerialNumber;
}
nsCString GetThreadName() const
{
return nsPrintfCString("IndexedDB #%lu", mSerialNumber);
}
private:
~ThreadRunnable() override;
@ -12571,7 +12576,10 @@ ConnectionPool::ScheduleTransaction(TransactionInfo* aTransactionInfo,
RefPtr<ThreadRunnable> runnable = new ThreadRunnable();
nsCOMPtr<nsIThread> newThread;
if (NS_SUCCEEDED(NS_NewThread(getter_AddRefs(newThread), runnable))) {
nsresult rv =
NS_NewNamedThread(runnable->GetThreadName(),
getter_AddRefs(newThread), runnable);
if (NS_SUCCEEDED(rv)) {
MOZ_ASSERT(newThread);
IDB_DEBUG_LOG(("ConnectionPool created thread %lu",
@ -13284,10 +13292,6 @@ nsresult
ConnectionPool::
ThreadRunnable::Run()
{
#ifdef MOZ_ENABLE_PROFILER_SPS
char stackTopGuess;
#endif // MOZ_ENABLE_PROFILER_SPS
MOZ_ASSERT(!IsOnBackgroundThread());
MOZ_ASSERT(mContinueRunning);
@ -13298,18 +13302,6 @@ ThreadRunnable::Run()
mFirstRun = false;
{
// Scope for the thread name. Both PR_SetCurrentThreadName() and
// profiler_register_thread() copy the string so we don't need to keep it.
const nsPrintfCString threadName("IndexedDB #%lu", mSerialNumber);
PR_SetCurrentThreadName(threadName.get());
#ifdef MOZ_ENABLE_PROFILER_SPS
profiler_register_thread(threadName.get(), &stackTopGuess);
#endif // MOZ_ENABLE_PROFILER_SPS
}
{
// Scope for the profiler label.
PROFILER_LABEL("IndexedDB",
@ -13351,10 +13343,6 @@ ThreadRunnable::Run()
}
}
#ifdef MOZ_ENABLE_PROFILER_SPS
profiler_unregister_thread();
#endif // MOZ_ENABLE_PROFILER_SPS
return NS_OK;
}