Diff
Modified: trunk/Source/WTF/ChangeLog (225997 => 225998)
--- trunk/Source/WTF/ChangeLog 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WTF/ChangeLog 2017-12-16 17:54:39 UTC (rev 225998)
@@ -1,3 +1,19 @@
+2017-12-16 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove unnecessary boolean result of start() functions
+ https://bugs.webkit.org/show_bug.cgi?id=180856
+
+ Reviewed by Darin Adler.
+
+ CrossThreadTaskHandler's Thread is just released without calling
+ either `waitForCompletion` or `detach`. It means that this resource
+ of the thread is not released.
+
+ * benchmarks/ConditionSpeedTest.cpp:
+ * wtf/CrossThreadTaskHandler.cpp:
+ (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
+ * wtf/CrossThreadTaskHandler.h:
+
2017-12-14 David Kilzer <ddkil...@apple.com>
Enable -Wstrict-prototypes for WebKit
Modified: trunk/Source/WTF/benchmarks/ConditionSpeedTest.cpp (225997 => 225998)
--- trunk/Source/WTF/benchmarks/ConditionSpeedTest.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WTF/benchmarks/ConditionSpeedTest.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -89,14 +89,14 @@
ConditionType emptyCondition;
ConditionType fullCondition;
- Vector<RefPtr<Thread>> consumerThreads;
- Vector<RefPtr<Thread>> producerThreads;
+ Vector<Ref<Thread>> consumerThreads;
+ Vector<Ref<Thread>> producerThreads;
Vector<unsigned> received;
LockType receivedLock;
for (unsigned i = numConsumers; i--;) {
- RefPtr<Thread> thread = Thread::create(
+ consumerThreads.append(Thread::create(
"Consumer thread",
[&] () {
for (;;) {
@@ -123,12 +123,11 @@
received.append(result);
}
}
- });
- consumerThreads.append(thread);
+ }));
}
for (unsigned i = numProducers; i--;) {
- RefPtr<Thread> thread = Thread::create(
+ producerThreads.append(Thread::create(
"Producer Thread",
[&] () {
for (unsigned i = 0; i < numMessagesPerProducer; ++i) {
@@ -147,11 +146,10 @@
}
notify(emptyCondition, mustNotify);
}
- });
- producerThreads.append(thread);
+ }));
}
- for (RefPtr<Thread>& thread : producerThreads)
+ for (auto& thread : producerThreads)
thread->waitForCompletion();
{
@@ -160,8 +158,8 @@
}
notifyAll(emptyCondition);
- for (auto& threadIdentifier : consumerThreads)
- threadIdentifier->waitForCompletion();
+ for (auto& thread : consumerThreads)
+ thread->waitForCompletion();
RELEASE_ASSERT(numProducers * numMessagesPerProducer == received.size());
std::sort(received.begin(), received.end());
Modified: trunk/Source/WTF/wtf/CrossThreadTaskHandler.cpp (225997 => 225998)
--- trunk/Source/WTF/wtf/CrossThreadTaskHandler.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WTF/wtf/CrossThreadTaskHandler.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -32,9 +32,9 @@
{
ASSERT(isMainThread());
Locker<Lock> locker(m_taskThreadCreationLock);
- m_thread = Thread::create(threadName, [this] {
+ Thread::create(threadName, [this] {
taskRunLoop();
- });
+ })->detach();
}
CrossThreadTaskHandler::~CrossThreadTaskHandler()
Modified: trunk/Source/WTF/wtf/CrossThreadTaskHandler.h (225997 => 225998)
--- trunk/Source/WTF/wtf/CrossThreadTaskHandler.h 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WTF/wtf/CrossThreadTaskHandler.h 2017-12-16 17:54:39 UTC (rev 225998)
@@ -49,7 +49,6 @@
void handleTaskRepliesOnMainThread();
void taskRunLoop();
- RefPtr<Thread> m_thread { nullptr };
Lock m_taskThreadCreationLock;
Lock m_mainThreadReplyLock;
bool m_mainThreadReplyScheduled { false };
Modified: trunk/Source/WebCore/ChangeLog (225997 => 225998)
--- trunk/Source/WebCore/ChangeLog 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/ChangeLog 2017-12-16 17:54:39 UTC (rev 225998)
@@ -1,3 +1,32 @@
+2017-12-16 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove unnecessary boolean result of start() functions
+ https://bugs.webkit.org/show_bug.cgi?id=180856
+
+ Reviewed by Darin Adler.
+
+ No behavior change.
+
+ * Modules/webaudio/AsyncAudioDecoder.cpp:
+ (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
+ * Modules/webdatabase/DatabaseContext.cpp:
+ (WebCore::DatabaseContext::databaseThread):
+ * Modules/webdatabase/DatabaseThread.cpp:
+ (WebCore::DatabaseThread::start):
+ Now `Thread::create` always succeeds (if it fails, WebKit crashes).
+ DatabaseThread::start() now always returns true. So, we do not need
+ to return bool.
+
+ * Modules/webdatabase/DatabaseThread.h:
+ * platform/network/curl/CurlDownload.cpp:
+ (WebCore::CurlDownload::start):
+ * platform/network/curl/CurlDownload.h:
+ * platform/network/curl/ResourceHandleCurl.cpp:
+ (WebCore::ResourceHandle::start):
+ * platform/network/curl/ResourceHandleCurlDelegate.cpp:
+ (WebCore::ResourceHandleCurlDelegate::start):
+ * platform/network/curl/ResourceHandleCurlDelegate.h:
+
2017-12-16 Chris Dumez <cdu...@apple.com>
Add optimization when updating a SW registration results in the exact same script
Modified: trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp (225997 => 225998)
--- trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -50,7 +50,6 @@
// Stop thread.
m_thread->waitForCompletion();
- m_thread = nullptr;
}
void AsyncAudioDecoder::decodeAsync(Ref<ArrayBuffer>&& audioData, float sampleRate, RefPtr<AudioBufferCallback>&& successCallback, RefPtr<AudioBufferCallback>&& errorCallback)
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp (225997 => 225998)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -150,8 +150,7 @@
// Create the database thread on first request - but not if at least one database was already opened,
// because in that case we already had a database thread and terminated it and should not create another.
m_databaseThread = DatabaseThread::create();
- if (!m_databaseThread->start())
- m_databaseThread = nullptr;
+ m_databaseThread->start();
}
return m_databaseThread.get();
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp (225997 => 225998)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -56,18 +56,16 @@
ASSERT(terminationRequested());
}
-bool DatabaseThread::start()
+void DatabaseThread::start()
{
LockHolder lock(m_threadCreationMutex);
if (m_thread)
- return true;
+ return;
m_thread = Thread::create("WebCore: Database", [this] {
databaseThread();
});
-
- return m_thread;
}
void DatabaseThread::requestTermination(DatabaseTaskSynchronizer* cleanupSync)
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h (225997 => 225998)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h 2017-12-16 17:54:39 UTC (rev 225998)
@@ -47,7 +47,7 @@
static Ref<DatabaseThread> create() { return adoptRef(*new DatabaseThread); }
~DatabaseThread();
- bool start();
+ void start();
void requestTermination(DatabaseTaskSynchronizer* cleanupSync);
bool terminationRequested(DatabaseTaskSynchronizer* = nullptr) const;
Modified: trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp (225997 => 225998)
--- trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -55,7 +55,7 @@
m_request = request.isolatedCopy();
}
-bool CurlDownload::start()
+void CurlDownload::start()
{
ASSERT(isMainThread());
@@ -62,8 +62,6 @@
m_curlRequest = createCurlRequest(m_request);
m_curlRequest->enableDownloadToFile();
m_curlRequest->start();
-
- return true;
}
bool CurlDownload::cancel()
Modified: trunk/Source/WebCore/platform/network/curl/CurlDownload.h (225997 => 225998)
--- trunk/Source/WebCore/platform/network/curl/CurlDownload.h 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/platform/network/curl/CurlDownload.h 2017-12-16 17:54:39 UTC (rev 225998)
@@ -57,7 +57,7 @@
void setListener(CurlDownloadListener* listener) { m_listener = listener; }
- bool start();
+ void start();
bool cancel();
bool deletesFileUponFailure() const { return m_deletesFileUponFailure; }
Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (225997 => 225998)
--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -71,7 +71,8 @@
}
d->m_delegate = adoptRef(new ResourceHandleCurlDelegate(this));
- return d->m_delegate->start();
+ d->m_delegate->start();
+ return true;
}
void ResourceHandle::cancel()
Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp (225997 => 225998)
--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -75,7 +75,7 @@
m_handle = nullptr;
}
-bool ResourceHandleCurlDelegate::start()
+void ResourceHandleCurlDelegate::start()
{
ASSERT(isMainThread());
@@ -84,8 +84,6 @@
m_curlRequest = createCurlRequest(m_currentRequest);
m_curlRequest->setUserPass(credential.first, credential.second);
m_curlRequest->start();
-
- return true;
}
void ResourceHandleCurlDelegate::cancel()
Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.h (225997 => 225998)
--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.h 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.h 2017-12-16 17:54:39 UTC (rev 225998)
@@ -47,7 +47,7 @@
bool hasHandle() const;
void releaseHandle();
- bool start();
+ void start();
void cancel();
void setDefersLoading(bool);
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (225997 => 225998)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2017-12-16 17:54:39 UTC (rev 225998)
@@ -1,3 +1,15 @@
+2017-12-16 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove unnecessary boolean result of start() functions
+ https://bugs.webkit.org/show_bug.cgi?id=180856
+
+ Reviewed by Darin Adler.
+
+ It always returns true.
+
+ * WebDownloadCurl.cpp:
+ (WebDownload::start):
+
2017-12-14 John Wilander <wilan...@apple.com>
Storage Access API: Implement frame-specific access in the document.cookie layer
Modified: trunk/Source/WebKitLegacy/win/WebDownloadCurl.cpp (225997 => 225998)
--- trunk/Source/WebKitLegacy/win/WebDownloadCurl.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Source/WebKitLegacy/win/WebDownloadCurl.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -120,8 +120,7 @@
if (!m_download)
return E_FAIL;
- if (!m_download->start())
- return E_FAIL;
+ m_download->start();
if (m_delegate)
m_delegate->didBegin(this);
Modified: trunk/Tools/ChangeLog (225997 => 225998)
--- trunk/Tools/ChangeLog 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Tools/ChangeLog 2017-12-16 17:54:39 UTC (rev 225998)
@@ -1,3 +1,12 @@
+2017-12-16 Yusuke Suzuki <utatane....@gmail.com>
+
+ Remove unnecessary boolean result of start() functions
+ https://bugs.webkit.org/show_bug.cgi?id=180856
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/Tests/WTF/ParkingLot.cpp:
+
2017-12-15 David Quesada <david_ques...@apple.com>
Unreviewed, adding myself to contributors.json
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp (225997 => 225998)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp 2017-12-16 16:37:11 UTC (rev 225997)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp 2017-12-16 17:54:39 UTC (rev 225998)
@@ -68,11 +68,11 @@
unsigned numWaitingOnAddress = 0;
Vector<RefPtr<Thread>, 8> queue;
ParkingLot::forEach(
- [&] (Thread& threadIdentifier, const void* address) {
+ [&] (Thread& thread, const void* address) {
if (address != &semaphore)
return;
- queue.append(&threadIdentifier);
+ queue.append(&thread);
numWaitingOnAddress++;
});