Bug 1539944 - Get rid of NS_NewThread r=froydnj

Gets rid of `NS_NewThread`. Where it was used in testing, I gave the new named threads names relevant to their tests.

Differential Revision: https://phabricator.services.mozilla.com/D62475

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2020-02-11 21:01:56 +00:00
Родитель 006e5cca66
Коммит e40c296db4
6 изменённых файлов: 13 добавлений и 17 удалений

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

@ -78,7 +78,8 @@ static int RunDecodeToSurfaceFuzzing(nsCOMPtr<nsIInputStream> inputStream,
}
nsCOMPtr<nsIThread> thread;
nsresult rv = NS_NewThread(getter_AddRefs(thread), nullptr);
nsresult rv =
NS_NewNamedThread("Decoder Test", getter_AddRefs(thread), nullptr);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
// We run the DecodeToSurface tests off-main-thread to ensure that

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

@ -83,7 +83,8 @@ already_AddRefed<nsIThread> CreateTestThread(const char* aName,
aMonitor.NotifyAll();
});
nsCOMPtr<nsIThread> thread;
mozilla::Unused << NS_NewThread(getter_AddRefs(thread), setNameRunnable);
mozilla::Unused << NS_NewNamedThread("Test Thread", getter_AddRefs(thread),
setNameRunnable);
return thread.forget();
}
@ -136,7 +137,8 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_SetNameTwice)
monitor.NotifyAll();
});
nsCOMPtr<nsIThread> thread;
nsresult rv = NS_NewThread(getter_AddRefs(thread), setNameRunnable);
nsresult rv =
NS_NewNamedThread("Test Thread", getter_AddRefs(thread), setNameRunnable);
ASSERT_TRUE(NS_SUCCEEDED(rv));
{

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

@ -165,7 +165,8 @@ TEST(Atoms, ConcurrentAccessing)
EXPECT_EQ(NS_GetUnusedAtomCount(), int32_t(0));
nsCOMPtr<nsIThread> threads[kThreadCount];
for (size_t i = 0; i < kThreadCount; i++) {
nsresult rv = NS_NewThread(getter_AddRefs(threads[i]), new nsAtomRunner);
nsresult rv = NS_NewNamedThread("Atom Test", getter_AddRefs(threads[i]),
new nsAtomRunner);
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
for (size_t i = 0; i < kThreadCount; i++) {

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

@ -52,8 +52,9 @@ TEST(AutoRefCnt, ThreadSafeAutoRefCntBalance)
static const size_t kThreadCount = 4;
nsCOMPtr<nsIThread> threads[kThreadCount];
for (size_t i = 0; i < kThreadCount; i++) {
nsresult rv = NS_NewThread(getter_AddRefs(threads[i]),
new nsThreadSafeAutoRefCntRunner);
nsresult rv =
NS_NewNamedThread("AutoRefCnt Test", getter_AddRefs(threads[i]),
new nsThreadSafeAutoRefCntRunner);
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
for (size_t i = 0; i < kThreadCount; i++) {

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

@ -164,11 +164,6 @@ nsresult NS_NewNamedThread(const nsACString& aName, nsIThread** aResult,
return NS_OK;
}
nsresult NS_NewThread(nsIThread** aResult, nsIRunnable* aEvent,
uint32_t aStackSize) {
return NS_NewNamedThread(NS_LITERAL_CSTRING(""), aResult, aEvent, aStackSize);
}
nsresult NS_GetCurrentThread(nsIThread** aResult) {
#ifdef MOZILLA_INTERNAL_API
return nsThreadManager::get().nsThreadManager::GetCurrentThread(aResult);

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

@ -38,6 +38,8 @@
/**
* Create a new thread, and optionally provide an initial event for the thread.
*
* @param aName
* The name of the thread.
* @param aResult
* The resulting nsIThread object.
* @param aInitialEvent
@ -48,13 +50,7 @@
* @returns NS_ERROR_INVALID_ARG
* Indicates that the given name is not unique.
*/
extern nsresult NS_NewThread(
nsIThread** aResult, nsIRunnable* aInitialEvent = nullptr,
uint32_t aStackSize = nsIThreadManager::DEFAULT_STACK_SIZE);
/**
* Creates a named thread, otherwise the same as NS_NewThread
*/
extern nsresult NS_NewNamedThread(
const nsACString& aName, nsIThread** aResult,
nsIRunnable* aInitialEvent = nullptr,