Skip to content
Permalink
Browse files
WTF shouldn't have both Thread and ThreadIdentifier
https://bugs.webkit.org/show_bug.cgi?id=180308

Reviewed by Darin Adler.

Source/JavaScriptCore:

* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::tryCopyOtherThreadStacks):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::traceFunctionPrologue):
* runtime/ExceptionScope.cpp:
(JSC::ExceptionScope::unexpectedExceptionMessage):
* runtime/JSLock.h:
(JSC::JSLock::currentThreadIsHoldingLock):
* runtime/VM.cpp:
(JSC::VM::throwException):
* runtime/VM.h:
(JSC::VM::throwingThread const):
(JSC::VM::clearException):
* tools/HeapVerifier.cpp:
(JSC::HeapVerifier::printVerificationHeader):

Source/WebCore:

No behavior change.

* Modules/indexeddb/IDBActiveDOMObject.h:
(WebCore::IDBActiveDOMObject::originThread const):
(WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
(WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
(WebCore::IDBActiveDOMObject::originThreadID const): Deleted.
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::IDBCursor):
(WebCore::IDBCursor::~IDBCursor):
(WebCore::IDBCursor::sourcesDeleted const):
(WebCore::IDBCursor::transaction const):
(WebCore::IDBCursor::update):
(WebCore::IDBCursor::advance):
(WebCore::IDBCursor::continueFunction):
(WebCore::IDBCursor::uncheckedIterateCursor):
(WebCore::IDBCursor::deleteFunction):
(WebCore::IDBCursor::setGetResult):
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::~IDBDatabase):
(WebCore::IDBDatabase::hasPendingActivity const):
(WebCore::IDBDatabase::name const):
(WebCore::IDBDatabase::version const):
(WebCore::IDBDatabase::objectStoreNames const):
(WebCore::IDBDatabase::renameObjectStore):
(WebCore::IDBDatabase::renameIndex):
(WebCore::IDBDatabase::createObjectStore):
(WebCore::IDBDatabase::transaction):
(WebCore::IDBDatabase::deleteObjectStore):
(WebCore::IDBDatabase::close):
(WebCore::IDBDatabase::connectionToServerLost):
(WebCore::IDBDatabase::maybeCloseInServer):
(WebCore::IDBDatabase::activeDOMObjectName const):
(WebCore::IDBDatabase::canSuspendForDocumentSuspension const):
(WebCore::IDBDatabase::stop):
(WebCore::IDBDatabase::startVersionChangeTransaction):
(WebCore::IDBDatabase::didStartTransaction):
(WebCore::IDBDatabase::willCommitTransaction):
(WebCore::IDBDatabase::didCommitTransaction):
(WebCore::IDBDatabase::willAbortTransaction):
(WebCore::IDBDatabase::didAbortTransaction):
(WebCore::IDBDatabase::didCommitOrAbortTransaction):
(WebCore::IDBDatabase::fireVersionChangeEvent):
(WebCore::IDBDatabase::dispatchEvent):
(WebCore::IDBDatabase::didCreateIndexInfo):
(WebCore::IDBDatabase::didDeleteIndexInfo):
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::IDBIndex):
(WebCore::IDBIndex::~IDBIndex):
(WebCore::IDBIndex::name const):
(WebCore::IDBIndex::setName):
(WebCore::IDBIndex::objectStore):
(WebCore::IDBIndex::keyPath const):
(WebCore::IDBIndex::unique const):
(WebCore::IDBIndex::multiEntry const):
(WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
(WebCore::IDBIndex::doCount):
(WebCore::IDBIndex::doGet):
(WebCore::IDBIndex::doGetKey):
(WebCore::IDBIndex::getAll):
(WebCore::IDBIndex::getAllKeys):
(WebCore::IDBIndex::markAsDeleted):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::IDBObjectStore):
(WebCore::IDBObjectStore::~IDBObjectStore):
(WebCore::IDBObjectStore::name const):
(WebCore::IDBObjectStore::setName):
(WebCore::IDBObjectStore::keyPath const):
(WebCore::IDBObjectStore::indexNames const):
(WebCore::IDBObjectStore::transaction):
(WebCore::IDBObjectStore::autoIncrement const):
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::openKeyCursor):
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::getKey):
(WebCore::IDBObjectStore::putOrAdd):
(WebCore::IDBObjectStore::doDelete):
(WebCore::IDBObjectStore::clear):
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::index):
(WebCore::IDBObjectStore::deleteIndex):
(WebCore::IDBObjectStore::doCount):
(WebCore::IDBObjectStore::getAll):
(WebCore::IDBObjectStore::getAllKeys):
(WebCore::IDBObjectStore::markAsDeleted):
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
(WebCore::IDBOpenDBRequest::onError):
(WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
(WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
(WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
(WebCore::IDBOpenDBRequest::dispatchEvent):
(WebCore::IDBOpenDBRequest::onSuccess):
(WebCore::IDBOpenDBRequest::onUpgradeNeeded):
(WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
(WebCore::IDBOpenDBRequest::requestCompleted):
(WebCore::IDBOpenDBRequest::requestBlocked):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::~IDBRequest):
(WebCore:: const):
(WebCore::IDBRequest::setSource):
(WebCore::IDBRequest::setVersionChangeTransaction):
(WebCore::IDBRequest::transaction const):
(WebCore::IDBRequest::sourceObjectStoreIdentifier const):
(WebCore::IDBRequest::sourceIndexIdentifier const):
(WebCore::IDBRequest::requestedObjectStoreRecordType const):
(WebCore::IDBRequest::requestedIndexRecordType const):
(WebCore::IDBRequest::eventTargetInterface const):
(WebCore::IDBRequest::activeDOMObjectName const):
(WebCore::IDBRequest::canSuspendForDocumentSuspension const):
(WebCore::IDBRequest::hasPendingActivity const):
(WebCore::IDBRequest::stop):
(WebCore::IDBRequest::enqueueEvent):
(WebCore::IDBRequest::dispatchEvent):
(WebCore::IDBRequest::uncaughtExceptionInEventHandler):
(WebCore::IDBRequest::setResult):
(WebCore::IDBRequest::setResultToStructuredClone):
(WebCore::IDBRequest::setResultToUndefined):
(WebCore::IDBRequest::resultCursor):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::didOpenOrIterateCursor):
(WebCore::IDBRequest::completeRequestAndDispatchEvent):
(WebCore::IDBRequest::onError):
(WebCore::IDBRequest::onSuccess):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::IDBTransaction):
(WebCore::IDBTransaction::~IDBTransaction):
(WebCore::IDBTransaction::objectStoreNames const):
(WebCore::IDBTransaction::db):
(WebCore::IDBTransaction::error const):
(WebCore::IDBTransaction::objectStore):
(WebCore::IDBTransaction::abortDueToFailedRequest):
(WebCore::IDBTransaction::transitionedToFinishing):
(WebCore::IDBTransaction::abort):
(WebCore::IDBTransaction::internalAbort):
(WebCore::IDBTransaction::abortOnServerAndCancelRequests):
(WebCore::IDBTransaction::activeDOMObjectName const):
(WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
(WebCore::IDBTransaction::hasPendingActivity const):
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::isActive const):
(WebCore::IDBTransaction::isFinishedOrFinishing const):
(WebCore::IDBTransaction::addRequest):
(WebCore::IDBTransaction::removeRequest):
(WebCore::IDBTransaction::scheduleOperation):
(WebCore::IDBTransaction::schedulePendingOperationTimer):
(WebCore::IDBTransaction::pendingOperationTimerFired):
(WebCore::IDBTransaction::operationCompletedOnServer):
(WebCore::IDBTransaction::scheduleCompletedOperationTimer):
(WebCore::IDBTransaction::completedOperationTimerFired):
(WebCore::IDBTransaction::commit):
(WebCore::IDBTransaction::commitOnServer):
(WebCore::IDBTransaction::finishAbortOrCommit):
(WebCore::IDBTransaction::didStart):
(WebCore::IDBTransaction::notifyDidAbort):
(WebCore::IDBTransaction::didAbort):
(WebCore::IDBTransaction::didCommit):
(WebCore::IDBTransaction::fireOnComplete):
(WebCore::IDBTransaction::fireOnAbort):
(WebCore::IDBTransaction::enqueueEvent):
(WebCore::IDBTransaction::dispatchEvent):
(WebCore::IDBTransaction::createObjectStore):
(WebCore::IDBTransaction::createObjectStoreOnServer):
(WebCore::IDBTransaction::didCreateObjectStoreOnServer):
(WebCore::IDBTransaction::renameObjectStore):
(WebCore::IDBTransaction::renameObjectStoreOnServer):
(WebCore::IDBTransaction::didRenameObjectStoreOnServer):
(WebCore::IDBTransaction::createIndex):
(WebCore::IDBTransaction::createIndexOnServer):
(WebCore::IDBTransaction::didCreateIndexOnServer):
(WebCore::IDBTransaction::renameIndex):
(WebCore::IDBTransaction::renameIndexOnServer):
(WebCore::IDBTransaction::didRenameIndexOnServer):
(WebCore::IDBTransaction::requestOpenCursor):
(WebCore::IDBTransaction::doRequestOpenCursor):
(WebCore::IDBTransaction::openCursorOnServer):
(WebCore::IDBTransaction::didOpenCursorOnServer):
(WebCore::IDBTransaction::iterateCursor):
(WebCore::IDBTransaction::iterateCursorOnServer):
(WebCore::IDBTransaction::didIterateCursorOnServer):
(WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
(WebCore::IDBTransaction::requestGetAllIndexRecords):
(WebCore::IDBTransaction::getAllRecordsOnServer):
(WebCore::IDBTransaction::didGetAllRecordsOnServer):
(WebCore::IDBTransaction::requestGetRecord):
(WebCore::IDBTransaction::requestGetValue):
(WebCore::IDBTransaction::requestGetKey):
(WebCore::IDBTransaction::requestIndexRecord):
(WebCore::IDBTransaction::getRecordOnServer):
(WebCore::IDBTransaction::didGetRecordOnServer):
(WebCore::IDBTransaction::requestCount):
(WebCore::IDBTransaction::getCountOnServer):
(WebCore::IDBTransaction::didGetCountOnServer):
(WebCore::IDBTransaction::requestDeleteRecord):
(WebCore::IDBTransaction::deleteRecordOnServer):
(WebCore::IDBTransaction::didDeleteRecordOnServer):
(WebCore::IDBTransaction::requestClearObjectStore):
(WebCore::IDBTransaction::clearObjectStoreOnServer):
(WebCore::IDBTransaction::didClearObjectStoreOnServer):
(WebCore::IDBTransaction::requestPutOrAdd):
(WebCore::IDBTransaction::putOrAddOnServer):
(WebCore::IDBTransaction::didPutOrAddOnServer):
(WebCore::IDBTransaction::deleteObjectStore):
(WebCore::IDBTransaction::deleteObjectStoreOnServer):
(WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
(WebCore::IDBTransaction::deleteIndex):
(WebCore::IDBTransaction::deleteIndexOnServer):
(WebCore::IDBTransaction::didDeleteIndexOnServer):
(WebCore::IDBTransaction::operationCompletedOnClient):
(WebCore::IDBTransaction::establishOnServer):
(WebCore::IDBTransaction::activate):
(WebCore::IDBTransaction::deactivate):
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::removeItemsMatchingCurrentThread):
* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::TransactionOperation::~TransactionOperation):
(WebCore::IDBClient::TransactionOperation::perform):
(WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
(WebCore::IDBClient::TransactionOperation::transitionToComplete):
(WebCore::IDBClient::TransactionOperation::doComplete):
(WebCore::IDBClient::TransactionOperation::originThread const):
(WebCore::IDBClient::TransactionOperation::originThreadID const): Deleted.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext):
(WebCore::AudioContext::lock):
(WebCore::AudioContext::tryLock):
(WebCore::AudioContext::unlock):
(WebCore::AudioContext::isAudioThread const):
(WebCore::AudioContext::isGraphOwner const):
* Modules/webaudio/AudioContext.h:
(WebCore::AudioContext::setAudioThread):
(WebCore::AudioContext::audioThread const):
* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::render):
* Modules/webdatabase/Database.cpp:
(WebCore::Database::performClose):
(WebCore::Database::securityOrigin):
* Modules/webdatabase/DatabaseDetails.h:
(WebCore::DatabaseDetails::DatabaseDetails):
(WebCore::DatabaseDetails::operator=):
(WebCore::DatabaseDetails::thread const):
(WebCore::DatabaseDetails::threadID const): Deleted.
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::detailsForNameAndOrigin):
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::recordDatabaseOpen):
(WebCore::DatabaseThread::recordDatabaseClosed):
* Modules/webdatabase/DatabaseThread.h:
(WebCore::DatabaseThread::getThread):
(WebCore::DatabaseThread::getThreadID): Deleted.
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::checkAndHandleClosedDatabase):
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::doCleanup):
(WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
* bindings/js/JSCallbackData.h:
(WebCore::JSCallbackData::JSCallbackData):
(WebCore::JSCallbackData::~JSCallbackData):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::execute):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::createdMessagePort):
(WebCore::ScriptExecutionContext::destroyedMessagePort):
* page/ResourceUsageOverlay.h:
* page/scrolling/ScrollingThread.cpp:
(WebCore::ScrollingThread::isCurrentThread):
* platform/Supplementable.h:
(WebCore::Supplementable::provideSupplement):
(WebCore::Supplementable::removeSupplement):
(WebCore::Supplementable::requireSupplement):
(WebCore::Supplementable::Supplementable): Deleted.
* platform/Timer.cpp:
(WebCore::TimerBase::TimerBase):
(WebCore::TimerBase::start):
(WebCore::TimerBase::stop):
(WebCore::TimerBase::setNextFireTime):
* platform/Timer.h:
(WebCore::TimerBase::isActive const):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::shouldAutoActivateFontIfNeeded):
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
(WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
(WebCore::TextureMapperPlatformLayerProxy::invalidate):
(WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
(WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers):
(WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
(): Deleted.
* platform/ios/wak/WebCoreThread.mm:
(RunWebThread):
(StartWebThread):
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::close):
* platform/sql/SQLiteDatabase.h:
(WebCore::SQLiteDatabase::sqlite3Handle const):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::~WorkerGlobalScope):
(WebCore::WorkerGlobalScope::isContextThread const):
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
(WebCore::WorkerMessagingProxy::~WorkerMessagingProxy):
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::runInMode):
(WebCore::WorkerRunLoop::runCleanupTasks):
* workers/WorkerThread.h:
(WebCore::WorkerThread::thread const):
(WebCore::WorkerThread::threadID const): Deleted.
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::scheduleJob):
(WebCore::ServiceWorkerContainer::jobFailedWithException):
(WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
(WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
(WebCore::ServiceWorkerContainer::jobDidFinish):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
(WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
(WebCore::ServiceWorkerContainer::contextIdentifier):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::~ServiceWorkerJob):
(WebCore::ServiceWorkerJob::failedWithException):
(WebCore::ServiceWorkerJob::resolvedWithRegistration):
(WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
(WebCore::ServiceWorkerJob::startScriptFetch):
(WebCore::ServiceWorkerJob::fetchScriptWithContext):
(WebCore::ServiceWorkerJob::didReceiveResponse):
(WebCore::ServiceWorkerJob::notifyFinished):
* workers/service/ServiceWorkerJob.h:
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::matchFunc):
(WebCore::openFunc):
(WebCore::initializeXMLParser):
(WebCore::XMLParserContext::createStringParser):
(WebCore::XMLParserContext::createMemoryParser):

Source/WebKit:

* UIProcess/API/glib/IconDatabase.cpp:
* UIProcess/GenericCallback.h:
(WebKit::GenericCallback::~GenericCallback):
(WebKit::GenericCallback::performCallbackWithReturnValue):

Source/WTF:

We should use a pointer of WTF::Thread instead of ThreadIdentifier.

One problem is that Windows support library uses WTF::createThread,
which returns ThreadIdentifier. So we cannot drop ThreadIdentifier
in Windows environment. This patch keeps ThreadIdentifier in Windows.

* wtf/MainThread.cpp:
(WTF::initializeMainThread):
(WTF::isMainThread):
(WTF::canAccessThreadLocalDataForThread):
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkCount):
* wtf/RecursiveLockAdapter.h:
(WTF::RecursiveLockAdapter::lock):
(WTF::RecursiveLockAdapter::unlock):
(WTF::RecursiveLockAdapter::tryLock):
* wtf/Threading.cpp:
(WTF::Thread::dump const):
* wtf/Threading.h:
(WTF::Thread::id const):
(WTF::Thread::operator==): Deleted.
(WTF::Thread::operator!=): Deleted.
(WTF::currentThread): Deleted.
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::initializeCurrentTLS):
(WTF::Thread::suspend):
(WTF::Thread::establishPlatformSpecificHandle):
(WTF::Thread::currentID): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::suspend):
(WTF::Thread::currentDying):
* wtf/mac/MainThreadMac.mm:
(WTF::initializeApplicationUIThread):
(WTF::initializeWebThreadPlatform):
(WTF::canAccessThreadLocalDataForThread):
(WTF::initializeApplicationUIThreadIdentifier): Deleted.
(WTF::initializeWebThreadIdentifier): Deleted.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(dumpRenderTree):
(runThread): Deleted.
(runPthread): Deleted.
(testThreadIdentifierMap): Deleted.
* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/ParkingLot.cpp:
* TestWebKitAPI/Tests/WTF/Threading.cpp: Added.
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/196314@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Constellation committed Dec 4, 2017
1 parent 2833b0c commit adc3bb0099067b4eefc3c6cb6477e8cd7a85a861
Showing with 997 additions and 518 deletions.
  1. +26 −0 Source/JavaScriptCore/ChangeLog
  2. +3 −3 Source/JavaScriptCore/heap/MachineStackMarker.cpp
  3. +10 −10 Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
  4. +2 −2 Source/JavaScriptCore/runtime/ExceptionScope.cpp
  5. +1 −1 Source/JavaScriptCore/runtime/JSLock.h
  6. +1 −1 Source/JavaScriptCore/runtime/VM.cpp
  7. +3 −3 Source/JavaScriptCore/runtime/VM.h
  8. +1 −1 Source/JavaScriptCore/tools/HeapVerifier.cpp
  9. +53 −0 Source/WTF/ChangeLog
  10. +5 −5 Source/WTF/wtf/MainThread.cpp
  11. +4 −5 Source/WTF/wtf/MainThread.h
  12. +21 −21 Source/WTF/wtf/ParkingLot.cpp
  13. +8 −8 Source/WTF/wtf/RecursiveLockAdapter.h
  14. +1 −1 Source/WTF/wtf/Threading.cpp
  15. +10 −21 Source/WTF/wtf/Threading.h
  16. +1 −1 Source/WTF/wtf/ThreadingPrimitives.h
  17. +6 −15 Source/WTF/wtf/ThreadingPthreads.cpp
  18. +3 −3 Source/WTF/wtf/ThreadingWin.cpp
  19. +11 −15 Source/WTF/wtf/mac/MainThreadMac.mm
  20. +352 −0 Source/WebCore/ChangeLog
  21. +6 −6 Source/WebCore/Modules/indexeddb/IDBActiveDOMObject.h
  22. +12 −12 Source/WebCore/Modules/indexeddb/IDBCursor.cpp
  23. +27 −27 Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
  24. +18 −18 Source/WebCore/Modules/indexeddb/IDBIndex.cpp
  25. +25 −25 Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
  26. +11 −11 Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp
  27. +30 −30 Source/WebCore/Modules/indexeddb/IDBRequest.cpp
  28. +92 −92 Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
  29. +2 −2 Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp
  30. +7 −7 Source/WebCore/Modules/indexeddb/client/TransactionOperation.h
  31. +11 −16 Source/WebCore/Modules/webaudio/AudioContext.cpp
  32. +6 −4 Source/WebCore/Modules/webaudio/AudioContext.h
  33. +1 −1 Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp
  34. +2 −2 Source/WebCore/Modules/webdatabase/Database.cpp
  35. +30 −15 Source/WebCore/Modules/webdatabase/DatabaseDetails.h
  36. +1 −1 Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
  37. +3 −3 Source/WebCore/Modules/webdatabase/DatabaseThread.cpp
  38. +1 −1 Source/WebCore/Modules/webdatabase/DatabaseThread.h
  39. +1 −1 Source/WebCore/Modules/webdatabase/SQLTransaction.cpp
  40. +2 −2 Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp
  41. +3 −3 Source/WebCore/bindings/js/JSCallbackData.h
  42. +1 −1 Source/WebCore/bindings/js/ScheduledAction.cpp
  43. +2 −2 Source/WebCore/dom/ScriptExecutionContext.cpp
  44. +0 −1 Source/WebCore/page/ResourceUsageOverlay.h
  45. +1 −2 Source/WebCore/page/scrolling/ScrollingThread.cpp
  46. +5 −5 Source/WebCore/platform/Supplementable.h
  47. +3 −6 Source/WebCore/platform/Timer.cpp
  48. +3 −3 Source/WebCore/platform/Timer.h
  49. +2 −2 Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
  50. +7 −6 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp
  51. +1 −1 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.h
  52. +1 −2 Source/WebCore/platform/ios/wak/WebCoreThread.mm
  53. +3 −3 Source/WebCore/platform/sql/SQLiteDatabase.cpp
  54. +2 −2 Source/WebCore/platform/sql/SQLiteDatabase.h
  55. +2 −2 Source/WebCore/workers/WorkerGlobalScope.cpp
  56. +2 −2 Source/WebCore/workers/WorkerMessagingProxy.cpp
  57. +2 −2 Source/WebCore/workers/WorkerRunLoop.cpp
  58. +1 −1 Source/WebCore/workers/WorkerThread.h
  59. +14 −14 Source/WebCore/workers/service/ServiceWorkerContainer.cpp
  60. +1 −1 Source/WebCore/workers/service/ServiceWorkerContainer.h
  61. +8 −8 Source/WebCore/workers/service/ServiceWorkerJob.cpp
  62. +1 −1 Source/WebCore/workers/service/ServiceWorkerJob.h
  63. +14 −17 Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
  64. +12 −0 Source/WebKit/ChangeLog
  65. +1 −1 Source/WebKit/UIProcess/API/glib/IconDatabase.cpp
  66. +4 −4 Source/WebKit/UIProcess/GenericCallback.h
  67. +18 −0 Tools/ChangeLog
  68. +0 −33 Tools/DumpRenderTree/mac/DumpRenderTree.mm
  69. +1 −0 Tools/TestWebKitAPI/CMakeLists.txt
  70. +4 −0 Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
  71. +0 −1 Tools/TestWebKitAPI/Tests/WTF/ParkingLot.cpp
  72. +68 −0 Tools/TestWebKitAPI/Tests/WTF/Threading.cpp
