зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
006e5cca66
Коммит
e40c296db4
|
@ -78,7 +78,8 @@ static int RunDecodeToSurfaceFuzzing(nsCOMPtr<nsIInputStream> inputStream,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIThread> thread;
|
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));
|
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
|
||||||
|
|
||||||
// We run the DecodeToSurface tests off-main-thread to ensure that
|
// We run the DecodeToSurface tests off-main-thread to ensure that
|
||||||
|
|
|
@ -83,7 +83,8 @@ already_AddRefed<nsIThread> CreateTestThread(const char* aName,
|
||||||
aMonitor.NotifyAll();
|
aMonitor.NotifyAll();
|
||||||
});
|
});
|
||||||
nsCOMPtr<nsIThread> thread;
|
nsCOMPtr<nsIThread> thread;
|
||||||
mozilla::Unused << NS_NewThread(getter_AddRefs(thread), setNameRunnable);
|
mozilla::Unused << NS_NewNamedThread("Test Thread", getter_AddRefs(thread),
|
||||||
|
setNameRunnable);
|
||||||
|
|
||||||
return thread.forget();
|
return thread.forget();
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,8 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_SetNameTwice)
|
||||||
monitor.NotifyAll();
|
monitor.NotifyAll();
|
||||||
});
|
});
|
||||||
nsCOMPtr<nsIThread> thread;
|
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));
|
ASSERT_TRUE(NS_SUCCEEDED(rv));
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,8 @@ TEST(Atoms, ConcurrentAccessing)
|
||||||
EXPECT_EQ(NS_GetUnusedAtomCount(), int32_t(0));
|
EXPECT_EQ(NS_GetUnusedAtomCount(), int32_t(0));
|
||||||
nsCOMPtr<nsIThread> threads[kThreadCount];
|
nsCOMPtr<nsIThread> threads[kThreadCount];
|
||||||
for (size_t i = 0; i < kThreadCount; i++) {
|
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));
|
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < kThreadCount; i++) {
|
for (size_t i = 0; i < kThreadCount; i++) {
|
||||||
|
|
|
@ -52,8 +52,9 @@ TEST(AutoRefCnt, ThreadSafeAutoRefCntBalance)
|
||||||
static const size_t kThreadCount = 4;
|
static const size_t kThreadCount = 4;
|
||||||
nsCOMPtr<nsIThread> threads[kThreadCount];
|
nsCOMPtr<nsIThread> threads[kThreadCount];
|
||||||
for (size_t i = 0; i < kThreadCount; i++) {
|
for (size_t i = 0; i < kThreadCount; i++) {
|
||||||
nsresult rv = NS_NewThread(getter_AddRefs(threads[i]),
|
nsresult rv =
|
||||||
new nsThreadSafeAutoRefCntRunner);
|
NS_NewNamedThread("AutoRefCnt Test", getter_AddRefs(threads[i]),
|
||||||
|
new nsThreadSafeAutoRefCntRunner);
|
||||||
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < kThreadCount; i++) {
|
for (size_t i = 0; i < kThreadCount; i++) {
|
||||||
|
|
|
@ -164,11 +164,6 @@ nsresult NS_NewNamedThread(const nsACString& aName, nsIThread** aResult,
|
||||||
return NS_OK;
|
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) {
|
nsresult NS_GetCurrentThread(nsIThread** aResult) {
|
||||||
#ifdef MOZILLA_INTERNAL_API
|
#ifdef MOZILLA_INTERNAL_API
|
||||||
return nsThreadManager::get().nsThreadManager::GetCurrentThread(aResult);
|
return nsThreadManager::get().nsThreadManager::GetCurrentThread(aResult);
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
/**
|
/**
|
||||||
* Create a new thread, and optionally provide an initial event for the thread.
|
* Create a new thread, and optionally provide an initial event for the thread.
|
||||||
*
|
*
|
||||||
|
* @param aName
|
||||||
|
* The name of the thread.
|
||||||
* @param aResult
|
* @param aResult
|
||||||
* The resulting nsIThread object.
|
* The resulting nsIThread object.
|
||||||
* @param aInitialEvent
|
* @param aInitialEvent
|
||||||
|
@ -48,13 +50,7 @@
|
||||||
* @returns NS_ERROR_INVALID_ARG
|
* @returns NS_ERROR_INVALID_ARG
|
||||||
* Indicates that the given name is not unique.
|
* 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(
|
extern nsresult NS_NewNamedThread(
|
||||||
const nsACString& aName, nsIThread** aResult,
|
const nsACString& aName, nsIThread** aResult,
|
||||||
nsIRunnable* aInitialEvent = nullptr,
|
nsIRunnable* aInitialEvent = nullptr,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче