diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /JavaScriptCore/wtf/qt | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'JavaScriptCore/wtf/qt')
-rw-r--r-- | JavaScriptCore/wtf/qt/ThreadingQt.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/JavaScriptCore/wtf/qt/ThreadingQt.cpp index 1fdd2bb..dc04a68 100644 --- a/JavaScriptCore/wtf/qt/ThreadingQt.cpp +++ b/JavaScriptCore/wtf/qt/ThreadingQt.cpp @@ -29,6 +29,8 @@ #include "config.h" #include "Threading.h" +#if !ENABLE(SINGLE_THREADED) + #include "CurrentTime.h" #include "HashMap.h" #include "MainThread.h" @@ -64,6 +66,21 @@ void ThreadPrivate::run() m_returnValue = m_entryPoint(m_data); } +class ThreadMonitor : public QObject { + Q_OBJECT +public: + static ThreadMonitor * instance() + { + static ThreadMonitor *instance = new ThreadMonitor(); + return instance; + } + +public Q_SLOTS: + void threadFinished() + { + sender()->deleteLater(); + } +}; static Mutex* atomicallyInitializedStaticMutex; @@ -155,6 +172,9 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con LOG_ERROR("Failed to create thread at entry point %p with data %p", entryPoint, data); return 0; } + + QObject::connect(thread, SIGNAL(finished()), ThreadMonitor::instance(), SLOT(threadFinished())); + thread->start(); QThread* threadRef = static_cast<QThread*>(thread); @@ -162,7 +182,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con return establishIdentifierForThread(threadRef); } -void setThreadNameInternal(const char*) +void initializeCurrentThreadInternal(const char*) { } @@ -181,8 +201,10 @@ int waitForThreadCompletion(ThreadIdentifier threadID, void** result) return !res; } -void detachThread(ThreadIdentifier) +void detachThread(ThreadIdentifier threadID) { + ASSERT(threadID); + clearThreadForIdentifier(threadID); } ThreadIdentifier currentThread() @@ -267,3 +289,7 @@ void ThreadCondition::broadcast() } } // namespace WebCore + +#include "ThreadingQt.moc" + +#endif |