@@ -1,3 +1,29 @@
2017-12-03 Yusuke Suzuki <utatane.tea@gmail.com>

WTF shouldn't have both Thread and ThreadIdentifier
https://bugs.webkit.org/show_bug.cgi?id=180308

Reviewed by Darin Adler.

* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::tryCopyOtherThreadStacks):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::traceFunctionPrologue):
* runtime/ExceptionScope.cpp:
(JSC::ExceptionScope::unexpectedExceptionMessage):
* runtime/JSLock.h:
(JSC::JSLock::currentThreadIsHoldingLock):
* runtime/VM.cpp:
(JSC::VM::throwException):
* runtime/VM.h:
(JSC::VM::throwingThread const):
(JSC::VM::clearException):
* tools/HeapVerifier.cpp:
(JSC::HeapVerifier::printVerificationHeader):

2017-12-03 Caio Lima <ticaiolima@gmail.com>

Rename DestroyFunc to avoid redefinition on unified build
@@ -151,7 +151,7 @@ bool MachineThreads::tryCopyOtherThreadStacks(const AbstractLocker& locker, void
{
unsigned index = 0;
for (auto& thread : threads) {
if (thread.get() != currentThread) {
if (thread.ptr() != &currentThread) {
auto result = thread->suspend();
if (result)
isSuspended.set(index);
@@ -160,8 +160,8 @@ bool MachineThreads::tryCopyOtherThreadStacks(const AbstractLocker& locker, void
// These threads will be removed from the ThreadGroup. Thus, we do not do anything here except for reporting.
ASSERT(result.error() != KERN_SUCCESS);
WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION,
"JavaScript garbage collection encountered an invalid thread (err 0x%x): Thread [%d/%d: %p] id %u.",
result.error(), index, threads.size(), thread.ptr(), thread->id());
"JavaScript garbage collection encountered an invalid thread (err 0x%x): Thread [%d/%d: %p].",
result.error(), index, threads.size(), thread.ptr());
#endif
}
}
@@ -191,8 +191,8 @@ namespace JSC { namespace LLInt {
extern "C" SlowPathReturnType llint_trace_operand(ExecState* exec, Instruction* pc, int fromWhere, int operand)
{
LLINT_BEGIN();
dataLogF("<%d> %p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d\n",
currentThread(),
dataLogF("<%p> %p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d\n",
&Thread::current(),
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
@@ -215,8 +215,8 @@ extern "C" SlowPathReturnType llint_trace_value(ExecState* exec, Instruction* pc
} u;
u.asValue = JSValue::encode(value);
dataLogF(
"<%d> %p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d: %08x:%08x: %s\n",
currentThread(),
"<%p> %p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d: %08x:%08x: %s\n",
&Thread::current(),
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
@@ -232,7 +232,7 @@ extern "C" SlowPathReturnType llint_trace_value(ExecState* exec, Instruction* pc

LLINT_SLOW_PATH_DECL(trace_prologue)
{
dataLogF("<%d> %p / %p: in prologue of ", currentThread(), exec->codeBlock(), exec);
dataLogF("<%p> %p / %p: in prologue of ", &Thread::current(), exec->codeBlock(), exec);
dataLog(*exec->codeBlock(), "\n");
LLINT_END_IMPL();
}
@@ -242,7 +242,7 @@ static void traceFunctionPrologue(ExecState* exec, const char* comment, CodeSpec
JSFunction* callee = jsCast<JSFunction*>(exec->jsCallee());
FunctionExecutable* executable = callee->jsExecutable();
CodeBlock* codeBlock = executable->codeBlockFor(kind);
dataLogF("<%d> %p / %p: in %s of ", currentThread(), codeBlock, exec, comment);
dataLogF("<%p> %p / %p: in %s of ", &Thread::current(), codeBlock, exec, comment);
dataLog(*codeBlock);
dataLogF(" function %p, executable %p; numVars = %u, numParameters = %u, numCalleeLocals = %u, caller = %p.\n",
callee, executable, codeBlock->m_numVars, codeBlock->numParameters(), codeBlock->m_numCalleeLocals, exec->callerFrame());
@@ -275,8 +275,8 @@ LLINT_SLOW_PATH_DECL(trace_arityCheck_for_construct)
LLINT_SLOW_PATH_DECL(trace)
{
OpcodeID opcodeID = Interpreter::getOpcodeID(pc[0].u.opcode);
dataLogF("<%d> %p / %p: executing bc#%zu, %s, pc = %p\n",
currentThread(),
dataLogF("<%p> %p / %p: executing bc#%zu, %s, pc = %p\n",
&Thread::current(),
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
@@ -294,8 +294,8 @@ LLINT_SLOW_PATH_DECL(trace)

LLINT_SLOW_PATH_DECL(special_trace)
{
dataLogF("<%d> %p / %p: executing special case bc#%zu, op#%u, return PC is %p\n",
currentThread(),
dataLogF("<%p> %p / %p: executing special case bc#%zu, op#%u, return PC is %p\n",
&Thread::current(),
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
@@ -55,14 +55,14 @@ CString ExceptionScope::unexpectedExceptionMessage()
{
StringPrintStream out;

out.println("Unexpected exception observed on thread ", currentThread(), " at:");
out.println("Unexpected exception observed on thread ", Thread::current(), " at:");
auto currentStack = StackTrace::captureStackTrace(Options::unexpectedExceptionStackTraceLimit(), 1);
currentStack->dump(out, " ");

if (!m_vm.nativeStackTraceOfLastThrow())
return CString();

out.println("The exception was thrown from thread ", m_vm.throwingThread(), " at:");
out.println("The exception was thrown from thread ", *m_vm.throwingThread(), " at:");
m_vm.nativeStackTraceOfLastThrow()->dump(out, " ");

return out.toCString();
@@ -98,7 +98,7 @@ class JSLock : public ThreadSafeRefCounted<JSLock> {
return m_ownerThread;
return std::nullopt;
}
bool currentThreadIsHoldingLock() { return m_hasOwnerThread && m_ownerThread->id() == currentThread(); }
bool currentThreadIsHoldingLock() { return m_hasOwnerThread && m_ownerThread.get() == &Thread::current(); }

void willDestroyVM(VM*);

@@ -689,7 +689,7 @@ void VM::throwException(ExecState* exec, Exception* exception)

#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
m_nativeStackTraceOfLastThrow = StackTrace::captureStackTrace(Options::unexpectedExceptionStackTraceLimit());
m_throwingThread = currentThread();
m_throwingThread = &Thread::current();
#endif
}

@@ -711,7 +711,7 @@ class VM : public ThreadSafeRefCounted<VM>, public DoublyLinkedListNode<VM> {

#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
StackTrace* nativeStackTraceOfLastThrow() const { return m_nativeStackTraceOfLastThrow.get(); }
ThreadIdentifier throwingThread() const { return m_throwingThread; }
Thread* throwingThread() const { return m_throwingThread.get(); }
#endif

#if USE(CF)
@@ -754,7 +754,7 @@ class VM : public ThreadSafeRefCounted<VM>, public DoublyLinkedListNode<VM> {
#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
m_needExceptionCheck = false;
m_nativeStackTraceOfLastThrow = nullptr;
m_throwingThread = 0;
m_throwingThread = nullptr;
#endif
m_exception = nullptr;
}
@@ -806,7 +806,7 @@ class VM : public ThreadSafeRefCounted<VM>, public DoublyLinkedListNode<VM> {
mutable bool m_needExceptionCheck { false };
std::unique_ptr<StackTrace> m_nativeStackTraceOfLastThrow;
std::unique_ptr<StackTrace> m_nativeStackTraceOfLastSimulatedThrow;
ThreadIdentifier m_throwingThread;
RefPtr<Thread> m_throwingThread;
#endif

bool m_failNextNewCodeBlock { false };
@@ -143,7 +143,7 @@ void HeapVerifier::printVerificationHeader()
RELEASE_ASSERT(m_heap->collectionScope());
CollectionScope scope = currentCycle().scope;
MonotonicTime gcCycleTimestamp = currentCycle().timestamp;
dataLog("Verifying heap in [p", getCurrentProcessID(), ", t", currentThread(), "] vm ",
dataLog("Verifying heap in [p", getCurrentProcessID(), ", ", Thread::current(), "] vm ",
RawPointer(m_heap->vm()), " on ", scope, " GC @ ", gcCycleTimestamp, "\n");
}

@@ -1,3 +1,56 @@
2017-12-03 Yusuke Suzuki <utatane.tea@gmail.com>

WTF shouldn't have both Thread and ThreadIdentifier
https://bugs.webkit.org/show_bug.cgi?id=180308

Reviewed by Darin Adler.

We should use a pointer of WTF::Thread instead of ThreadIdentifier.

One problem is that Windows support library uses WTF::createThread,
which returns ThreadIdentifier. So we cannot drop ThreadIdentifier
in Windows environment. This patch keeps ThreadIdentifier in Windows.

* wtf/MainThread.cpp:
(WTF::initializeMainThread):
(WTF::isMainThread):
(WTF::canAccessThreadLocalDataForThread):
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkCount):
* wtf/RecursiveLockAdapter.h:
(WTF::RecursiveLockAdapter::lock):
(WTF::RecursiveLockAdapter::unlock):
(WTF::RecursiveLockAdapter::tryLock):
* wtf/Threading.cpp:
(WTF::Thread::dump const):
* wtf/Threading.h:
(WTF::Thread::id const):
(WTF::Thread::operator==): Deleted.
(WTF::Thread::operator!=): Deleted.
(WTF::currentThread): Deleted.
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::initializeCurrentTLS):
(WTF::Thread::suspend):
(WTF::Thread::establishPlatformSpecificHandle):
(WTF::Thread::currentID): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::suspend):
(WTF::Thread::currentDying):
* wtf/mac/MainThreadMac.mm:
(WTF::initializeApplicationUIThread):
(WTF::initializeWebThreadPlatform):
(WTF::canAccessThreadLocalDataForThread):
(WTF::initializeApplicationUIThreadIdentifier): Deleted.
(WTF::initializeWebThreadIdentifier): Deleted.

2017-12-03 Darin Adler <darin@apple.com>

Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
@@ -44,7 +44,7 @@ namespace WTF {

static bool callbacksPaused; // This global variable is only accessed from main thread.
#if !PLATFORM(COCOA)
static ThreadIdentifier mainThreadIdentifier;
static Thread* mainThread { nullptr };
#endif

static StaticLock mainThreadFunctionQueueMutex;
@@ -62,7 +62,7 @@ void initializeMainThread()
std::call_once(initializeKey, [] {
initializeThreading();
#if !PLATFORM(COCOA)
mainThreadIdentifier = currentThread();
mainThread = &Thread::current();
#endif
initializeMainThreadPlatform();
initializeGCThreads();
@@ -72,7 +72,7 @@ void initializeMainThread()
#if !PLATFORM(COCOA)
bool isMainThread()
{
return currentThread() == mainThreadIdentifier;
return mainThread == &Thread::current();
}
#endif

@@ -98,9 +98,9 @@ void initializeWebThread()
#endif // PLATFORM(COCOA)

#if !USE(WEB_THREAD)
bool canAccessThreadLocalDataForThread(ThreadIdentifier threadId)
bool canAccessThreadLocalDataForThread(Thread& thread)
{
return threadId == currentThread();
return &thread == &Thread::current();
}
#endif

@@ -39,6 +39,7 @@
namespace WTF {

class PrintStream;
class Thread;

// Must be called from the main thread.
WTF_EXPORT_PRIVATE void initializeMainThread();
@@ -54,14 +55,13 @@ WTF_EXPORT_PRIVATE void setMainThreadCallbacksPaused(bool paused);

WTF_EXPORT_PRIVATE bool isMainThread();

WTF_EXPORT_PRIVATE bool canAccessThreadLocalDataForThread(ThreadIdentifier);
WTF_EXPORT_PRIVATE bool canAccessThreadLocalDataForThread(Thread&);

#if USE(WEB_THREAD)
WTF_EXPORT_PRIVATE bool isWebThread();
WTF_EXPORT_PRIVATE bool isUIThread();
WTF_EXPORT_PRIVATE void initializeWebThread();
WTF_EXPORT_PRIVATE void initializeApplicationUIThreadIdentifier();
WTF_EXPORT_PRIVATE void initializeWebThreadIdentifier();
WTF_EXPORT_PRIVATE void initializeApplicationUIThread();
void initializeWebThreadPlatform();
#else
inline bool isWebThread() { return isMainThread(); }
@@ -113,8 +113,7 @@ using WTF::callOnWebThreadOrDispatchAsyncOnMainThread;
#endif
#if USE(WEB_THREAD)
using WTF::initializeWebThread;
using WTF::initializeApplicationUIThreadIdentifier;
using WTF::initializeWebThreadIdentifier;
using WTF::initializeApplicationUIThread;
#endif

#endif // MainThread_h

0 comments on commit adc3bb0

Please sign in to comment.