Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (225777 => 225778)
--- trunk/Source/_javascript_Core/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,18 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ * assembler/testmasm.cpp:
+ (JSC::run):
+ * b3/air/testair.cpp:
+ * b3/testb3.cpp:
+ (JSC::B3::run):
+ * jsc.cpp:
+ (functionDollarAgentStart):
+
2017-12-11 Michael Saboff <[email protected]>
REGRESSION(r225683): Chakra test failure in es6/regex-unicode.js for 32bit builds
Modified: trunk/Source/_javascript_Core/assembler/testmasm.cpp (225777 => 225778)
--- trunk/Source/_javascript_Core/assembler/testmasm.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/_javascript_Core/assembler/testmasm.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -808,7 +808,7 @@
Lock lock;
- Vector<RefPtr<Thread>> threads;
+ Vector<Ref<Thread>> threads;
for (unsigned i = filter ? 1 : WTF::numberOfProcessorCores(); i--;) {
threads.append(
Thread::create(
@@ -828,7 +828,7 @@
}));
}
- for (RefPtr<Thread> thread : threads)
+ for (auto& thread : threads)
thread->waitForCompletion();
crashLock.lock();
dataLog("Completed ", numberOfTests, " tests\n");
Modified: trunk/Source/_javascript_Core/b3/air/testair.cpp (225777 => 225778)
--- trunk/Source/_javascript_Core/b3/air/testair.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/_javascript_Core/b3/air/testair.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -2025,7 +2025,7 @@
Lock lock;
- Vector<RefPtr<Thread>> threads;
+ Vector<Ref<Thread>> threads;
for (unsigned i = filter ? 1 : WTF::numberOfProcessorCores(); i--;) {
threads.append(
Thread::create(
@@ -2045,7 +2045,7 @@
}));
}
- for (RefPtr<Thread> thread : threads)
+ for (auto& thread : threads)
thread->waitForCompletion();
crashLock.lock();
}
Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (225777 => 225778)
--- trunk/Source/_javascript_Core/b3/testb3.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -17794,7 +17794,7 @@
Lock lock;
- Vector<RefPtr<Thread>> threads;
+ Vector<Ref<Thread>> threads;
for (unsigned i = filter ? 1 : WTF::numberOfProcessorCores(); i--;) {
threads.append(
Thread::create(
@@ -17814,7 +17814,7 @@
}));
}
- for (RefPtr<Thread> thread : threads)
+ for (auto& thread : threads)
thread->waitForCompletion();
crashLock.lock();
}
Modified: trunk/Source/_javascript_Core/jsc.cpp (225777 => 225778)
--- trunk/Source/_javascript_Core/jsc.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/_javascript_Core/jsc.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1560,7 +1560,7 @@
Condition didStartCondition;
bool didStart = false;
- RefPtr<Thread> thread = Thread::create(
+ Thread::create(
"JSC Agent",
[sourceCode, &didStartLock, &didStartCondition, &didStart] () {
CommandLine commandLine(0, nullptr);
@@ -1586,8 +1586,7 @@
exit(1);
return success;
});
- });
- thread->detach();
+ })->detach();
{
auto locker = holdLock(didStartLock);
Modified: trunk/Source/WTF/ChangeLog (225777 => 225778)
--- trunk/Source/WTF/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WTF/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,31 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ Many callers of Thread::create assume that it returns non-nullptr Thread.
+ But if the number of threads hits the limit in the system, creating Thread
+ would fail. In that case, it is really difficult to keep WebKit working.
+
+ We introduce Thread::tryCreate, and change the returned value from Thread::create
+ from RefPtr<Thread> to Ref<Thread>. In Thread::create, we ensure thread creation
+ succeeds by RELEASE_ASSERT. And we use Thread::create intentionally if the
+ caller assumes that thread should be created.
+
+ * wtf/AutomaticThread.cpp:
+ (WTF::AutomaticThread::start):
+ * wtf/ParallelJobsGeneric.cpp:
+ (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
+ * wtf/Threading.cpp:
+ (WTF::Thread::tryCreate):
+ (WTF::Thread::create): Deleted.
+ * wtf/Threading.h:
+ (WTF::Thread::create):
+ * wtf/WorkQueue.cpp:
+ (WTF::WorkQueue::concurrentApply):
+
2017-12-11 Eric Carlson <[email protected]>
Web Inspector: Optionally log WebKit log parameters as JSON
Modified: trunk/Source/WTF/wtf/AutomaticThread.cpp (225777 => 225778)
--- trunk/Source/WTF/wtf/AutomaticThread.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WTF/wtf/AutomaticThread.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -161,7 +161,7 @@
m_hasUnderlyingThread = true;
- RefPtr<Thread> thread = Thread::create(
+ Thread::create(
"WTF::AutomaticThread",
[=] () {
if (verbose)
@@ -226,8 +226,7 @@
}
RELEASE_ASSERT(result == WorkResult::Continue);
}
- });
- thread->detach();
+ })->detach();
}
void AutomaticThread::threadDidStart()
Modified: trunk/Source/WTF/wtf/ParallelJobsGeneric.cpp (225777 => 225778)
--- trunk/Source/WTF/wtf/ParallelJobsGeneric.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WTF/wtf/ParallelJobsGeneric.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -94,7 +94,7 @@
}
if (!m_thread) {
- m_thread = Thread::create("Parallel worker", [this] {
+ m_thread = Thread::tryCreate("Parallel worker", [this] {
LockHolder lock(m_mutex);
while (m_thread) {
Modified: trunk/Source/WTF/wtf/Threading.cpp (225777 => 225778)
--- trunk/Source/WTF/wtf/Threading.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WTF/wtf/Threading.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -129,7 +129,7 @@
function();
}
-RefPtr<Thread> Thread::create(const char* name, Function<void()>&& entryPoint)
+RefPtr<Thread> Thread::tryCreate(const char* name, Function<void()>&& entryPoint)
{
WTF::initializeThreading();
Ref<Thread> thread = adoptRef(*new Thread());
Modified: trunk/Source/WTF/wtf/Threading.h (225777 => 225778)
--- trunk/Source/WTF/wtf/Threading.h 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WTF/wtf/Threading.h 2017-12-12 10:35:39 UTC (rev 225778)
@@ -86,7 +86,13 @@
// Returns nullptr if thread creation failed.
// The thread name must be a literal since on some platforms it's passed in to the thread.
- WTF_EXPORT_PRIVATE static RefPtr<Thread> create(const char* threadName, Function<void()>&&);
+ WTF_EXPORT_PRIVATE static RefPtr<Thread> tryCreate(const char* threadName, Function<void()>&&);
+ static inline Ref<Thread> create(const char* threadName, Function<void()>&& function)
+ {
+ auto thread = tryCreate(threadName, WTFMove(function));
+ RELEASE_ASSERT(thread);
+ return thread.releaseNonNull();
+ }
// Returns Thread object.
static Thread& current();
Modified: trunk/Source/WTF/wtf/WorkQueue.cpp (225777 => 225778)
--- trunk/Source/WTF/wtf/WorkQueue.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WTF/wtf/WorkQueue.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -119,7 +119,7 @@
Condition m_condition;
Deque<const WTF::Function<void ()>*> m_queue;
- Vector<RefPtr<Thread>> m_workers;
+ Vector<Ref<Thread>> m_workers;
};
static LazyNeverDestroyed<ThreadPool> threadPool;
Modified: trunk/Source/WebCore/ChangeLog (225777 => 225778)
--- trunk/Source/WebCore/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebCore/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,20 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ No behavior change.
+
+ * bindings/js/GCController.cpp:
+ (WebCore::GCController::garbageCollectOnAlternateThreadForDebugging):
+ * platform/audio/ReverbConvolver.cpp:
+ (WebCore::ReverbConvolver::ReverbConvolver):
+ * platform/audio/ReverbConvolver.h:
+ * workers/WorkerThread.cpp:
+ (WebCore::WorkerThread::start):
+
2017-12-11 Manuel Rego Casasnovas <[email protected]>
[css-grid] Automatic minimum size is not clamped if min track sizing function is auto
Modified: trunk/Source/WebCore/bindings/js/GCController.cpp (225777 => 225778)
--- trunk/Source/WebCore/bindings/js/GCController.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebCore/bindings/js/GCController.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -101,7 +101,7 @@
void GCController::garbageCollectOnAlternateThreadForDebugging(bool waitUntilDone)
{
- RefPtr<Thread> thread = Thread::create("WebCore: GCController", &collect);
+ auto thread = Thread::create("WebCore: GCController", &collect);
if (waitUntilDone) {
thread->waitForCompletion();
Modified: trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp (225777 => 225778)
--- trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -61,9 +61,6 @@
, m_minFFTSize(MinFFTSize) // First stage will have this size - successive stages will double in size each time
, m_maxFFTSize(maxFFTSize) // until we hit m_maxFFTSize
, m_useBackgroundThreads(useBackgroundThreads)
- , m_backgroundThread(0)
- , m_wantsToExit(false)
- , m_moreInputBuffered(false)
{
// If we are using background threads then don't exceed this FFT size for the
// stages which run in the real-time thread. This avoids having only one or two
Modified: trunk/Source/WebCore/platform/audio/ReverbConvolver.h (225777 => 225778)
--- trunk/Source/WebCore/platform/audio/ReverbConvolver.h 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebCore/platform/audio/ReverbConvolver.h 2017-12-12 10:35:39 UTC (rev 225778)
@@ -84,8 +84,8 @@
// Background thread and synchronization
bool m_useBackgroundThreads;
RefPtr<Thread> m_backgroundThread;
- bool m_wantsToExit;
- bool m_moreInputBuffered;
+ bool m_wantsToExit { false };
+ bool m_moreInputBuffered { false };
mutable Lock m_backgroundThreadMutex;
mutable Condition m_backgroundThreadConditionVariable;
};
Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (225777 => 225778)
--- trunk/Source/WebCore/workers/WorkerThread.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -140,7 +140,7 @@
m_evaluateCallback = WTFMove(evaluateCallback);
- m_thread = Thread::create("WebCore: Worker", [this] {
+ m_thread = Thread::tryCreate("WebCore: Worker", [this] {
workerThread();
});
Modified: trunk/Source/WebKit/ChangeLog (225777 => 225778)
--- trunk/Source/WebKit/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKit/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,15 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/API/glib/IconDatabase.cpp:
+ (WebKit::IconDatabase::open):
+ * UIProcess/linux/MemoryPressureMonitor.cpp:
+ (WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
+
2017-12-11 Zan Dobersek <[email protected]>
[CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
Modified: trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp (225777 => 225778)
--- trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -219,7 +219,7 @@
// Lock here as well as first thing in the thread so the thread doesn't actually commence until the createThread() call
// completes and m_syncThreadRunning is properly set
m_syncLock.lock();
- m_syncThread = Thread::create("WebCore: IconDatabase", [this] {
+ m_syncThread = Thread::tryCreate("WebCore: IconDatabase", [this] {
iconDatabaseSyncThread();
});
m_syncThreadRunning = m_syncThread;
Modified: trunk/Source/WebKit/UIProcess/linux/MemoryPressureMonitor.cpp (225777 => 225778)
--- trunk/Source/WebKit/UIProcess/linux/MemoryPressureMonitor.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKit/UIProcess/linux/MemoryPressureMonitor.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -248,7 +248,7 @@
if (m_eventFD == -1)
return;
- RefPtr<Thread> thread = Thread::create("MemoryPressureMonitor", [this] {
+ Thread::create("MemoryPressureMonitor", [this] {
double pollInterval = s_maxPollingIntervalInSeconds;
while (true) {
sleep(pollInterval);
@@ -270,8 +270,7 @@
pollInterval = pollIntervalForUsedMemoryPercentage(usedPercentage);
}
close(m_eventFD);
- });
- thread->detach();
+ })->detach();
}
IPC::Attachment MemoryPressureMonitor::createHandle() const
Modified: trunk/Source/WebKitLegacy/ChangeLog (225777 => 225778)
--- trunk/Source/WebKitLegacy/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKitLegacy/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,13 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ * Storage/StorageThread.cpp:
+ (WebCore::StorageThread::start):
+
2017-12-05 Stephan Szabo <[email protected]>
Switch windows build to Visual Studio 2017
Modified: trunk/Source/WebKitLegacy/Storage/StorageThread.cpp (225777 => 225778)
--- trunk/Source/WebKitLegacy/Storage/StorageThread.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKitLegacy/Storage/StorageThread.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -54,7 +54,7 @@
{
ASSERT(isMainThread());
if (!m_thread) {
- m_thread = Thread::create("WebCore: LocalStorage", [this] {
+ m_thread = Thread::tryCreate("WebCore: LocalStorage", [this] {
threadEntryPoint();
});
}
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (225777 => 225778)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,13 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ * WebKitQuartzCoreAdditions/CVDisplayLink.cpp:
+ (WKQCA::CVDisplayLink::start):
+
2017-12-08 Yusuke Suzuki <[email protected]>
Use StaticLock and Lock instead of Mutex in Windows WebKitLegacy
Modified: trunk/Source/WebKitLegacy/win/WebKitQuartzCoreAdditions/CVDisplayLink.cpp (225777 => 225778)
--- trunk/Source/WebKitLegacy/win/WebKitQuartzCoreAdditions/CVDisplayLink.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Source/WebKitLegacy/win/WebKitQuartzCoreAdditions/CVDisplayLink.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -64,7 +64,6 @@
m_ioThread = Thread::create("WKQCA: CVDisplayLink", [this] {
runIOThread();
});
- ASSERT(m_ioThread);
}
void CVDisplayLink::stop()
Modified: trunk/Tools/ChangeLog (225777 => 225778)
--- trunk/Tools/ChangeLog 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Tools/ChangeLog 2017-12-12 10:35:39 UTC (rev 225778)
@@ -1,3 +1,18 @@
+2017-12-12 Yusuke Suzuki <[email protected]>
+
+ [WTF] Thread::create should have Thread::tryCreate
+ https://bugs.webkit.org/show_bug.cgi?id=180333
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/Tests/WTF/Condition.cpp:
+ * TestWebKitAPI/Tests/WTF/ParkingLot.cpp:
+ * TestWebKitAPI/Tests/WTF/Signals.cpp:
+ (TEST):
+ * TestWebKitAPI/Tests/WTF/ThreadGroup.cpp:
+ (TestWebKitAPI::testThreadGroup):
+ (TestWebKitAPI::TEST):
+
2017-12-11 Basuke Suzuki <[email protected]>
[WinCairo] Enable running sharded tests
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp (225777 => 225778)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Condition.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -89,14 +89,14 @@
Condition emptyCondition;
Condition fullCondition;
- Vector<RefPtr<Thread>> consumerThreads;
- Vector<RefPtr<Thread>> producerThreads;
+ Vector<Ref<Thread>> consumerThreads;
+ Vector<Ref<Thread>> producerThreads;
Vector<unsigned> received;
Lock receivedLock;
for (unsigned i = numConsumers; i--;) {
- RefPtr<Thread> threadIdentifier = Thread::create(
+ consumerThreads.append(Thread::create(
"Consumer thread",
[&] () {
for (;;) {
@@ -124,14 +124,13 @@
received.append(result);
}
}
- });
- consumerThreads.append(threadIdentifier);
+ }));
}
sleep(delay);
for (unsigned i = numProducers; i--;) {
- RefPtr<Thread> threadIdentifier = Thread::create(
+ producerThreads.append(Thread::create(
"Producer Thread",
[&] () {
for (unsigned i = 0; i < numMessagesPerProducer; ++i) {
@@ -151,12 +150,11 @@
}
notify(notifyStyle, emptyCondition, shouldNotify);
}
- });
- producerThreads.append(threadIdentifier);
+ }));
}
- for (RefPtr<Thread> threadIdentifier : producerThreads)
- threadIdentifier->waitForCompletion();
+ for (auto& thread : producerThreads)
+ thread->waitForCompletion();
{
std::lock_guard<Lock> locker(lock);
@@ -164,8 +162,8 @@
}
emptyCondition.notifyAll();
- for (RefPtr<Thread> threadIdentifier : consumerThreads)
- threadIdentifier->waitForCompletion();
+ for (auto& thread : consumerThreads)
+ thread->waitForCompletion();
EXPECT_EQ(numProducers * numMessagesPerProducer, received.size());
std::sort(received.begin(), received.end());
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp (225777 => 225778)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -127,8 +127,8 @@
condition.wait(locker);
}
- for (RefPtr<Thread> threadIdentifier : threads)
- threadIdentifier->waitForCompletion();
+ for (auto& thread : threads)
+ thread->waitForCompletion();
}
// Semaphore operations.
@@ -178,7 +178,7 @@
std::mutex lock;
std::condition_variable condition;
HashSet<Ref<Thread>> awake;
- Vector<RefPtr<Thread>> threads;
+ Vector<Ref<Thread>> threads;
RefPtr<Thread> lastAwoken;
};
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Signals.cpp (225777 => 225778)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Signals.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Signals.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -47,19 +47,18 @@
});
Atomic<bool> receiverShouldKeepRunning(true);
- RefPtr<Thread> receiverThread = (Thread::create("ThreadMessage receiver",
+ Ref<Thread> receiverThread = (Thread::create("ThreadMessage receiver",
[&receiverShouldKeepRunning] () {
while (receiverShouldKeepRunning.load()) { }
}));
- ASSERT_TRUE(receiverThread);
bool signalFired;
{
- std::unique_lock<std::mutex> locker(static_cast<ReflectedThread*>(receiverThread.get())->m_mutex);
+ std::unique_lock<std::mutex> locker(static_cast<ReflectedThread&>(receiverThread.get()).m_mutex);
receiverShouldKeepRunning.store(false);
- EXPECT_FALSE(static_cast<ReflectedThread*>(receiverThread.get())->hasExited());
+ EXPECT_FALSE(static_cast<ReflectedThread&>(receiverThread.get()).hasExited());
sleep(1);
- signalFired = !pthread_kill(static_cast<ReflectedThread*>(receiverThread.get())->m_handle, std::get<0>(toSystemSignal(Signal::Usr)));
+ signalFired = !pthread_kill(static_cast<ReflectedThread&>(receiverThread.get()).m_handle, std::get<0>(toSystemSignal(Signal::Usr)));
}
receiverThread->waitForCompletion();
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadGroup.cpp (225777 => 225778)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadGroup.cpp 2017-12-12 07:20:37 UTC (rev 225777)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadGroup.cpp 2017-12-12 10:35:39 UTC (rev 225778)
@@ -41,12 +41,12 @@
Lock lock;
Condition condition;
Condition restartCondition;
- Vector<RefPtr<Thread>> threads;
+ Vector<Ref<Thread>> threads;
{
auto locker = holdLock(lock);
for (unsigned i = 0; i < numberOfThreads; ++i) {
- RefPtr<Thread> thread = Thread::create("ThreadGroupWorker", [&] {
+ Ref<Thread> thread = Thread::create("ThreadGroupWorker", [&] {
auto locker = holdLock(lock);
if (mode == Mode::AddCurrentThread)
threadGroup->addCurrentThread();
@@ -57,8 +57,8 @@
});
});
if (mode == Mode::Add)
- EXPECT_TRUE(threadGroup->add(*thread) == ThreadGroupAddResult::NewlyAdded);
- threads.append(thread);
+ EXPECT_TRUE(threadGroup->add(thread.get()) == ThreadGroupAddResult::NewlyAdded);
+ threads.append(WTFMove(thread));
}
condition.wait(lock, [&] {
@@ -102,9 +102,9 @@
TEST(WTF, ThreadGroupDoNotAddDeadThread)
{
std::shared_ptr<ThreadGroup> threadGroup = ThreadGroup::create();
- RefPtr<Thread> thread = Thread::create("ThreadGroupWorker", [&] { });
+ Ref<Thread> thread = Thread::create("ThreadGroupWorker", [&] { });
thread->waitForCompletion();
- EXPECT_TRUE(threadGroup->add(*thread) == ThreadGroupAddResult::NotAdded);
+ EXPECT_TRUE(threadGroup->add(thread.get()) == ThreadGroupAddResult::NotAdded);
auto threadGroupLocker = holdLock(threadGroup->getLock());
EXPECT_EQ(threadGroup->threads(threadGroupLocker).size(), 0u);
@@ -116,14 +116,14 @@
Lock lock;
Condition restartCondition;
std::shared_ptr<ThreadGroup> threadGroup = ThreadGroup::create();
- RefPtr<Thread> thread = Thread::create("ThreadGroupWorker", [&] {
+ Ref<Thread> thread = Thread::create("ThreadGroupWorker", [&] {
auto locker = holdLock(lock);
restartCondition.wait(lock, [&] {
return restarting;
});
});
- EXPECT_TRUE(threadGroup->add(*thread) == ThreadGroupAddResult::NewlyAdded);
- EXPECT_TRUE(threadGroup->add(*thread) == ThreadGroupAddResult::AlreadyAdded);
+ EXPECT_TRUE(threadGroup->add(thread.get()) == ThreadGroupAddResult::NewlyAdded);
+ EXPECT_TRUE(threadGroup->add(thread.get()) == ThreadGroupAddResult::AlreadyAdded);
{
auto threadGroupLocker = holdLock(threadGroup->getLock());