WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-90780-20120709214341.patch (text/plain), 125.10 KB, created by
Kwang Yul Seo
on 2012-07-09 05:44:00 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Kwang Yul Seo
Created:
2012-07-09 05:44:00 PDT
Size:
125.10 KB
patch
obsolete
>Subversion Revision: 122095 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index fe40eb9376848ea82e83b10f9e7820c509e27a03..61ecb30b367ca63836f279ca8615d59d0c455698 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,127 @@ >+2012-07-09 Kwang Yul Seo <skyul@company100.net> >+ >+ Move WorkQueue to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=90780 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Currently, WorkQueue is in WebKit2. By moving WorkQueue and >+ PlatformProcessIdentifier to WTF, WebCore code can use it. >+ >+ This patch is required for parallel image decoders because >+ WorkQueue is used to make image decoding off the main thread. >+ >+ * GNUmakefile.list.am: >+ * WTF.pro: >+ * WTF.xcodeproj/project.pbxproj: >+ * wtf/CMakeLists.txt: >+ * wtf/PlatformEfl.cmake: >+ * wtf/PlatformProcessIdentifier.h: Renamed from Source/WebKit2/Platform/PlatformProcessIdentifier.h. >+ (WTF): >+ * wtf/WorkQueue.cpp: Renamed from Source/WebKit2/Platform/WorkQueue.cpp. >+ (WTF): >+ (WTF::WorkQueue::WorkQueue): >+ (WTF::WorkQueue::~WorkQueue): >+ (WTF::WorkQueue::invalidate): >+ * wtf/WorkQueue.h: Renamed from Source/WebKit2/Platform/WorkQueue.h. >+ (WTF): >+ (WorkQueue): >+ (WorkItemWin): >+ (WTF::WorkQueue::WorkItemWin::function): >+ (WTF::WorkQueue::WorkItemWin::queue): >+ (HandleWorkItem): >+ (WTF::WorkQueue::HandleWorkItem::setWaitHandle): >+ (WTF::WorkQueue::HandleWorkItem::waitHandle): >+ * wtf/efl/WorkQueueEfl.cpp: Renamed from Source/WebKit2/Platform/efl/WorkQueueEfl.cpp. >+ (TimerWorkItem): >+ (TimerWorkItem::TimerWorkItem): >+ (TimerWorkItem::~TimerWorkItem): >+ (TimerWorkItem::function): >+ (TimerWorkItem::queue): >+ (TimerWorkItem::timerID): >+ (WorkQueue::platformInitialize): >+ (WorkQueue::platformInvalidate): >+ (WorkQueue::performWork): >+ (WorkQueue::performFileDescriptorWork): >+ (WorkQueue::sendMessageToThread): >+ (WorkQueue::workQueueThread): >+ (WorkQueue::registerSocketEventHandler): >+ (WorkQueue::unregisterSocketEventHandler): >+ (WorkQueue::dispatch): >+ (WorkQueue::timerFired): >+ (WorkQueue::dispatchAfterDelay): >+ * wtf/gtk/WorkQueueGtk.cpp: Renamed from Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp. >+ (WorkQueue::EventSource): >+ (WorkQueue::EventSource::EventSource): >+ (WorkQueue::EventSource::cancel): >+ (WorkQueue::EventSource::executeEventSource): >+ (WorkQueue::EventSource::performWorkOnce): >+ (WorkQueue::EventSource::performWork): >+ (WorkQueue::EventSource::performWorkOnTermination): >+ (WorkQueue::EventSource::deleteEventSource): >+ (WorkQueue::platformInitialize): >+ (WorkQueue::platformInvalidate): >+ (WorkQueue::startWorkQueueThread): >+ (WorkQueue::workQueueThreadBody): >+ (WorkQueue::registerEventSourceHandler): >+ (WorkQueue::unregisterEventSourceHandler): >+ (WorkQueue::dispatchOnSource): >+ (WorkQueue::dispatch): >+ (WorkQueue::dispatchAfterDelay): >+ (WorkQueue::dispatchOnTermination): >+ * wtf/mac/WorkQueueMac.cpp: Renamed from Source/WebKit2/Platform/mac/WorkQueueMac.cpp. >+ (WorkQueue::executeFunction): >+ (WorkQueue::dispatch): >+ (WorkQueue::dispatchAfterDelay): >+ (WorkQueue::EventSource): >+ (WorkQueue::EventSource::EventSource): >+ (WorkQueue::EventSource::dispatchSource): >+ (WorkQueue::EventSource::eventHandler): >+ (WorkQueue::EventSource::cancelHandler): >+ (WorkQueue::EventSource::finalizeHandler): >+ (WorkQueue::registerMachPortEventHandler): >+ (WorkQueue::unregisterMachPortEventHandler): >+ (WorkQueue::platformInitialize): >+ (WorkQueue::platformInvalidate): >+ * wtf/qt/WorkQueueQt.cpp: Renamed from Source/WebKit2/Platform/qt/WorkQueueQt.cpp. >+ (WTF): >+ (WorkQueue::WorkItemQt): >+ (WTF::WorkQueue::WorkItemQt::WorkItemQt): >+ (WTF::WorkQueue::WorkItemQt::~WorkItemQt): >+ (WTF::WorkQueue::WorkItemQt::execute): >+ (WTF::WorkQueue::WorkItemQt::executeAndDelete): >+ (WTF::WorkQueue::WorkItemQt::timerEvent): >+ (WTF::WorkQueue::registerSocketEventHandler): >+ (WTF::WorkQueue::platformInitialize): >+ (WTF::WorkQueue::platformInvalidate): >+ (WTF::WorkQueue::dispatch): >+ (WTF::WorkQueue::dispatchAfterDelay): >+ (WTF::WorkQueue::dispatchOnTermination): >+ * wtf/win/WorkQueueWin.cpp: Renamed from Source/WebKit2/Platform/win/WorkQueueWin.cpp. >+ (WorkQueue::WorkItemWin::WorkItemWin): >+ (WorkQueue::WorkItemWin::create): >+ (WorkQueue::WorkItemWin::~WorkItemWin): >+ (WorkQueue::HandleWorkItem::HandleWorkItem): >+ (WorkQueue::HandleWorkItem::createByAdoptingHandle): >+ (WorkQueue::HandleWorkItem::~HandleWorkItem): >+ (WorkQueue::handleCallback): >+ (WorkQueue::registerHandle): >+ (WorkQueue::unregisterAndCloseHandle): >+ (WorkQueue::workThreadCallback): >+ (WorkQueue::performWorkOnRegisteredWorkThread): >+ (WorkQueue::platformInitialize): >+ (WorkQueue::tryRegisterAsWorkThread): >+ (WorkQueue::unregisterAsWorkThread): >+ (WorkQueue::platformInvalidate): >+ (WorkQueue::dispatch): >+ (TimerContext::create): >+ (TimerContext): >+ (TimerContext::TimerContext): >+ (WorkQueue::timerCallback): >+ (WorkQueue::dispatchAfterDelay): >+ (WorkQueue::unregisterWaitAndDestroyItemSoon): >+ (WorkQueue::unregisterWaitAndDestroyItemCallback): >+ > 2012-07-08 Laszlo Gombos <laszlo.1.gombos@nokia.com> > > Introduce a build flag for low quality JPEG images >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 08e0fe9af7b8e0dc514bb25a64d8f64a9d5f19ae..64c0388d6e21d68ce969dd47f6e6b6d725c9c37b 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,31 @@ >+2012-07-09 Kwang Yul Seo <skyul@company100.net> >+ >+ Move WorkQueue to WTF >+ https://bugs.webkit.org/show_bug.cgi?id=90780 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Currently, WorkQueue is in WebKit2. By moving WorkQueue and >+ PlatformProcessIdentifier to WTF, WebCore code can use it. >+ >+ This patch is required for parallel image decoders because >+ WorkQueue is used to make image decoding off the main thread. >+ >+ * CMakeLists.txt: >+ * GNUmakefile.list.am: >+ * Platform/CoreIPC/Connection.h: >+ (Connection): >+ * Platform/CoreIPC/unix/ConnectionUnix.cpp: >+ (CoreIPC::Connection::setShouldCloseConnectionOnProcessTermination): >+ * PlatformEfl.cmake: >+ * Target.pri: >+ * UIProcess/Launcher/ProcessLauncher.cpp: >+ * UIProcess/Launcher/ProcessLauncher.h: >+ * UIProcess/Launcher/ThreadLauncher.h: >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebProcessProxy.h: >+ * WebKit2.xcodeproj/project.pbxproj: >+ > 2012-07-06 Christophe Dumez <christophe.dumez@intel.com> > > [WK2] Add support for Network Information API >diff --git a/Source/WTF/GNUmakefile.list.am b/Source/WTF/GNUmakefile.list.am >index c5f48a6ce559a24cc20b70758df8bc4a84dc9eed..cf2a08e7c99e162ff9af1ff717d9c8ec8edd062a 100644 >--- a/Source/WTF/GNUmakefile.list.am >+++ b/Source/WTF/GNUmakefile.list.am >@@ -164,6 +164,8 @@ wtf_sources += \ > Source/WTF/wtf/ValueCheck.h \ > Source/WTF/wtf/Vector.h \ > Source/WTF/wtf/VectorTraits.h \ >+ Source/WTF/wtf/WorkQueue.cpp \ >+ Source/WTF/wtf/WorkQueue.h \ > Source/WTF/wtf/WTFThreadData.cpp \ > Source/WTF/wtf/WTFThreadData.h \ > Source/WTF/wtf/dtoa.cpp \ >@@ -194,6 +196,7 @@ wtf_sources += \ > Source/WTF/wtf/gobject/GlibUtilities.cpp \ > Source/WTF/wtf/gobject/GlibUtilities.h \ > Source/WTF/wtf/gtk/MainThreadGtk.cpp \ >+ Source/WTF/wtf/gtk/WorkQueueGtk.cpp \ > Source/WTF/wtf/text/ASCIIFastPath.h \ > Source/WTF/wtf/text/AtomicString.cpp \ > Source/WTF/wtf/text/AtomicString.h \ >diff --git a/Source/WTF/WTF.pro b/Source/WTF/WTF.pro >index 0962ef0b50a517bd0e2d4562df8defd6f51a1f04..886b2f3a7b6e3a855ddb0631bb767554e52758cb 100644 >--- a/Source/WTF/WTF.pro >+++ b/Source/WTF/WTF.pro >@@ -163,6 +163,7 @@ HEADERS += \ > Vector.h \ > VectorTraits.h \ > VMTags.h \ >+ WorkQueue.h \ > WTFThreadData.h > > unix: HEADERS += ThreadIdentifierDataPthreads.h >@@ -199,6 +200,7 @@ SOURCES += \ > OSRandomSource.cpp \ > qt/MainThreadQt.cpp \ > qt/StringQt.cpp \ >+ qt/WorkQueueQt.cpp \ > PageAllocationAligned.cpp \ > PageBlock.cpp \ > ParallelJobsGeneric.cpp \ >@@ -209,6 +211,7 @@ SOURCES += \ > TCSystemAlloc.cpp \ > Threading.cpp \ > TypeTraits.cpp \ >+ WorkQueue.cpp \ > WTFThreadData.cpp \ > text/AtomicString.cpp \ > text/CString.cpp \ >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index 7720461e264661fc8e9435e90881674bcd1b7658..5850e703bd3cff3be766bdec0865d3af6362fac9 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -239,6 +239,9 @@ > A8A4747E151A825B004123FF /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47370151A825B004123FF /* Vector.h */; }; > A8A4747F151A825B004123FF /* VectorTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47371151A825B004123FF /* VectorTraits.h */; }; > A8A47480151A825B004123FF /* VMTags.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47372151A825B004123FF /* VMTags.h */; }; >+ BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */; }; >+ BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7E1141970C00A63B1E /* WorkQueue.h */; }; >+ BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */; }; > A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4737A151A825B004123FF /* WTFThreadData.cpp */; }; > A8A47487151A825B004123FF /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4737B151A825B004123FF /* WTFThreadData.h */; }; > A8A4748C151A8264004123FF /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4748B151A8264004123FF /* config.h */; }; >@@ -487,6 +490,9 @@ > A8A47370151A825B004123FF /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vector.h; sourceTree = "<group>"; }; > A8A47371151A825B004123FF /* VectorTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VectorTraits.h; sourceTree = "<group>"; }; > A8A47372151A825B004123FF /* VMTags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTags.h; sourceTree = "<group>"; }; >+ BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; }; >+ BC2E6E7E1141970C00A63B1E /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; }; >+ BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueMac.cpp; sourceTree = "<group>"; }; > A8A4737A151A825B004123FF /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = "<group>"; }; > A8A4737B151A825B004123FF /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; }; > A8A4748B151A8264004123FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; >@@ -717,6 +723,9 @@ > A8A47370151A825B004123FF /* Vector.h */, > A8A47371151A825B004123FF /* VectorTraits.h */, > A8A47372151A825B004123FF /* VMTags.h */, >+ BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */, >+ BC2E6E7E1141970C00A63B1E /* WorkQueue.h */, >+ BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */, > A8A4737A151A825B004123FF /* WTFThreadData.cpp */, > A8A4737B151A825B004123FF /* WTFThreadData.h */, > A876DBD7151816E500DADB95 /* Platform.h */, >@@ -1037,6 +1046,7 @@ > A8A4747E151A825B004123FF /* Vector.h in Headers */, > A8A4747F151A825B004123FF /* VectorTraits.h in Headers */, > A8A47480151A825B004123FF /* VMTags.h in Headers */, >+ BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */, > A8A47487151A825B004123FF /* WTFThreadData.h in Headers */, > A8A4748C151A8264004123FF /* config.h in Headers */, > 143F61201565F0F900DB514A /* RAMSize.h in Headers */, >@@ -1186,6 +1196,8 @@ > A8A47474151A825B004123FF /* URLCharacterTypes.cpp in Sources */, > A8A47477151A825B004123FF /* URLEscape.cpp in Sources */, > A8A4747B151A825B004123FF /* URLSegments.cpp in Sources */, >+ BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */, >+ BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */, > A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */, > 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */, > ); >diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt >index 274f04c9749319aef480447916dd22827250868f..be954f04383d9b8f9be4399101ee02febdf42af9 100644 >--- a/Source/WTF/wtf/CMakeLists.txt >+++ b/Source/WTF/wtf/CMakeLists.txt >@@ -102,6 +102,7 @@ SET(WTF_HEADERS > ValueCheck.h > Vector.h > VectorTraits.h >+ WorkQueue.h > WTFThreadData.h > dtoa.h > >@@ -161,6 +162,7 @@ SET(WTF_SOURCES > StringExtras.cpp > Threading.cpp > TypeTraits.cpp >+ WorkQueue.cpp > WTFThreadData.cpp > dtoa.cpp > >diff --git a/Source/WTF/wtf/PlatformEfl.cmake b/Source/WTF/wtf/PlatformEfl.cmake >index 1a13dbba35584e056c49291e387a3225710d1308..fd17f5785edbfd7a27182b4a3dea24f091efd876 100644 >--- a/Source/WTF/wtf/PlatformEfl.cmake >+++ b/Source/WTF/wtf/PlatformEfl.cmake >@@ -1,6 +1,7 @@ > LIST(APPEND WTF_SOURCES > efl/MainThreadEfl.cpp > efl/OwnPtrEfl.cpp >+ efl/WorkQueueEfl.cpp > gobject/GOwnPtr.cpp > gobject/GRefPtr.cpp > >diff --git a/Source/WTF/wtf/PlatformProcessIdentifier.h b/Source/WTF/wtf/PlatformProcessIdentifier.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f7ff53bcd6c9fb4f2977a88c84b769c0d8bfd716 >--- /dev/null >+++ b/Source/WTF/wtf/PlatformProcessIdentifier.h >@@ -0,0 +1,59 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+ >+#ifndef PlatformProcessIdentifier_h >+#define PlatformProcessIdentifier_h >+ >+#if PLATFORM(QT) >+class QProcess; >+#elif PLATFORM(EFL) >+#include <unistd.h> >+#endif >+ >+namespace WTF { >+ >+#if PLATFORM(MAC) >+typedef pid_t PlatformProcessIdentifier; >+#elif PLATFORM(WIN) >+typedef HANDLE PlatformProcessIdentifier; >+#elif PLATFORM(QT) >+typedef QProcess* PlatformProcessIdentifier; >+#elif PLATFORM(GTK) >+#ifdef G_OS_WIN32 >+typedef void* GPid; >+#else >+typedef int GPid; >+#endif >+typedef GPid PlatformProcessIdentifier; >+#elif PLATFORM(EFL) >+typedef pid_t PlatformProcessIdentifier; >+#endif >+ >+} // namespace WTF >+ >+using WTF::PlatformProcessIdentifier; >+ >+#endif // PlatformProcessIdentifier_h >diff --git a/Source/WTF/wtf/WorkQueue.cpp b/Source/WTF/wtf/WorkQueue.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..8f5fd14eb4bc9e55201442c328dbaf2f36658f6e >--- /dev/null >+++ b/Source/WTF/wtf/WorkQueue.cpp >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WorkQueue.h" >+ >+namespace WTF { >+ >+WorkQueue::WorkQueue(const char* name) >+ : m_isValid(true) >+{ >+ platformInitialize(name); >+} >+ >+WorkQueue::~WorkQueue() >+{ >+#if !ASSERT_DISABLED >+ MutexLocker locker(m_isValidMutex); >+ ASSERT(!m_isValid); >+#endif >+} >+ >+void WorkQueue::invalidate() >+{ >+ { >+ MutexLocker locker(m_isValidMutex); >+ m_isValid = false; >+ } >+ >+ platformInvalidate(); >+} >+ >+} // namespace WTF >diff --git a/Source/WTF/wtf/WorkQueue.h b/Source/WTF/wtf/WorkQueue.h >new file mode 100644 >index 0000000000000000000000000000000000000000..5c0cb986492c5d164aedd8a9ab5f2e9d7194b9a2 >--- /dev/null >+++ b/Source/WTF/wtf/WorkQueue.h >@@ -0,0 +1,216 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef WorkQueue_h >+#define WorkQueue_h >+ >+#if OS(DARWIN) >+#if HAVE(DISPATCH_H) >+#include <dispatch/dispatch.h> >+#endif >+#endif >+ >+#include <wtf/Forward.h> >+#include <wtf/Functional.h> >+#include <wtf/HashMap.h> >+#include <wtf/PassOwnPtr.h> >+#include <wtf/RefCounted.h> >+#include <wtf/Threading.h> >+#include <wtf/Vector.h> >+ >+#if (PLATFORM(QT) && !OS(DARWIN)) || PLATFORM(GTK) || PLATFORM(EFL) >+#include "PlatformProcessIdentifier.h" >+#endif >+ >+#if PLATFORM(QT) && !OS(DARWIN) >+#include <QSocketNotifier> >+class QObject; >+class QThread; >+#elif PLATFORM(GTK) >+#include <wtf/gobject/GRefPtr.h> >+typedef gboolean (*GSourceFunc) (gpointer data); >+#elif PLATFORM(EFL) >+#include <Ecore.h> >+#endif >+ >+namespace WTF { >+ >+class WorkQueue { >+ WTF_MAKE_NONCOPYABLE(WorkQueue); >+ >+public: >+ explicit WorkQueue(const char* name); >+ ~WorkQueue(); >+ >+ // Will dispatch the given function to run as soon as possible. >+ void dispatch(const Function<void()>&); >+ >+ // Will dispatch the given function after the given delay (in seconds). >+ void dispatchAfterDelay(const Function<void()>&, double delay); >+ >+ void invalidate(); >+ >+#if OS(DARWIN) >+ enum MachPortEventType { >+ // Fired when there is data on the given receive right. >+ MachPortDataAvailable, >+ >+ // Fired when the receive right for this send right has been destroyed. >+ MachPortDeadNameNotification >+ }; >+ >+ // Will execute the given function whenever the given mach port event fires. >+ // Note that this will adopt the mach port and destroy it when the work queue is invalidated. >+ void registerMachPortEventHandler(mach_port_t, MachPortEventType, const Function<void()>&); >+ void unregisterMachPortEventHandler(mach_port_t); >+#elif PLATFORM(WIN) >+ void registerHandle(HANDLE, const Function<void()>&); >+ void unregisterAndCloseHandle(HANDLE); >+#elif PLATFORM(QT) >+ QSocketNotifier* registerSocketEventHandler(int, QSocketNotifier::Type, const Function<void()>&); >+ void dispatchOnTermination(PlatformProcessIdentifier, const Function<void()>&); >+#elif PLATFORM(GTK) >+ void registerEventSourceHandler(int, int, const Function<void()>&); >+ void unregisterEventSourceHandler(int); >+ void dispatchOnTermination(PlatformProcessIdentifier, const Function<void()>&); >+#elif PLATFORM(EFL) >+ void registerSocketEventHandler(int, const Function<void()>&); >+ void unregisterSocketEventHandler(int); >+#endif >+ >+private: >+ // FIXME: Use an atomic boolean here instead. >+ Mutex m_isValidMutex; >+ bool m_isValid; >+ >+ void platformInitialize(const char* name); >+ void platformInvalidate(); >+ >+#if OS(DARWIN) >+#if HAVE(DISPATCH_H) >+ static void executeFunction(void*); >+ Mutex m_eventSourcesMutex; >+ class EventSource; >+ HashMap<mach_port_t, EventSource*> m_eventSources; >+ dispatch_queue_t m_dispatchQueue; >+#endif >+#elif PLATFORM(WIN) >+ class WorkItemWin : public ThreadSafeRefCounted<WorkItemWin> { >+ public: >+ static PassRefPtr<WorkItemWin> create(const Function<void()>&, WorkQueue*); >+ virtual ~WorkItemWin(); >+ >+ Function<void()>& function() { return m_function; } >+ WorkQueue* queue() const { return m_queue; } >+ >+ protected: >+ WorkItemWin(const Function<void()>&, WorkQueue*); >+ >+ private: >+ Function<void()> m_function; >+ WorkQueue* m_queue; >+ }; >+ >+ class HandleWorkItem : public WorkItemWin { >+ public: >+ static PassRefPtr<HandleWorkItem> createByAdoptingHandle(HANDLE, const Function<void()>&, WorkQueue*); >+ virtual ~HandleWorkItem(); >+ >+ void setWaitHandle(HANDLE waitHandle) { m_waitHandle = waitHandle; } >+ HANDLE waitHandle() const { return m_waitHandle; } >+ >+ private: >+ HandleWorkItem(HANDLE, const Function<void()>&, WorkQueue*); >+ >+ HANDLE m_handle; >+ HANDLE m_waitHandle; >+ }; >+ >+ static void CALLBACK handleCallback(void* context, BOOLEAN timerOrWaitFired); >+ static void CALLBACK timerCallback(void* context, BOOLEAN timerOrWaitFired); >+ static DWORD WINAPI workThreadCallback(void* context); >+ >+ bool tryRegisterAsWorkThread(); >+ void unregisterAsWorkThread(); >+ void performWorkOnRegisteredWorkThread(); >+ >+ static void unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem>); >+ static DWORD WINAPI unregisterWaitAndDestroyItemCallback(void* context); >+ >+ volatile LONG m_isWorkThreadRegistered; >+ >+ Mutex m_workItemQueueLock; >+ Vector<RefPtr<WorkItemWin> > m_workItemQueue; >+ >+ Mutex m_handlesLock; >+ HashMap<HANDLE, RefPtr<HandleWorkItem> > m_handles; >+ >+ HANDLE m_timerQueue; >+#elif PLATFORM(QT) >+ class WorkItemQt; >+ QThread* m_workThread; >+ friend class WorkItemQt; >+#elif PLATFORM(GTK) >+ static void startWorkQueueThread(WorkQueue*); >+ void workQueueThreadBody(); >+ void dispatchOnSource(GSource*, const Function<void()>&, GSourceFunc); >+ >+ ThreadIdentifier m_workQueueThread; >+ GRefPtr<GMainContext> m_eventContext; >+ Mutex m_eventLoopLock; >+ GRefPtr<GMainLoop> m_eventLoop; >+ Mutex m_eventSourcesLock; >+ class EventSource; >+ HashMap<int, Vector<EventSource*> > m_eventSources; >+ typedef HashMap<int, Vector<EventSource*> >::iterator EventSourceIterator; >+#elif PLATFORM(EFL) >+ fd_set m_fileDescriptorSet; >+ int m_maxFileDescriptor; >+ int m_readFromPipeDescriptor; >+ int m_writeToPipeDescriptor; >+ bool m_threadLoop; >+ >+ Vector<Function<void()> > m_workItemQueue; >+ Mutex m_workItemQueueLock; >+ >+ int m_socketDescriptor; >+ Function<void()> m_socketEventHandler; >+ >+ HashMap<int, OwnPtr<Ecore_Timer> > m_timers; >+ >+ void sendMessageToThread(const char*); >+ static void* workQueueThread(WorkQueue*); >+ void performWork(); >+ void performFileDescriptorWork(); >+ static bool timerFired(void*); >+#endif >+}; >+ >+} // namespace WTF >+ >+using WTF::WorkQueue; >+ >+#endif // WorkQueue_h >diff --git a/Source/WTF/wtf/efl/WorkQueueEfl.cpp b/Source/WTF/wtf/efl/WorkQueueEfl.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..3a39ba9ed9b1270fe7df9e6ce685db473a5f58a7 >--- /dev/null >+++ b/Source/WTF/wtf/efl/WorkQueueEfl.cpp >@@ -0,0 +1,173 @@ >+/* >+ Copyright (C) 2012 Samsung Electronics >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "WorkQueue.h" >+ >+#include <wtf/Assertions.h> >+ >+class TimerWorkItem { >+public: >+ TimerWorkItem(int timerID, const Function<void()>& function, WorkQueue* queue) >+ : m_function(function) >+ , m_queue(queue) >+ , m_timerID(timerID) >+ { >+ } >+ ~TimerWorkItem() { } >+ >+ Function<void()> function() const { return m_function; } >+ WorkQueue* queue() const { return m_queue; } >+ >+ int timerID() const { return m_timerID; } >+ >+private: >+ Function<void()> m_function; >+ WorkQueue* m_queue; >+ int m_timerID; >+}; >+ >+static const int invalidSocketDescriptor = -1; >+static const int threadMessageSize = 1; >+static const char finishThreadMessage[] = "F"; >+static const char wakupThreadMessage[] = "W"; >+ >+void WorkQueue::platformInitialize(const char* name) >+{ >+ int fds[2]; >+ if (pipe(fds)) >+ ASSERT_NOT_REACHED(); >+ >+ m_readFromPipeDescriptor = fds[0]; >+ m_writeToPipeDescriptor = fds[1]; >+ FD_ZERO(&m_fileDescriptorSet); >+ FD_SET(m_readFromPipeDescriptor, &m_fileDescriptorSet); >+ m_maxFileDescriptor = m_readFromPipeDescriptor; >+ >+ m_socketDescriptor = invalidSocketDescriptor; >+ >+ m_threadLoop = true; >+ createThread(reinterpret_cast<WTF::ThreadFunction>(&WorkQueue::workQueueThread), this, name); >+} >+ >+void WorkQueue::platformInvalidate() >+{ >+ sendMessageToThread(finishThreadMessage); >+} >+ >+void WorkQueue::performWork() >+{ >+ m_workItemQueueLock.lock(); >+ >+ while (!m_workItemQueue.isEmpty()) { >+ Vector<Function<void()> > workItemQueue; >+ m_workItemQueue.swap(workItemQueue); >+ >+ m_workItemQueueLock.unlock(); >+ for (size_t i = 0; i < workItemQueue.size(); ++i) >+ workItemQueue[i](); >+ m_workItemQueueLock.lock(); >+ } >+ m_workItemQueueLock.unlock(); >+} >+ >+void WorkQueue::performFileDescriptorWork() >+{ >+ fd_set readFileDescriptorSet = m_fileDescriptorSet; >+ >+ if (select(m_maxFileDescriptor + 1, &readFileDescriptorSet, 0, 0, 0) >= 0) { >+ if (FD_ISSET(m_readFromPipeDescriptor, &readFileDescriptorSet)) { >+ char readBuf[threadMessageSize]; >+ if (read(m_readFromPipeDescriptor, readBuf, threadMessageSize) == -1) >+ LOG_ERROR("Failed to read from WorkQueueThread pipe"); >+ if (!strncmp(readBuf, finishThreadMessage, threadMessageSize)) >+ m_threadLoop = false; >+ } >+ >+ if (m_socketDescriptor != invalidSocketDescriptor && FD_ISSET(m_socketDescriptor, &readFileDescriptorSet)) >+ m_socketEventHandler(); >+ } >+} >+ >+void WorkQueue::sendMessageToThread(const char* message) >+{ >+ if (write(m_writeToPipeDescriptor, message, threadMessageSize) == -1) >+ LOG_ERROR("Failed to wake up WorkQueue Thread"); >+} >+ >+void* WorkQueue::workQueueThread(WorkQueue* workQueue) >+{ >+ while (workQueue->m_threadLoop) { >+ workQueue->performWork(); >+ workQueue->performFileDescriptorWork(); >+ } >+ >+ close(workQueue->m_readFromPipeDescriptor); >+ close(workQueue->m_writeToPipeDescriptor); >+ >+ return 0; >+} >+ >+void WorkQueue::registerSocketEventHandler(int fileDescriptor, const Function<void()>& function) >+{ >+ if (m_socketDescriptor != invalidSocketDescriptor) >+ LOG_ERROR("%d is already registerd.", fileDescriptor); >+ >+ m_socketDescriptor = fileDescriptor; >+ m_socketEventHandler = function; >+ >+ if (fileDescriptor > m_maxFileDescriptor) >+ m_maxFileDescriptor = fileDescriptor; >+ FD_SET(fileDescriptor, &m_fileDescriptorSet); >+} >+ >+void WorkQueue::unregisterSocketEventHandler(int fileDescriptor) >+{ >+ m_socketDescriptor = invalidSocketDescriptor; >+ >+ if (fileDescriptor == m_maxFileDescriptor) >+ m_maxFileDescriptor = m_readFromPipeDescriptor; >+ FD_CLR(fileDescriptor, &m_fileDescriptorSet); >+} >+ >+void WorkQueue::dispatch(const Function<void()>& function) >+{ >+ MutexLocker locker(m_workItemQueueLock); >+ m_workItemQueue.append(function); >+ sendMessageToThread(wakupThreadMessage); >+} >+ >+bool WorkQueue::timerFired(void* data) >+{ >+ TimerWorkItem* item = static_cast<TimerWorkItem*>(data); >+ if (item && item->queue()->m_isValid) { >+ item->queue()->dispatch(item->function()); >+ item->queue()->m_timers.take(item->timerID()); >+ delete item; >+ } >+ >+ return ECORE_CALLBACK_CANCEL; >+} >+ >+void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >+{ >+ static int timerId = 0; >+ m_timers.set(timerId, adoptPtr(ecore_timer_add(delay, reinterpret_cast<Ecore_Task_Cb>(timerFired), new TimerWorkItem(timerId, function, this)))); >+ timerId++; >+} >diff --git a/Source/WTF/wtf/gtk/WorkQueueGtk.cpp b/Source/WTF/wtf/gtk/WorkQueueGtk.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..b91f6351d73b0210eeac6696735887ef8ea6a6d4 >--- /dev/null >+++ b/Source/WTF/wtf/gtk/WorkQueueGtk.cpp >@@ -0,0 +1,229 @@ >+/* >+ * Copyright (C) 2011 Igalia S.L. >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WorkQueue.h" >+ >+#include <gio/gio.h> >+#include <glib.h> >+#include <wtf/gobject/GRefPtr.h> >+ >+// WorkQueue::EventSource >+class WorkQueue::EventSource { >+public: >+ EventSource(const Function<void()>& function, WorkQueue* workQueue, GCancellable* cancellable) >+ : m_function(function) >+ , m_workQueue(workQueue) >+ , m_cancellable(cancellable) >+ { >+ } >+ >+ void cancel() >+ { >+ if (!m_cancellable) >+ return; >+ g_cancellable_cancel(m_cancellable); >+ } >+ >+ static void executeEventSource(EventSource* eventSource) >+ { >+ ASSERT(eventSource); >+ WorkQueue* queue = eventSource->m_workQueue; >+ { >+ MutexLocker locker(queue->m_isValidMutex); >+ if (!queue->m_isValid) >+ return; >+ } >+ >+ eventSource->m_function(); >+ } >+ >+ static gboolean performWorkOnce(EventSource* eventSource) >+ { >+ executeEventSource(eventSource); >+ return FALSE; >+ } >+ >+ static gboolean performWork(GSocket* socket, GIOCondition condition, EventSource* eventSource) >+ { >+ if (!(condition & G_IO_IN) && !(condition & G_IO_HUP) && !(condition & G_IO_ERR)) { >+ // EventSource has been cancelled, return FALSE to destroy the source. >+ return FALSE; >+ } >+ >+ executeEventSource(eventSource); >+ return TRUE; >+ } >+ >+ static gboolean performWorkOnTermination(GPid, gint, EventSource* eventSource) >+ { >+ executeEventSource(eventSource); >+ return FALSE; >+ } >+ >+ static void deleteEventSource(EventSource* eventSource) >+ { >+ ASSERT(eventSource); >+ delete eventSource; >+ } >+ >+public: >+ Function<void()> m_function; >+ WorkQueue* m_workQueue; >+ GCancellable* m_cancellable; >+}; >+ >+// WorkQueue >+static const size_t kVisualStudioThreadNameLimit = 31; >+ >+void WorkQueue::platformInitialize(const char* name) >+{ >+ m_eventContext = adoptGRef(g_main_context_new()); >+ ASSERT(m_eventContext); >+ m_eventLoop = adoptGRef(g_main_loop_new(m_eventContext.get(), FALSE)); >+ ASSERT(m_eventLoop); >+ >+ // This name can be com.apple.WebKit.ProcessLauncher or com.apple.CoreIPC.ReceiveQueue. >+ // We are using those names for the thread name, but both are longer than 31 characters, >+ // which is the limit of Visual Studio for thread names. >+ // When log is enabled createThread() will assert instead of truncate the name, so we need >+ // to make sure we don't use a name longer than 31 characters. >+ const char* threadName = g_strrstr(name, "."); >+ if (threadName) >+ threadName++; >+ else >+ threadName = name; >+ if (strlen(threadName) > kVisualStudioThreadNameLimit) >+ threadName += strlen(threadName) - kVisualStudioThreadNameLimit; >+ >+ m_workQueueThread = createThread(reinterpret_cast<WTF::ThreadFunction>(&WorkQueue::startWorkQueueThread), this, threadName); >+} >+ >+void WorkQueue::platformInvalidate() >+{ >+ MutexLocker locker(m_eventLoopLock); >+ >+ if (m_eventLoop) { >+ if (g_main_loop_is_running(m_eventLoop.get())) >+ g_main_loop_quit(m_eventLoop.get()); >+ m_eventLoop.clear(); >+ } >+ >+ m_eventContext.clear(); >+} >+ >+void WorkQueue::startWorkQueueThread(WorkQueue* workQueue) >+{ >+ workQueue->workQueueThreadBody(); >+} >+ >+void WorkQueue::workQueueThreadBody() >+{ >+ g_main_loop_run(m_eventLoop.get()); >+} >+ >+void WorkQueue::registerEventSourceHandler(int fileDescriptor, int condition, const Function<void()>& function) >+{ >+ GRefPtr<GSocket> socket = adoptGRef(g_socket_new_from_fd(fileDescriptor, 0)); >+ ASSERT(socket); >+ GRefPtr<GCancellable> cancellable = adoptGRef(g_cancellable_new()); >+ GRefPtr<GSource> dispatchSource = adoptGRef(g_socket_create_source(socket.get(), static_cast<GIOCondition>(condition), cancellable.get())); >+ ASSERT(dispatchSource); >+ EventSource* eventSource = new EventSource(function, this, cancellable.get()); >+ ASSERT(eventSource); >+ >+ g_source_set_callback(dispatchSource.get(), reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWork), >+ eventSource, reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource)); >+ >+ // Set up the event sources under the mutex since this is shared across multiple threads. >+ { >+ MutexLocker locker(m_eventSourcesLock); >+ Vector<EventSource*> sources; >+ EventSourceIterator it = m_eventSources.find(fileDescriptor); >+ if (it != m_eventSources.end()) >+ sources = it->second; >+ >+ sources.append(eventSource); >+ m_eventSources.set(fileDescriptor, sources); >+ } >+ >+ g_source_attach(dispatchSource.get(), m_eventContext.get()); >+} >+ >+void WorkQueue::unregisterEventSourceHandler(int fileDescriptor) >+{ >+ ASSERT(fileDescriptor); >+ >+ MutexLocker locker(m_eventSourcesLock); >+ >+ EventSourceIterator it = m_eventSources.find(fileDescriptor); >+ ASSERT(it != m_eventSources.end()); >+ ASSERT(m_eventSources.contains(fileDescriptor)); >+ >+ if (it != m_eventSources.end()) { >+ Vector<EventSource*> sources = it->second; >+ for (unsigned i = 0; i < sources.size(); i++) >+ sources[i]->cancel(); >+ >+ m_eventSources.remove(it); >+ } >+} >+ >+void WorkQueue::dispatchOnSource(GSource* dispatchSource, const Function<void()>& function, GSourceFunc sourceCallback) >+{ >+ EventSource* eventSource = new EventSource(function, this, 0); >+ >+ g_source_set_callback(dispatchSource, sourceCallback, eventSource, >+ reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource)); >+ >+ g_source_attach(dispatchSource, m_eventContext.get()); >+} >+ >+void WorkQueue::dispatch(const Function<void()>& function) >+{ >+ GRefPtr<GSource> dispatchSource = adoptGRef(g_idle_source_new()); >+ ASSERT(dispatchSource); >+ g_source_set_priority(dispatchSource.get(), G_PRIORITY_DEFAULT); >+ >+ dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce)); >+} >+ >+void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >+{ >+ GRefPtr<GSource> dispatchSource = adoptGRef(g_timeout_source_new(static_cast<guint>(delay * 1000))); >+ ASSERT(dispatchSource); >+ >+ dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce)); >+} >+ >+void WorkQueue::dispatchOnTermination(PlatformProcessIdentifier process, const Function<void()>& function) >+{ >+ GRefPtr<GSource> dispatchSource = adoptGRef(g_child_watch_source_new(process)); >+ ASSERT(dispatchSource); >+ >+ dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnTermination)); >+} >diff --git a/Source/WTF/wtf/mac/WorkQueueMac.cpp b/Source/WTF/wtf/mac/WorkQueueMac.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..ae473ee5cc84e58429b0439ccd921ac2c492ffaa >--- /dev/null >+++ b/Source/WTF/wtf/mac/WorkQueueMac.cpp >@@ -0,0 +1,178 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WorkQueue.h" >+ >+#include <mach/mach_init.h> >+#include <mach/mach_port.h> >+#include <wtf/PassOwnPtr.h> >+ >+void WorkQueue::executeFunction(void* context) >+{ >+ WorkQueue* queue = static_cast<WorkQueue*>(dispatch_get_context(dispatch_get_current_queue())); >+ OwnPtr<Function<void()> > function = adoptPtr(static_cast<Function<void()>*>(context)); >+ >+ { >+ MutexLocker locker(queue->m_isValidMutex); >+ if (!queue->m_isValid) >+ return; >+ } >+ >+ (*function)(); >+} >+ >+void WorkQueue::dispatch(const Function<void()>& function) >+{ >+ dispatch_async_f(m_dispatchQueue, new Function<void()>(function), executeFunction); >+} >+ >+void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >+{ >+ dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC); >+ >+ dispatch_after_f(delayTime, m_dispatchQueue, new Function<void()>(function), executeFunction); >+} >+ >+class WorkQueue::EventSource { >+public: >+ EventSource(MachPortEventType eventType, dispatch_source_t dispatchSource, const Function<void()>& function) >+ : m_eventType(eventType) >+ , m_dispatchSource(dispatchSource) >+ , m_function(function) >+ { >+ } >+ >+ dispatch_source_t dispatchSource() const { return m_dispatchSource; } >+ >+ static void eventHandler(void* source) >+ { >+ EventSource* eventSource = static_cast<EventSource*>(source); >+ >+ eventSource->m_function(); >+ } >+ >+ static void cancelHandler(void* source) >+ { >+ EventSource* eventSource = static_cast<EventSource*>(source); >+ >+ mach_port_t machPort = dispatch_source_get_handle(eventSource->m_dispatchSource); >+ >+ switch (eventSource->m_eventType) { >+ case MachPortDataAvailable: >+ // Release our receive right. >+ mach_port_mod_refs(mach_task_self(), machPort, MACH_PORT_RIGHT_RECEIVE, -1); >+ break; >+ case MachPortDeadNameNotification: >+ // Release our send right. >+ mach_port_deallocate(mach_task_self(), machPort); >+ break; >+ } >+ } >+ >+ static void finalizeHandler(void* source) >+ { >+ EventSource* eventSource = static_cast<EventSource*>(source); >+ >+ delete eventSource; >+ } >+ >+private: >+ MachPortEventType m_eventType; >+ >+ // This is a weak reference, since m_dispatchSource references the event source. >+ dispatch_source_t m_dispatchSource; >+ >+ Function<void()> m_function; >+}; >+ >+void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, const Function<void()>& function) >+{ >+ dispatch_source_type_t sourceType = 0; >+ switch (eventType) { >+ case MachPortDataAvailable: >+ sourceType = DISPATCH_SOURCE_TYPE_MACH_RECV; >+ break; >+ case MachPortDeadNameNotification: >+ sourceType = DISPATCH_SOURCE_TYPE_MACH_SEND; >+ break; >+ } >+ >+ dispatch_source_t dispatchSource = dispatch_source_create(sourceType, machPort, 0, m_dispatchQueue); >+ >+ EventSource* eventSource = new EventSource(eventType, dispatchSource, function); >+ dispatch_set_context(dispatchSource, eventSource); >+ >+ dispatch_source_set_event_handler_f(dispatchSource, &EventSource::eventHandler); >+ dispatch_source_set_cancel_handler_f(dispatchSource, &EventSource::cancelHandler); >+ dispatch_set_finalizer_f(dispatchSource, &EventSource::finalizeHandler); >+ >+ // Add the source to our set of sources. >+ { >+ MutexLocker locker(m_eventSourcesMutex); >+ >+ ASSERT(!m_eventSources.contains(machPort)); >+ >+ m_eventSources.set(machPort, eventSource); >+ >+ // And start it! >+ dispatch_resume(dispatchSource); >+ } >+} >+ >+void WorkQueue::unregisterMachPortEventHandler(mach_port_t machPort) >+{ >+ ASSERT(machPort); >+ >+ MutexLocker locker(m_eventSourcesMutex); >+ >+ HashMap<mach_port_t, EventSource*>::iterator it = m_eventSources.find(machPort); >+ ASSERT(it != m_eventSources.end()); >+ >+ ASSERT(m_eventSources.contains(machPort)); >+ >+ EventSource* eventSource = it->second; >+ // Cancel and release the source. It will be deleted in its finalize handler. >+ dispatch_source_cancel(eventSource->dispatchSource()); >+ dispatch_release(eventSource->dispatchSource()); >+ >+ m_eventSources.remove(it); >+} >+ >+void WorkQueue::platformInitialize(const char* name) >+{ >+ m_dispatchQueue = dispatch_queue_create(name, 0); >+ dispatch_set_context(m_dispatchQueue, this); >+} >+ >+void WorkQueue::platformInvalidate() >+{ >+#if !ASSERT_DISABLED >+ MutexLocker locker(m_eventSourcesMutex); >+ ASSERT(m_eventSources.isEmpty()); >+#endif >+ >+ dispatch_release(m_dispatchQueue); >+} >diff --git a/Source/WTF/wtf/qt/WorkQueueQt.cpp b/Source/WTF/wtf/qt/WorkQueueQt.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..d3a79be0803a623576c34b4674c3cd3b03088fba >--- /dev/null >+++ b/Source/WTF/wtf/qt/WorkQueueQt.cpp >@@ -0,0 +1,133 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WorkQueue.h" >+ >+#include <QObject> >+#include <QProcess> >+#include <QThread> >+#include <WebCore/NotImplemented.h> >+#include <wtf/Threading.h> >+ >+namespace WTF { >+ >+class WorkQueue::WorkItemQt : public QObject { >+ Q_OBJECT >+public: >+ WorkItemQt(WorkQueue* workQueue, const Function<void()>& function) >+ : m_queue(workQueue) >+ , m_source(0) >+ , m_signal(0) >+ , m_function(function) >+ { >+ } >+ >+ WorkItemQt(WorkQueue* workQueue, QObject* source, const char* signal, const Function<void()>& function) >+ : m_queue(workQueue) >+ , m_source(source) >+ , m_signal(signal) >+ , m_function(function) >+ { >+ connect(m_source, m_signal, SLOT(execute()), Qt::QueuedConnection); >+ } >+ >+ ~WorkItemQt() >+ { >+ } >+ >+ Q_SLOT void execute() >+ { >+ if (m_queue->m_isValid) >+ m_function(); >+ } >+ >+ Q_SLOT void executeAndDelete() >+ { >+ execute(); >+ delete this; >+ } >+ >+ virtual void timerEvent(QTimerEvent*) >+ { >+ executeAndDelete(); >+ } >+ >+ WorkQueue* m_queue; >+ QObject* m_source; >+ const char* m_signal; >+ Function<void()> m_function; >+}; >+ >+QSocketNotifier* WorkQueue::registerSocketEventHandler(int socketDescriptor, QSocketNotifier::Type type, const Function<void()>& function) >+{ >+ ASSERT(m_workThread); >+ >+ QSocketNotifier* notifier = new QSocketNotifier(socketDescriptor, type, 0); >+ notifier->setEnabled(false); >+ notifier->moveToThread(m_workThread); >+ WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, notifier, SIGNAL(activated(int)), function); >+ itemQt->moveToThread(m_workThread); >+ notifier->setEnabled(true); >+ return notifier; >+} >+ >+void WorkQueue::platformInitialize(const char*) >+{ >+ m_workThread = new QThread(); >+ m_workThread->start(); >+} >+ >+void WorkQueue::platformInvalidate() >+{ >+ m_workThread->exit(); >+ m_workThread->wait(); >+ delete m_workThread; >+} >+ >+void WorkQueue::dispatch(const Function<void()>& function) >+{ >+ WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, function); >+ itemQt->moveToThread(m_workThread); >+ QMetaObject::invokeMethod(itemQt, "executeAndDelete", Qt::QueuedConnection); >+} >+ >+void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delayInSecond) >+{ >+ WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, function); >+ itemQt->startTimer(static_cast<int>(delayInSecond * 1000)); >+ itemQt->moveToThread(m_workThread); >+} >+ >+void WorkQueue::dispatchOnTermination(PlatformProcessIdentifier process, const Function<void()>& function) >+{ >+ WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, process, SIGNAL(finished(int, QProcess::ExitStatus)), function); >+ itemQt->moveToThread(m_workThread); >+} >+ >+} // namespace WTF >+ >+#include "WorkQueueQt.moc" >diff --git a/Source/WTF/wtf/win/WorkQueueWin.cpp b/Source/WTF/wtf/win/WorkQueueWin.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..aabadbda895e07d9ee5330795cc94e617eb91d7b >--- /dev/null >+++ b/Source/WTF/wtf/win/WorkQueueWin.cpp >@@ -0,0 +1,291 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WorkQueue.h" >+ >+#include <WebCore/NotImplemented.h> >+#include <wtf/Threading.h> >+ >+inline WorkQueue::WorkItemWin::WorkItemWin(const Function<void()>& function, WorkQueue* queue) >+ : m_function(function) >+ , m_queue(queue) >+{ >+} >+ >+PassRefPtr<WorkQueue::WorkItemWin> WorkQueue::WorkItemWin::create(const Function<void()>& function, WorkQueue* queue) >+{ >+ return adoptRef(new WorkItemWin(function, queue)); >+} >+ >+WorkQueue::WorkItemWin::~WorkItemWin() >+{ >+} >+ >+inline WorkQueue::HandleWorkItem::HandleWorkItem(HANDLE handle, const Function<void()>& function, WorkQueue* queue) >+ : WorkItemWin(function, queue) >+ , m_handle(handle) >+ , m_waitHandle(0) >+{ >+ ASSERT_ARG(handle, handle); >+} >+ >+PassRefPtr<WorkQueue::HandleWorkItem> WorkQueue::HandleWorkItem::createByAdoptingHandle(HANDLE handle, const Function<void()>& function, WorkQueue* queue) >+{ >+ return adoptRef(new HandleWorkItem(handle, function, queue)); >+} >+ >+WorkQueue::HandleWorkItem::~HandleWorkItem() >+{ >+ ::CloseHandle(m_handle); >+} >+ >+void WorkQueue::handleCallback(void* context, BOOLEAN timerOrWaitFired) >+{ >+ ASSERT_ARG(context, context); >+ ASSERT_ARG(timerOrWaitFired, !timerOrWaitFired); >+ >+ WorkItemWin* item = static_cast<WorkItemWin*>(context); >+ WorkQueue* queue = item->queue(); >+ >+ { >+ MutexLocker lock(queue->m_workItemQueueLock); >+ queue->m_workItemQueue.append(item); >+ >+ // If no other thread is performing work, we can do it on this thread. >+ if (!queue->tryRegisterAsWorkThread()) { >+ // Some other thread is performing work. Since we hold the queue lock, we can be sure >+ // that the work thread is not exiting due to an empty queue and will process the work >+ // item we just added to it. If we weren't holding the lock we'd have to signal >+ // m_performWorkEvent to make sure the work item got picked up. >+ return; >+ } >+ } >+ >+ queue->performWorkOnRegisteredWorkThread(); >+} >+ >+void WorkQueue::registerHandle(HANDLE handle, const Function<void()>& function) >+{ >+ RefPtr<HandleWorkItem> handleItem = HandleWorkItem::createByAdoptingHandle(handle, function, this); >+ >+ { >+ MutexLocker lock(m_handlesLock); >+ ASSERT_ARG(handle, !m_handles.contains(handle)); >+ m_handles.set(handle, handleItem); >+ } >+ >+ HANDLE waitHandle; >+ if (!::RegisterWaitForSingleObject(&waitHandle, handle, handleCallback, handleItem.get(), INFINITE, WT_EXECUTEDEFAULT)) { >+ DWORD error = ::GetLastError(); >+ ASSERT_NOT_REACHED(); >+ } >+ handleItem->setWaitHandle(waitHandle); >+} >+ >+void WorkQueue::unregisterAndCloseHandle(HANDLE handle) >+{ >+ RefPtr<HandleWorkItem> item; >+ { >+ MutexLocker locker(m_handlesLock); >+ ASSERT_ARG(handle, m_handles.contains(handle)); >+ item = m_handles.take(handle); >+ } >+ >+ unregisterWaitAndDestroyItemSoon(item.release()); >+} >+ >+DWORD WorkQueue::workThreadCallback(void* context) >+{ >+ ASSERT_ARG(context, context); >+ >+ WorkQueue* queue = static_cast<WorkQueue*>(context); >+ >+ if (!queue->tryRegisterAsWorkThread()) >+ return 0; >+ >+ queue->performWorkOnRegisteredWorkThread(); >+ return 0; >+} >+ >+void WorkQueue::performWorkOnRegisteredWorkThread() >+{ >+ ASSERT(m_isWorkThreadRegistered); >+ >+ bool isValid = true; >+ >+ m_workItemQueueLock.lock(); >+ >+ while (isValid && !m_workItemQueue.isEmpty()) { >+ Vector<RefPtr<WorkItemWin> > workItemQueue; >+ m_workItemQueue.swap(workItemQueue); >+ >+ // Allow more work to be scheduled while we're not using the queue directly. >+ m_workItemQueueLock.unlock(); >+ for (size_t i = 0; i < workItemQueue.size(); ++i) { >+ MutexLocker locker(m_isValidMutex); >+ isValid = m_isValid; >+ if (!isValid) >+ break; >+ workItemQueue[i]->function()(); >+ } >+ m_workItemQueueLock.lock(); >+ } >+ >+ // One invariant we maintain is that any work scheduled while a work thread is registered will >+ // be handled by that work thread. Unregister as the work thread while the queue lock is still >+ // held so that no work can be scheduled while we're still registered. >+ unregisterAsWorkThread(); >+ >+ m_workItemQueueLock.unlock(); >+} >+ >+void WorkQueue::platformInitialize(const char* name) >+{ >+ m_isWorkThreadRegistered = 0; >+ m_timerQueue = ::CreateTimerQueue(); >+ ASSERT_WITH_MESSAGE(m_timerQueue, "::CreateTimerQueue failed with error %lu", ::GetLastError()); >+} >+ >+bool WorkQueue::tryRegisterAsWorkThread() >+{ >+ LONG result = ::InterlockedCompareExchange(&m_isWorkThreadRegistered, 1, 0); >+ ASSERT(!result || result == 1); >+ return !result; >+} >+ >+void WorkQueue::unregisterAsWorkThread() >+{ >+ LONG result = ::InterlockedCompareExchange(&m_isWorkThreadRegistered, 0, 1); >+ ASSERT_UNUSED(result, result == 1); >+} >+ >+void WorkQueue::platformInvalidate() >+{ >+#if !ASSERT_DISABLED >+ MutexLocker lock(m_handlesLock); >+ ASSERT(m_handles.isEmpty()); >+#endif >+ >+ // FIXME: We need to ensure that any timer-queue timers that fire after this point don't try to >+ // access this WorkQueue <http://webkit.org/b/44690>. >+ ::DeleteTimerQueueEx(m_timerQueue, 0); >+} >+ >+void WorkQueue::dispatch(const Function<void()>& function) >+{ >+ MutexLocker locker(m_workItemQueueLock); >+ >+ m_workItemQueue.append(WorkItemWin::create(function, this)); >+ >+ // Spawn a work thread to perform the work we just added. As an optimization, we avoid >+ // spawning the thread if a work thread is already registered. This prevents multiple work >+ // threads from being spawned in most cases. (Note that when a work thread has been spawned but >+ // hasn't registered itself yet, m_isWorkThreadRegistered will be false and we'll end up >+ // spawning a second work thread here. But work thread registration process will ensure that >+ // only one thread actually ends up performing work.) >+ if (!m_isWorkThreadRegistered) >+ ::QueueUserWorkItem(workThreadCallback, this, WT_EXECUTEDEFAULT); >+} >+ >+struct TimerContext : public ThreadSafeRefCounted<TimerContext> { >+ static PassRefPtr<TimerContext> create() { return adoptRef(new TimerContext); } >+ >+ WorkQueue* queue; >+ Function<void()> function; >+ Mutex timerMutex; >+ HANDLE timer; >+ >+private: >+ TimerContext() : queue(0), timer(0) { } >+}; >+ >+void WorkQueue::timerCallback(void* context, BOOLEAN timerOrWaitFired) >+{ >+ ASSERT_ARG(context, context); >+ ASSERT_UNUSED(timerOrWaitFired, timerOrWaitFired); >+ >+ // Balanced by leakRef in scheduleWorkAfterDelay. >+ RefPtr<TimerContext> timerContext = adoptRef(static_cast<TimerContext*>(context)); >+ >+ timerContext->queue->dispatch(timerContext->function); >+ >+ MutexLocker lock(timerContext->timerMutex); >+ ASSERT(timerContext->timer); >+ ASSERT(timerContext->queue->m_timerQueue); >+ if (!::DeleteTimerQueueTimer(timerContext->queue->m_timerQueue, timerContext->timer, 0)) >+ ASSERT_WITH_MESSAGE(false, "::DeleteTimerQueueTimer failed with error %lu", ::GetLastError()); >+} >+ >+void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >+{ >+ ASSERT(m_timerQueue); >+ >+ RefPtr<TimerContext> context = TimerContext::create(); >+ context->queue = this; >+ context->function = function; >+ >+ { >+ // The timer callback could fire before ::CreateTimerQueueTimer even returns, so we protect >+ // context->timer with a mutex to ensure the timer callback doesn't access it before the >+ // timer handle has been stored in it. >+ MutexLocker lock(context->timerMutex); >+ >+ // Since our timer callback is quick, we can execute in the timer thread itself and avoid >+ // an extra thread switch over to a worker thread. >+ if (!::CreateTimerQueueTimer(&context->timer, m_timerQueue, timerCallback, context.get(), delay * 1000, 0, WT_EXECUTEINTIMERTHREAD)) { >+ ASSERT_WITH_MESSAGE(false, "::CreateTimerQueueTimer failed with error %lu", ::GetLastError()); >+ return; >+ } >+ } >+ >+ // The timer callback will handle destroying context. >+ context.release().leakRef(); >+} >+ >+void WorkQueue::unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem> item) >+{ >+ // We're going to make a blocking call to ::UnregisterWaitEx before closing the handle. (The >+ // blocking version of ::UnregisterWaitEx is much simpler than the non-blocking version.) If we >+ // do this on the current thread, we'll deadlock if we're currently in a callback function for >+ // the wait we're unregistering. So instead we do it asynchronously on some other worker thread. >+ >+ ::QueueUserWorkItem(unregisterWaitAndDestroyItemCallback, item.leakRef(), WT_EXECUTEDEFAULT); >+} >+ >+DWORD WINAPI WorkQueue::unregisterWaitAndDestroyItemCallback(void* context) >+{ >+ ASSERT_ARG(context, context); >+ RefPtr<HandleWorkItem> item = adoptRef(static_cast<HandleWorkItem*>(context)); >+ >+ // Now that we know we're not in a callback function for the wait we're unregistering, we can >+ // make a blocking call to ::UnregisterWaitEx. >+ if (!::UnregisterWaitEx(item->waitHandle(), INVALID_HANDLE_VALUE)) { >+ DWORD error = ::GetLastError(); >+ ASSERT_NOT_REACHED(); >+ } >+ >+ return 0; >+} >diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt >index 1d470889a3a00e02423d763afcf3a56b7572d63a..13305245e94c0db57c194d4bd05d63e125864652 100644 >--- a/Source/WebKit2/CMakeLists.txt >+++ b/Source/WebKit2/CMakeLists.txt >@@ -102,7 +102,6 @@ SET(WebKit2_INCLUDE_DIRECTORIES > SET(WebKit2_SOURCES > Platform/Logging.cpp > Platform/Module.cpp >- Platform/WorkQueue.cpp > > Platform/CoreIPC/ArgumentCoders.cpp > Platform/CoreIPC/ArgumentDecoder.cpp >diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am >index 6c06d5af93642d4589357ba213626a60495cb676..3dd2f6687b0e54f46dbab664e425ee9336aaf735 100644 >--- a/Source/WebKit2/GNUmakefile.list.am >+++ b/Source/WebKit2/GNUmakefile.list.am >@@ -253,7 +253,6 @@ webkit2_sources += \ > Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \ > Source/WebKit2/Platform/gtk/LoggingGtk.cpp \ > Source/WebKit2/Platform/gtk/ModuleGtk.cpp \ >- Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp \ > Source/WebKit2/Platform/Logging.cpp \ > Source/WebKit2/Platform/Logging.h \ > Source/WebKit2/Platform/Module.cpp \ >@@ -261,8 +260,6 @@ webkit2_sources += \ > Source/WebKit2/Platform/PlatformProcessIdentifier.h \ > Source/WebKit2/Platform/SharedMemory.h \ > Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp \ >- Source/WebKit2/Platform/WorkQueue.cpp \ >- Source/WebKit2/Platform/WorkQueue.h \ > Source/WebKit2/PluginProcess/PluginControllerProxy.cpp \ > Source/WebKit2/PluginProcess/PluginControllerProxy.h \ > Source/WebKit2/PluginProcess/PluginCreationParameters.cpp \ >@@ -1169,11 +1166,8 @@ webkit2_plugin_process_sources += \ > Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \ > Source/WebKit2/Platform/Module.cpp \ > Source/WebKit2/Platform/Module.h \ >- Source/WebKit2/Platform/WorkQueue.cpp \ >- Source/WebKit2/Platform/WorkQueue.h \ > Source/WebKit2/Platform/SharedMemory.h \ > Source/WebKit2/Platform/gtk/ModuleGtk.cpp \ >- Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp \ > Source/WebKit2/Platform/unix/SharedMemoryUnix.cpp \ > Source/WebKit2/PluginProcess/PluginControllerProxy.cpp \ > Source/WebKit2/PluginProcess/PluginControllerProxy.h \ >diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.h b/Source/WebKit2/Platform/CoreIPC/Connection.h >index 773f6e0d13fb6ceac3cbaa50e30af117c2e020ed..a02f92e16010bc5b61dcc781fe63818f4ba96945 100644 >--- a/Source/WebKit2/Platform/CoreIPC/Connection.h >+++ b/Source/WebKit2/Platform/CoreIPC/Connection.h >@@ -32,11 +32,11 @@ > #include "ArgumentEncoder.h" > #include "Arguments.h" > #include "MessageID.h" >-#include "WorkQueue.h" > #include <wtf/HashMap.h> > #include <wtf/PassRefPtr.h> > #include <wtf/OwnPtr.h> > #include <wtf/Threading.h> >+#include <wtf/WorkQueue.h> > > #if OS(DARWIN) > #include <mach/mach_port.h> >@@ -47,7 +47,7 @@ class QSocketNotifier; > #endif > > #if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) >-#include "PlatformProcessIdentifier.h" >+#include <wtf/PlatformProcessIdentifier.h> > #endif > > namespace WebCore { >@@ -127,7 +127,7 @@ public: > #if OS(DARWIN) > void setShouldCloseConnectionOnMachExceptions(); > #elif PLATFORM(QT) >- void setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier); >+ void setShouldCloseConnectionOnProcessTermination(PlatformProcessIdentifier); > #endif > > void setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(bool); >diff --git a/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp b/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp >index 885e495cb7688c4e39172a72bae92de89405c987..49a508933dbc5fa9343c88fbde98c844030d5019 100644 >--- a/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp >+++ b/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp >@@ -557,7 +557,7 @@ bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEnc > } > > #if PLATFORM(QT) >-void Connection::setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier process) >+void Connection::setShouldCloseConnectionOnProcessTermination(PlatformProcessIdentifier process) > { > m_connectionQueue.dispatchOnTermination(process, WTF::bind(&Connection::connectionDidClose, this)); > } >diff --git a/Source/WebKit2/Platform/PlatformProcessIdentifier.h b/Source/WebKit2/Platform/PlatformProcessIdentifier.h >deleted file mode 100644 >index 96ecbe87273afcdcfb079da40c2e6532c8cf8653..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/PlatformProcessIdentifier.h >+++ /dev/null >@@ -1,57 +0,0 @@ >-/* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >- >-#ifndef PlatformProcessIdentifier_h >-#define PlatformProcessIdentifier_h >- >-#if PLATFORM(QT) >-class QProcess; >-#elif PLATFORM(EFL) >-#include <unistd.h> >-#endif >- >-namespace WebKit { >- >-#if PLATFORM(MAC) >-typedef pid_t PlatformProcessIdentifier; >-#elif PLATFORM(WIN) >-typedef HANDLE PlatformProcessIdentifier; >-#elif PLATFORM(QT) >-typedef QProcess* PlatformProcessIdentifier; >-#elif PLATFORM(GTK) >-#ifdef G_OS_WIN32 >-typedef void* GPid; >-#else >-typedef int GPid; >-#endif >-typedef GPid PlatformProcessIdentifier; >-#elif PLATFORM(EFL) >-typedef pid_t PlatformProcessIdentifier; >-#endif >- >-} // namespace WebKit >- >-#endif // PlatformProcessIdentifier_h >diff --git a/Source/WebKit2/Platform/WorkQueue.cpp b/Source/WebKit2/Platform/WorkQueue.cpp >deleted file mode 100644 >index 6bcdd226442308280560b89425ab16077fceb5da..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/WorkQueue.cpp >+++ /dev/null >@@ -1,51 +0,0 @@ >-/* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WorkQueue.h" >- >-WorkQueue::WorkQueue(const char* name) >- : m_isValid(true) >-{ >- platformInitialize(name); >-} >- >-WorkQueue::~WorkQueue() >-{ >-#if !ASSERT_DISABLED >- MutexLocker locker(m_isValidMutex); >- ASSERT(!m_isValid); >-#endif >-} >- >-void WorkQueue::invalidate() >-{ >- { >- MutexLocker locker(m_isValidMutex); >- m_isValid = false; >- } >- >- platformInvalidate(); >-} >diff --git a/Source/WebKit2/Platform/WorkQueue.h b/Source/WebKit2/Platform/WorkQueue.h >deleted file mode 100644 >index d630dc02855e5da094b13f1f151329c2db41430c..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/WorkQueue.h >+++ /dev/null >@@ -1,210 +0,0 @@ >-/* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef WorkQueue_h >-#define WorkQueue_h >- >-#if OS(DARWIN) >-#if HAVE(DISPATCH_H) >-#include <dispatch/dispatch.h> >-#endif >-#endif >- >-#include <wtf/Forward.h> >-#include <wtf/Functional.h> >-#include <wtf/HashMap.h> >-#include <wtf/PassOwnPtr.h> >-#include <wtf/RefCounted.h> >-#include <wtf/Threading.h> >-#include <wtf/Vector.h> >- >-#if (PLATFORM(QT) && !OS(DARWIN)) || PLATFORM(GTK) || PLATFORM(EFL) >-#include "PlatformProcessIdentifier.h" >-#endif >- >-#if PLATFORM(QT) && !OS(DARWIN) >-#include <QSocketNotifier> >-class QObject; >-class QThread; >-#elif PLATFORM(GTK) >-#include <wtf/gobject/GRefPtr.h> >-typedef gboolean (*GSourceFunc) (gpointer data); >-#elif PLATFORM(EFL) >-#include <Ecore.h> >-#endif >- >-class WorkQueue { >- WTF_MAKE_NONCOPYABLE(WorkQueue); >- >-public: >- explicit WorkQueue(const char* name); >- ~WorkQueue(); >- >- // Will dispatch the given function to run as soon as possible. >- void dispatch(const Function<void()>&); >- >- // Will dispatch the given function after the given delay (in seconds). >- void dispatchAfterDelay(const Function<void()>&, double delay); >- >- void invalidate(); >- >-#if OS(DARWIN) >- enum MachPortEventType { >- // Fired when there is data on the given receive right. >- MachPortDataAvailable, >- >- // Fired when the receive right for this send right has been destroyed. >- MachPortDeadNameNotification >- }; >- >- // Will execute the given function whenever the given mach port event fires. >- // Note that this will adopt the mach port and destroy it when the work queue is invalidated. >- void registerMachPortEventHandler(mach_port_t, MachPortEventType, const Function<void()>&); >- void unregisterMachPortEventHandler(mach_port_t); >-#elif PLATFORM(WIN) >- void registerHandle(HANDLE, const Function<void()>&); >- void unregisterAndCloseHandle(HANDLE); >-#elif PLATFORM(QT) >- QSocketNotifier* registerSocketEventHandler(int, QSocketNotifier::Type, const Function<void()>&); >- void dispatchOnTermination(WebKit::PlatformProcessIdentifier, const Function<void()>&); >-#elif PLATFORM(GTK) >- void registerEventSourceHandler(int, int, const Function<void()>&); >- void unregisterEventSourceHandler(int); >- void dispatchOnTermination(WebKit::PlatformProcessIdentifier, const Function<void()>&); >-#elif PLATFORM(EFL) >- void registerSocketEventHandler(int, const Function<void()>&); >- void unregisterSocketEventHandler(int); >-#endif >- >-private: >- // FIXME: Use an atomic boolean here instead. >- Mutex m_isValidMutex; >- bool m_isValid; >- >- void platformInitialize(const char* name); >- void platformInvalidate(); >- >-#if OS(DARWIN) >-#if HAVE(DISPATCH_H) >- static void executeFunction(void*); >- Mutex m_eventSourcesMutex; >- class EventSource; >- HashMap<mach_port_t, EventSource*> m_eventSources; >- dispatch_queue_t m_dispatchQueue; >-#endif >-#elif PLATFORM(WIN) >- class WorkItemWin : public ThreadSafeRefCounted<WorkItemWin> { >- public: >- static PassRefPtr<WorkItemWin> create(const Function<void()>&, WorkQueue*); >- virtual ~WorkItemWin(); >- >- Function<void()>& function() { return m_function; } >- WorkQueue* queue() const { return m_queue; } >- >- protected: >- WorkItemWin(const Function<void()>&, WorkQueue*); >- >- private: >- Function<void()> m_function; >- WorkQueue* m_queue; >- }; >- >- class HandleWorkItem : public WorkItemWin { >- public: >- static PassRefPtr<HandleWorkItem> createByAdoptingHandle(HANDLE, const Function<void()>&, WorkQueue*); >- virtual ~HandleWorkItem(); >- >- void setWaitHandle(HANDLE waitHandle) { m_waitHandle = waitHandle; } >- HANDLE waitHandle() const { return m_waitHandle; } >- >- private: >- HandleWorkItem(HANDLE, const Function<void()>&, WorkQueue*); >- >- HANDLE m_handle; >- HANDLE m_waitHandle; >- }; >- >- static void CALLBACK handleCallback(void* context, BOOLEAN timerOrWaitFired); >- static void CALLBACK timerCallback(void* context, BOOLEAN timerOrWaitFired); >- static DWORD WINAPI workThreadCallback(void* context); >- >- bool tryRegisterAsWorkThread(); >- void unregisterAsWorkThread(); >- void performWorkOnRegisteredWorkThread(); >- >- static void unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem>); >- static DWORD WINAPI unregisterWaitAndDestroyItemCallback(void* context); >- >- volatile LONG m_isWorkThreadRegistered; >- >- Mutex m_workItemQueueLock; >- Vector<RefPtr<WorkItemWin> > m_workItemQueue; >- >- Mutex m_handlesLock; >- HashMap<HANDLE, RefPtr<HandleWorkItem> > m_handles; >- >- HANDLE m_timerQueue; >-#elif PLATFORM(QT) >- class WorkItemQt; >- QThread* m_workThread; >- friend class WorkItemQt; >-#elif PLATFORM(GTK) >- static void startWorkQueueThread(WorkQueue*); >- void workQueueThreadBody(); >- void dispatchOnSource(GSource*, const Function<void()>&, GSourceFunc); >- >- ThreadIdentifier m_workQueueThread; >- GRefPtr<GMainContext> m_eventContext; >- Mutex m_eventLoopLock; >- GRefPtr<GMainLoop> m_eventLoop; >- Mutex m_eventSourcesLock; >- class EventSource; >- HashMap<int, Vector<EventSource*> > m_eventSources; >- typedef HashMap<int, Vector<EventSource*> >::iterator EventSourceIterator; >-#elif PLATFORM(EFL) >- fd_set m_fileDescriptorSet; >- int m_maxFileDescriptor; >- int m_readFromPipeDescriptor; >- int m_writeToPipeDescriptor; >- bool m_threadLoop; >- >- Vector<Function<void()> > m_workItemQueue; >- Mutex m_workItemQueueLock; >- >- int m_socketDescriptor; >- Function<void()> m_socketEventHandler; >- >- HashMap<int, OwnPtr<Ecore_Timer> > m_timers; >- >- void sendMessageToThread(const char*); >- static void* workQueueThread(WorkQueue*); >- void performWork(); >- void performFileDescriptorWork(); >- static bool timerFired(void*); >-#endif >-}; >- >-#endif // WorkQueue_h >diff --git a/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp b/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp >deleted file mode 100644 >index 3a39ba9ed9b1270fe7df9e6ce685db473a5f58a7..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/efl/WorkQueueEfl.cpp >+++ /dev/null >@@ -1,173 +0,0 @@ >-/* >- Copyright (C) 2012 Samsung Electronics >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "WorkQueue.h" >- >-#include <wtf/Assertions.h> >- >-class TimerWorkItem { >-public: >- TimerWorkItem(int timerID, const Function<void()>& function, WorkQueue* queue) >- : m_function(function) >- , m_queue(queue) >- , m_timerID(timerID) >- { >- } >- ~TimerWorkItem() { } >- >- Function<void()> function() const { return m_function; } >- WorkQueue* queue() const { return m_queue; } >- >- int timerID() const { return m_timerID; } >- >-private: >- Function<void()> m_function; >- WorkQueue* m_queue; >- int m_timerID; >-}; >- >-static const int invalidSocketDescriptor = -1; >-static const int threadMessageSize = 1; >-static const char finishThreadMessage[] = "F"; >-static const char wakupThreadMessage[] = "W"; >- >-void WorkQueue::platformInitialize(const char* name) >-{ >- int fds[2]; >- if (pipe(fds)) >- ASSERT_NOT_REACHED(); >- >- m_readFromPipeDescriptor = fds[0]; >- m_writeToPipeDescriptor = fds[1]; >- FD_ZERO(&m_fileDescriptorSet); >- FD_SET(m_readFromPipeDescriptor, &m_fileDescriptorSet); >- m_maxFileDescriptor = m_readFromPipeDescriptor; >- >- m_socketDescriptor = invalidSocketDescriptor; >- >- m_threadLoop = true; >- createThread(reinterpret_cast<WTF::ThreadFunction>(&WorkQueue::workQueueThread), this, name); >-} >- >-void WorkQueue::platformInvalidate() >-{ >- sendMessageToThread(finishThreadMessage); >-} >- >-void WorkQueue::performWork() >-{ >- m_workItemQueueLock.lock(); >- >- while (!m_workItemQueue.isEmpty()) { >- Vector<Function<void()> > workItemQueue; >- m_workItemQueue.swap(workItemQueue); >- >- m_workItemQueueLock.unlock(); >- for (size_t i = 0; i < workItemQueue.size(); ++i) >- workItemQueue[i](); >- m_workItemQueueLock.lock(); >- } >- m_workItemQueueLock.unlock(); >-} >- >-void WorkQueue::performFileDescriptorWork() >-{ >- fd_set readFileDescriptorSet = m_fileDescriptorSet; >- >- if (select(m_maxFileDescriptor + 1, &readFileDescriptorSet, 0, 0, 0) >= 0) { >- if (FD_ISSET(m_readFromPipeDescriptor, &readFileDescriptorSet)) { >- char readBuf[threadMessageSize]; >- if (read(m_readFromPipeDescriptor, readBuf, threadMessageSize) == -1) >- LOG_ERROR("Failed to read from WorkQueueThread pipe"); >- if (!strncmp(readBuf, finishThreadMessage, threadMessageSize)) >- m_threadLoop = false; >- } >- >- if (m_socketDescriptor != invalidSocketDescriptor && FD_ISSET(m_socketDescriptor, &readFileDescriptorSet)) >- m_socketEventHandler(); >- } >-} >- >-void WorkQueue::sendMessageToThread(const char* message) >-{ >- if (write(m_writeToPipeDescriptor, message, threadMessageSize) == -1) >- LOG_ERROR("Failed to wake up WorkQueue Thread"); >-} >- >-void* WorkQueue::workQueueThread(WorkQueue* workQueue) >-{ >- while (workQueue->m_threadLoop) { >- workQueue->performWork(); >- workQueue->performFileDescriptorWork(); >- } >- >- close(workQueue->m_readFromPipeDescriptor); >- close(workQueue->m_writeToPipeDescriptor); >- >- return 0; >-} >- >-void WorkQueue::registerSocketEventHandler(int fileDescriptor, const Function<void()>& function) >-{ >- if (m_socketDescriptor != invalidSocketDescriptor) >- LOG_ERROR("%d is already registerd.", fileDescriptor); >- >- m_socketDescriptor = fileDescriptor; >- m_socketEventHandler = function; >- >- if (fileDescriptor > m_maxFileDescriptor) >- m_maxFileDescriptor = fileDescriptor; >- FD_SET(fileDescriptor, &m_fileDescriptorSet); >-} >- >-void WorkQueue::unregisterSocketEventHandler(int fileDescriptor) >-{ >- m_socketDescriptor = invalidSocketDescriptor; >- >- if (fileDescriptor == m_maxFileDescriptor) >- m_maxFileDescriptor = m_readFromPipeDescriptor; >- FD_CLR(fileDescriptor, &m_fileDescriptorSet); >-} >- >-void WorkQueue::dispatch(const Function<void()>& function) >-{ >- MutexLocker locker(m_workItemQueueLock); >- m_workItemQueue.append(function); >- sendMessageToThread(wakupThreadMessage); >-} >- >-bool WorkQueue::timerFired(void* data) >-{ >- TimerWorkItem* item = static_cast<TimerWorkItem*>(data); >- if (item && item->queue()->m_isValid) { >- item->queue()->dispatch(item->function()); >- item->queue()->m_timers.take(item->timerID()); >- delete item; >- } >- >- return ECORE_CALLBACK_CANCEL; >-} >- >-void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >-{ >- static int timerId = 0; >- m_timers.set(timerId, adoptPtr(ecore_timer_add(delay, reinterpret_cast<Ecore_Task_Cb>(timerFired), new TimerWorkItem(timerId, function, this)))); >- timerId++; >-} >diff --git a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp >deleted file mode 100644 >index 1dfab83ccfb24c9f00ee40d2daa1c95b16382a43..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp >+++ /dev/null >@@ -1,230 +0,0 @@ >-/* >- * Copyright (C) 2011 Igalia S.L. >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WorkQueue.h" >- >-#include "WKBase.h" >-#include <gio/gio.h> >-#include <glib.h> >-#include <wtf/gobject/GRefPtr.h> >- >-// WorkQueue::EventSource >-class WorkQueue::EventSource { >-public: >- EventSource(const Function<void()>& function, WorkQueue* workQueue, GCancellable* cancellable) >- : m_function(function) >- , m_workQueue(workQueue) >- , m_cancellable(cancellable) >- { >- } >- >- void cancel() >- { >- if (!m_cancellable) >- return; >- g_cancellable_cancel(m_cancellable); >- } >- >- static void executeEventSource(EventSource* eventSource) >- { >- ASSERT(eventSource); >- WorkQueue* queue = eventSource->m_workQueue; >- { >- MutexLocker locker(queue->m_isValidMutex); >- if (!queue->m_isValid) >- return; >- } >- >- eventSource->m_function(); >- } >- >- static gboolean performWorkOnce(EventSource* eventSource) >- { >- executeEventSource(eventSource); >- return FALSE; >- } >- >- static gboolean performWork(GSocket* socket, GIOCondition condition, EventSource* eventSource) >- { >- if (!(condition & G_IO_IN) && !(condition & G_IO_HUP) && !(condition & G_IO_ERR)) { >- // EventSource has been cancelled, return FALSE to destroy the source. >- return FALSE; >- } >- >- executeEventSource(eventSource); >- return TRUE; >- } >- >- static gboolean performWorkOnTermination(GPid, gint, EventSource* eventSource) >- { >- executeEventSource(eventSource); >- return FALSE; >- } >- >- static void deleteEventSource(EventSource* eventSource) >- { >- ASSERT(eventSource); >- delete eventSource; >- } >- >-public: >- Function<void()> m_function; >- WorkQueue* m_workQueue; >- GCancellable* m_cancellable; >-}; >- >-// WorkQueue >-static const size_t kVisualStudioThreadNameLimit = 31; >- >-void WorkQueue::platformInitialize(const char* name) >-{ >- m_eventContext = adoptGRef(g_main_context_new()); >- ASSERT(m_eventContext); >- m_eventLoop = adoptGRef(g_main_loop_new(m_eventContext.get(), FALSE)); >- ASSERT(m_eventLoop); >- >- // This name can be com.apple.WebKit.ProcessLauncher or com.apple.CoreIPC.ReceiveQueue. >- // We are using those names for the thread name, but both are longer than 31 characters, >- // which is the limit of Visual Studio for thread names. >- // When log is enabled createThread() will assert instead of truncate the name, so we need >- // to make sure we don't use a name longer than 31 characters. >- const char* threadName = g_strrstr(name, "."); >- if (threadName) >- threadName++; >- else >- threadName = name; >- if (strlen(threadName) > kVisualStudioThreadNameLimit) >- threadName += strlen(threadName) - kVisualStudioThreadNameLimit; >- >- m_workQueueThread = createThread(reinterpret_cast<WTF::ThreadFunction>(&WorkQueue::startWorkQueueThread), this, threadName); >-} >- >-void WorkQueue::platformInvalidate() >-{ >- MutexLocker locker(m_eventLoopLock); >- >- if (m_eventLoop) { >- if (g_main_loop_is_running(m_eventLoop.get())) >- g_main_loop_quit(m_eventLoop.get()); >- m_eventLoop.clear(); >- } >- >- m_eventContext.clear(); >-} >- >-void WorkQueue::startWorkQueueThread(WorkQueue* workQueue) >-{ >- workQueue->workQueueThreadBody(); >-} >- >-void WorkQueue::workQueueThreadBody() >-{ >- g_main_loop_run(m_eventLoop.get()); >-} >- >-void WorkQueue::registerEventSourceHandler(int fileDescriptor, int condition, const Function<void()>& function) >-{ >- GRefPtr<GSocket> socket = adoptGRef(g_socket_new_from_fd(fileDescriptor, 0)); >- ASSERT(socket); >- GRefPtr<GCancellable> cancellable = adoptGRef(g_cancellable_new()); >- GRefPtr<GSource> dispatchSource = adoptGRef(g_socket_create_source(socket.get(), static_cast<GIOCondition>(condition), cancellable.get())); >- ASSERT(dispatchSource); >- EventSource* eventSource = new EventSource(function, this, cancellable.get()); >- ASSERT(eventSource); >- >- g_source_set_callback(dispatchSource.get(), reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWork), >- eventSource, reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource)); >- >- // Set up the event sources under the mutex since this is shared across multiple threads. >- { >- MutexLocker locker(m_eventSourcesLock); >- Vector<EventSource*> sources; >- EventSourceIterator it = m_eventSources.find(fileDescriptor); >- if (it != m_eventSources.end()) >- sources = it->second; >- >- sources.append(eventSource); >- m_eventSources.set(fileDescriptor, sources); >- } >- >- g_source_attach(dispatchSource.get(), m_eventContext.get()); >-} >- >-void WorkQueue::unregisterEventSourceHandler(int fileDescriptor) >-{ >- ASSERT(fileDescriptor); >- >- MutexLocker locker(m_eventSourcesLock); >- >- EventSourceIterator it = m_eventSources.find(fileDescriptor); >- ASSERT(it != m_eventSources.end()); >- ASSERT(m_eventSources.contains(fileDescriptor)); >- >- if (it != m_eventSources.end()) { >- Vector<EventSource*> sources = it->second; >- for (unsigned i = 0; i < sources.size(); i++) >- sources[i]->cancel(); >- >- m_eventSources.remove(it); >- } >-} >- >-void WorkQueue::dispatchOnSource(GSource* dispatchSource, const Function<void()>& function, GSourceFunc sourceCallback) >-{ >- EventSource* eventSource = new EventSource(function, this, 0); >- >- g_source_set_callback(dispatchSource, sourceCallback, eventSource, >- reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource)); >- >- g_source_attach(dispatchSource, m_eventContext.get()); >-} >- >-void WorkQueue::dispatch(const Function<void()>& function) >-{ >- GRefPtr<GSource> dispatchSource = adoptGRef(g_idle_source_new()); >- ASSERT(dispatchSource); >- g_source_set_priority(dispatchSource.get(), G_PRIORITY_DEFAULT); >- >- dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce)); >-} >- >-void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >-{ >- GRefPtr<GSource> dispatchSource = adoptGRef(g_timeout_source_new(static_cast<guint>(delay * 1000))); >- ASSERT(dispatchSource); >- >- dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce)); >-} >- >-void WorkQueue::dispatchOnTermination(WebKit::PlatformProcessIdentifier process, const Function<void()>& function) >-{ >- GRefPtr<GSource> dispatchSource = adoptGRef(g_child_watch_source_new(process)); >- ASSERT(dispatchSource); >- >- dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnTermination)); >-} >diff --git a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp b/Source/WebKit2/Platform/mac/WorkQueueMac.cpp >deleted file mode 100644 >index ae473ee5cc84e58429b0439ccd921ac2c492ffaa..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/mac/WorkQueueMac.cpp >+++ /dev/null >@@ -1,178 +0,0 @@ >-/* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WorkQueue.h" >- >-#include <mach/mach_init.h> >-#include <mach/mach_port.h> >-#include <wtf/PassOwnPtr.h> >- >-void WorkQueue::executeFunction(void* context) >-{ >- WorkQueue* queue = static_cast<WorkQueue*>(dispatch_get_context(dispatch_get_current_queue())); >- OwnPtr<Function<void()> > function = adoptPtr(static_cast<Function<void()>*>(context)); >- >- { >- MutexLocker locker(queue->m_isValidMutex); >- if (!queue->m_isValid) >- return; >- } >- >- (*function)(); >-} >- >-void WorkQueue::dispatch(const Function<void()>& function) >-{ >- dispatch_async_f(m_dispatchQueue, new Function<void()>(function), executeFunction); >-} >- >-void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >-{ >- dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC); >- >- dispatch_after_f(delayTime, m_dispatchQueue, new Function<void()>(function), executeFunction); >-} >- >-class WorkQueue::EventSource { >-public: >- EventSource(MachPortEventType eventType, dispatch_source_t dispatchSource, const Function<void()>& function) >- : m_eventType(eventType) >- , m_dispatchSource(dispatchSource) >- , m_function(function) >- { >- } >- >- dispatch_source_t dispatchSource() const { return m_dispatchSource; } >- >- static void eventHandler(void* source) >- { >- EventSource* eventSource = static_cast<EventSource*>(source); >- >- eventSource->m_function(); >- } >- >- static void cancelHandler(void* source) >- { >- EventSource* eventSource = static_cast<EventSource*>(source); >- >- mach_port_t machPort = dispatch_source_get_handle(eventSource->m_dispatchSource); >- >- switch (eventSource->m_eventType) { >- case MachPortDataAvailable: >- // Release our receive right. >- mach_port_mod_refs(mach_task_self(), machPort, MACH_PORT_RIGHT_RECEIVE, -1); >- break; >- case MachPortDeadNameNotification: >- // Release our send right. >- mach_port_deallocate(mach_task_self(), machPort); >- break; >- } >- } >- >- static void finalizeHandler(void* source) >- { >- EventSource* eventSource = static_cast<EventSource*>(source); >- >- delete eventSource; >- } >- >-private: >- MachPortEventType m_eventType; >- >- // This is a weak reference, since m_dispatchSource references the event source. >- dispatch_source_t m_dispatchSource; >- >- Function<void()> m_function; >-}; >- >-void WorkQueue::registerMachPortEventHandler(mach_port_t machPort, MachPortEventType eventType, const Function<void()>& function) >-{ >- dispatch_source_type_t sourceType = 0; >- switch (eventType) { >- case MachPortDataAvailable: >- sourceType = DISPATCH_SOURCE_TYPE_MACH_RECV; >- break; >- case MachPortDeadNameNotification: >- sourceType = DISPATCH_SOURCE_TYPE_MACH_SEND; >- break; >- } >- >- dispatch_source_t dispatchSource = dispatch_source_create(sourceType, machPort, 0, m_dispatchQueue); >- >- EventSource* eventSource = new EventSource(eventType, dispatchSource, function); >- dispatch_set_context(dispatchSource, eventSource); >- >- dispatch_source_set_event_handler_f(dispatchSource, &EventSource::eventHandler); >- dispatch_source_set_cancel_handler_f(dispatchSource, &EventSource::cancelHandler); >- dispatch_set_finalizer_f(dispatchSource, &EventSource::finalizeHandler); >- >- // Add the source to our set of sources. >- { >- MutexLocker locker(m_eventSourcesMutex); >- >- ASSERT(!m_eventSources.contains(machPort)); >- >- m_eventSources.set(machPort, eventSource); >- >- // And start it! >- dispatch_resume(dispatchSource); >- } >-} >- >-void WorkQueue::unregisterMachPortEventHandler(mach_port_t machPort) >-{ >- ASSERT(machPort); >- >- MutexLocker locker(m_eventSourcesMutex); >- >- HashMap<mach_port_t, EventSource*>::iterator it = m_eventSources.find(machPort); >- ASSERT(it != m_eventSources.end()); >- >- ASSERT(m_eventSources.contains(machPort)); >- >- EventSource* eventSource = it->second; >- // Cancel and release the source. It will be deleted in its finalize handler. >- dispatch_source_cancel(eventSource->dispatchSource()); >- dispatch_release(eventSource->dispatchSource()); >- >- m_eventSources.remove(it); >-} >- >-void WorkQueue::platformInitialize(const char* name) >-{ >- m_dispatchQueue = dispatch_queue_create(name, 0); >- dispatch_set_context(m_dispatchQueue, this); >-} >- >-void WorkQueue::platformInvalidate() >-{ >-#if !ASSERT_DISABLED >- MutexLocker locker(m_eventSourcesMutex); >- ASSERT(m_eventSources.isEmpty()); >-#endif >- >- dispatch_release(m_dispatchQueue); >-} >diff --git a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp >deleted file mode 100644 >index aaa2be3d0b8b748529a288fee2d594fdb9e49926..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp >+++ /dev/null >@@ -1,130 +0,0 @@ >-/* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WorkQueue.h" >- >-#include <QLocalSocket> >-#include <QObject> >-#include <QThread> >-#include <QProcess> >-#include <WebCore/NotImplemented.h> >-#include <wtf/Threading.h> >- >-class WorkQueue::WorkItemQt : public QObject { >- Q_OBJECT >-public: >- WorkItemQt(WorkQueue* workQueue, const Function<void()>& function) >- : m_queue(workQueue) >- , m_source(0) >- , m_signal(0) >- , m_function(function) >- { >- } >- >- WorkItemQt(WorkQueue* workQueue, QObject* source, const char* signal, const Function<void()>& function) >- : m_queue(workQueue) >- , m_source(source) >- , m_signal(signal) >- , m_function(function) >- { >- connect(m_source, m_signal, SLOT(execute()), Qt::QueuedConnection); >- } >- >- ~WorkItemQt() >- { >- } >- >- Q_SLOT void execute() >- { >- if (m_queue->m_isValid) >- m_function(); >- } >- >- Q_SLOT void executeAndDelete() >- { >- execute(); >- delete this; >- } >- >- virtual void timerEvent(QTimerEvent*) >- { >- executeAndDelete(); >- } >- >- WorkQueue* m_queue; >- QObject* m_source; >- const char* m_signal; >- Function<void()> m_function; >-}; >- >-QSocketNotifier* WorkQueue::registerSocketEventHandler(int socketDescriptor, QSocketNotifier::Type type, const Function<void()>& function) >-{ >- ASSERT(m_workThread); >- >- QSocketNotifier* notifier = new QSocketNotifier(socketDescriptor, type, 0); >- notifier->setEnabled(false); >- notifier->moveToThread(m_workThread); >- WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, notifier, SIGNAL(activated(int)), function); >- itemQt->moveToThread(m_workThread); >- notifier->setEnabled(true); >- return notifier; >-} >- >-void WorkQueue::platformInitialize(const char*) >-{ >- m_workThread = new QThread(); >- m_workThread->start(); >-} >- >-void WorkQueue::platformInvalidate() >-{ >- m_workThread->exit(); >- m_workThread->wait(); >- delete m_workThread; >-} >- >-void WorkQueue::dispatch(const Function<void()>& function) >-{ >- WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, function); >- itemQt->moveToThread(m_workThread); >- QMetaObject::invokeMethod(itemQt, "executeAndDelete", Qt::QueuedConnection); >-} >- >-void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delayInSecond) >-{ >- WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, function); >- itemQt->startTimer(static_cast<int>(delayInSecond * 1000)); >- itemQt->moveToThread(m_workThread); >-} >- >-void WorkQueue::dispatchOnTermination(WebKit::PlatformProcessIdentifier process, const Function<void()>& function) >-{ >- WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, process, SIGNAL(finished(int, QProcess::ExitStatus)), function); >- itemQt->moveToThread(m_workThread); >-} >- >-#include "WorkQueueQt.moc" >diff --git a/Source/WebKit2/Platform/win/WorkQueueWin.cpp b/Source/WebKit2/Platform/win/WorkQueueWin.cpp >deleted file mode 100644 >index aabadbda895e07d9ee5330795cc94e617eb91d7b..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Platform/win/WorkQueueWin.cpp >+++ /dev/null >@@ -1,291 +0,0 @@ >-/* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WorkQueue.h" >- >-#include <WebCore/NotImplemented.h> >-#include <wtf/Threading.h> >- >-inline WorkQueue::WorkItemWin::WorkItemWin(const Function<void()>& function, WorkQueue* queue) >- : m_function(function) >- , m_queue(queue) >-{ >-} >- >-PassRefPtr<WorkQueue::WorkItemWin> WorkQueue::WorkItemWin::create(const Function<void()>& function, WorkQueue* queue) >-{ >- return adoptRef(new WorkItemWin(function, queue)); >-} >- >-WorkQueue::WorkItemWin::~WorkItemWin() >-{ >-} >- >-inline WorkQueue::HandleWorkItem::HandleWorkItem(HANDLE handle, const Function<void()>& function, WorkQueue* queue) >- : WorkItemWin(function, queue) >- , m_handle(handle) >- , m_waitHandle(0) >-{ >- ASSERT_ARG(handle, handle); >-} >- >-PassRefPtr<WorkQueue::HandleWorkItem> WorkQueue::HandleWorkItem::createByAdoptingHandle(HANDLE handle, const Function<void()>& function, WorkQueue* queue) >-{ >- return adoptRef(new HandleWorkItem(handle, function, queue)); >-} >- >-WorkQueue::HandleWorkItem::~HandleWorkItem() >-{ >- ::CloseHandle(m_handle); >-} >- >-void WorkQueue::handleCallback(void* context, BOOLEAN timerOrWaitFired) >-{ >- ASSERT_ARG(context, context); >- ASSERT_ARG(timerOrWaitFired, !timerOrWaitFired); >- >- WorkItemWin* item = static_cast<WorkItemWin*>(context); >- WorkQueue* queue = item->queue(); >- >- { >- MutexLocker lock(queue->m_workItemQueueLock); >- queue->m_workItemQueue.append(item); >- >- // If no other thread is performing work, we can do it on this thread. >- if (!queue->tryRegisterAsWorkThread()) { >- // Some other thread is performing work. Since we hold the queue lock, we can be sure >- // that the work thread is not exiting due to an empty queue and will process the work >- // item we just added to it. If we weren't holding the lock we'd have to signal >- // m_performWorkEvent to make sure the work item got picked up. >- return; >- } >- } >- >- queue->performWorkOnRegisteredWorkThread(); >-} >- >-void WorkQueue::registerHandle(HANDLE handle, const Function<void()>& function) >-{ >- RefPtr<HandleWorkItem> handleItem = HandleWorkItem::createByAdoptingHandle(handle, function, this); >- >- { >- MutexLocker lock(m_handlesLock); >- ASSERT_ARG(handle, !m_handles.contains(handle)); >- m_handles.set(handle, handleItem); >- } >- >- HANDLE waitHandle; >- if (!::RegisterWaitForSingleObject(&waitHandle, handle, handleCallback, handleItem.get(), INFINITE, WT_EXECUTEDEFAULT)) { >- DWORD error = ::GetLastError(); >- ASSERT_NOT_REACHED(); >- } >- handleItem->setWaitHandle(waitHandle); >-} >- >-void WorkQueue::unregisterAndCloseHandle(HANDLE handle) >-{ >- RefPtr<HandleWorkItem> item; >- { >- MutexLocker locker(m_handlesLock); >- ASSERT_ARG(handle, m_handles.contains(handle)); >- item = m_handles.take(handle); >- } >- >- unregisterWaitAndDestroyItemSoon(item.release()); >-} >- >-DWORD WorkQueue::workThreadCallback(void* context) >-{ >- ASSERT_ARG(context, context); >- >- WorkQueue* queue = static_cast<WorkQueue*>(context); >- >- if (!queue->tryRegisterAsWorkThread()) >- return 0; >- >- queue->performWorkOnRegisteredWorkThread(); >- return 0; >-} >- >-void WorkQueue::performWorkOnRegisteredWorkThread() >-{ >- ASSERT(m_isWorkThreadRegistered); >- >- bool isValid = true; >- >- m_workItemQueueLock.lock(); >- >- while (isValid && !m_workItemQueue.isEmpty()) { >- Vector<RefPtr<WorkItemWin> > workItemQueue; >- m_workItemQueue.swap(workItemQueue); >- >- // Allow more work to be scheduled while we're not using the queue directly. >- m_workItemQueueLock.unlock(); >- for (size_t i = 0; i < workItemQueue.size(); ++i) { >- MutexLocker locker(m_isValidMutex); >- isValid = m_isValid; >- if (!isValid) >- break; >- workItemQueue[i]->function()(); >- } >- m_workItemQueueLock.lock(); >- } >- >- // One invariant we maintain is that any work scheduled while a work thread is registered will >- // be handled by that work thread. Unregister as the work thread while the queue lock is still >- // held so that no work can be scheduled while we're still registered. >- unregisterAsWorkThread(); >- >- m_workItemQueueLock.unlock(); >-} >- >-void WorkQueue::platformInitialize(const char* name) >-{ >- m_isWorkThreadRegistered = 0; >- m_timerQueue = ::CreateTimerQueue(); >- ASSERT_WITH_MESSAGE(m_timerQueue, "::CreateTimerQueue failed with error %lu", ::GetLastError()); >-} >- >-bool WorkQueue::tryRegisterAsWorkThread() >-{ >- LONG result = ::InterlockedCompareExchange(&m_isWorkThreadRegistered, 1, 0); >- ASSERT(!result || result == 1); >- return !result; >-} >- >-void WorkQueue::unregisterAsWorkThread() >-{ >- LONG result = ::InterlockedCompareExchange(&m_isWorkThreadRegistered, 0, 1); >- ASSERT_UNUSED(result, result == 1); >-} >- >-void WorkQueue::platformInvalidate() >-{ >-#if !ASSERT_DISABLED >- MutexLocker lock(m_handlesLock); >- ASSERT(m_handles.isEmpty()); >-#endif >- >- // FIXME: We need to ensure that any timer-queue timers that fire after this point don't try to >- // access this WorkQueue <http://webkit.org/b/44690>. >- ::DeleteTimerQueueEx(m_timerQueue, 0); >-} >- >-void WorkQueue::dispatch(const Function<void()>& function) >-{ >- MutexLocker locker(m_workItemQueueLock); >- >- m_workItemQueue.append(WorkItemWin::create(function, this)); >- >- // Spawn a work thread to perform the work we just added. As an optimization, we avoid >- // spawning the thread if a work thread is already registered. This prevents multiple work >- // threads from being spawned in most cases. (Note that when a work thread has been spawned but >- // hasn't registered itself yet, m_isWorkThreadRegistered will be false and we'll end up >- // spawning a second work thread here. But work thread registration process will ensure that >- // only one thread actually ends up performing work.) >- if (!m_isWorkThreadRegistered) >- ::QueueUserWorkItem(workThreadCallback, this, WT_EXECUTEDEFAULT); >-} >- >-struct TimerContext : public ThreadSafeRefCounted<TimerContext> { >- static PassRefPtr<TimerContext> create() { return adoptRef(new TimerContext); } >- >- WorkQueue* queue; >- Function<void()> function; >- Mutex timerMutex; >- HANDLE timer; >- >-private: >- TimerContext() : queue(0), timer(0) { } >-}; >- >-void WorkQueue::timerCallback(void* context, BOOLEAN timerOrWaitFired) >-{ >- ASSERT_ARG(context, context); >- ASSERT_UNUSED(timerOrWaitFired, timerOrWaitFired); >- >- // Balanced by leakRef in scheduleWorkAfterDelay. >- RefPtr<TimerContext> timerContext = adoptRef(static_cast<TimerContext*>(context)); >- >- timerContext->queue->dispatch(timerContext->function); >- >- MutexLocker lock(timerContext->timerMutex); >- ASSERT(timerContext->timer); >- ASSERT(timerContext->queue->m_timerQueue); >- if (!::DeleteTimerQueueTimer(timerContext->queue->m_timerQueue, timerContext->timer, 0)) >- ASSERT_WITH_MESSAGE(false, "::DeleteTimerQueueTimer failed with error %lu", ::GetLastError()); >-} >- >-void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay) >-{ >- ASSERT(m_timerQueue); >- >- RefPtr<TimerContext> context = TimerContext::create(); >- context->queue = this; >- context->function = function; >- >- { >- // The timer callback could fire before ::CreateTimerQueueTimer even returns, so we protect >- // context->timer with a mutex to ensure the timer callback doesn't access it before the >- // timer handle has been stored in it. >- MutexLocker lock(context->timerMutex); >- >- // Since our timer callback is quick, we can execute in the timer thread itself and avoid >- // an extra thread switch over to a worker thread. >- if (!::CreateTimerQueueTimer(&context->timer, m_timerQueue, timerCallback, context.get(), delay * 1000, 0, WT_EXECUTEINTIMERTHREAD)) { >- ASSERT_WITH_MESSAGE(false, "::CreateTimerQueueTimer failed with error %lu", ::GetLastError()); >- return; >- } >- } >- >- // The timer callback will handle destroying context. >- context.release().leakRef(); >-} >- >-void WorkQueue::unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem> item) >-{ >- // We're going to make a blocking call to ::UnregisterWaitEx before closing the handle. (The >- // blocking version of ::UnregisterWaitEx is much simpler than the non-blocking version.) If we >- // do this on the current thread, we'll deadlock if we're currently in a callback function for >- // the wait we're unregistering. So instead we do it asynchronously on some other worker thread. >- >- ::QueueUserWorkItem(unregisterWaitAndDestroyItemCallback, item.leakRef(), WT_EXECUTEDEFAULT); >-} >- >-DWORD WINAPI WorkQueue::unregisterWaitAndDestroyItemCallback(void* context) >-{ >- ASSERT_ARG(context, context); >- RefPtr<HandleWorkItem> item = adoptRef(static_cast<HandleWorkItem*>(context)); >- >- // Now that we know we're not in a callback function for the wait we're unregistering, we can >- // make a blocking call to ::UnregisterWaitEx. >- if (!::UnregisterWaitEx(item->waitHandle(), INVALID_HANDLE_VALUE)) { >- DWORD error = ::GetLastError(); >- ASSERT_NOT_REACHED(); >- } >- >- return 0; >-} >diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake >index 7d06184c1bb9ddeb6a75eee23ec75c7b97c8abd5..f9b336332c5d13d70f446ba892702872f0b5b291 100644 >--- a/Source/WebKit2/PlatformEfl.cmake >+++ b/Source/WebKit2/PlatformEfl.cmake >@@ -8,7 +8,6 @@ LIST(APPEND WebKit2_LINK_FLAGS > > LIST(APPEND WebKit2_SOURCES > Platform/efl/ModuleEfl.cpp >- Platform/efl/WorkQueueEfl.cpp > Platform/unix/SharedMemoryUnix.cpp > > Platform/CoreIPC/unix/ConnectionUnix.cpp >diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri >index 2ca8c2e0310e9d089aaface5fbfbd3a655f906e5..f146e993d52aae80279f1fdb14af439a7653b866 100644 >--- a/Source/WebKit2/Target.pri >+++ b/Source/WebKit2/Target.pri >@@ -30,9 +30,7 @@ HEADERS += \ > Platform/CoreIPC/MessageSender.h \ > Platform/Logging.h \ > Platform/Module.h \ >- Platform/PlatformProcessIdentifier.h \ > Platform/SharedMemory.h \ >- Platform/WorkQueue.h \ > PluginProcess/PluginControllerProxy.h \ > PluginProcess/PluginCreationParameters.h \ > PluginProcess/PluginProcess.h \ >@@ -406,7 +404,6 @@ SOURCES += \ > Platform/CoreIPC/DataReference.cpp \ > Platform/Logging.cpp \ > Platform/Module.cpp \ >- Platform/WorkQueue.cpp \ > Platform/qt/LoggingQt.cpp \ > Platform/qt/ModuleQt.cpp \ > PluginProcess/PluginControllerProxy.cpp \ >@@ -813,14 +810,12 @@ mac: { > SOURCES += \ > Platform/CoreIPC/mac/ConnectionMac.cpp \ > Platform/mac/MachUtilities.cpp \ >- Platform/mac/WorkQueueMac.cpp \ > Platform/mac/SharedMemoryMac.cpp > > } else { > SOURCES += \ > Platform/CoreIPC/unix/AttachmentUnix.cpp \ > Platform/CoreIPC/unix/ConnectionUnix.cpp \ >- Platform/qt/WorkQueueQt.cpp \ > Platform/unix/SharedMemoryUnix.cpp > } > >diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp >index ba22dda2da7bc5b48d335869afa380c7bb36829e..67def76821fa0b50dafe9b9ce5168c5efd980334 100644 >--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp >+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp >@@ -26,8 +26,8 @@ > #include "config.h" > #include "ProcessLauncher.h" > >-#include "WorkQueue.h" > #include <wtf/StdLibExtras.h> >+#include <wtf/WorkQueue.h> > > namespace WebKit { > >diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h >index bc1f867f3c2915523630c67611f05ce973ded53b..d61bd79dbdb0c18762d1f2700167cae3aed8f931 100644 >--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h >+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h >@@ -27,7 +27,7 @@ > #define WebProcessLauncher_h > > #include "Connection.h" >-#include "PlatformProcessIdentifier.h" >+#include <wtf/PlatformProcessIdentifier.h> > #include <wtf/RefPtr.h> > #include <wtf/Threading.h> > >diff --git a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h >index f3a5312a2c4f77ebf20fd2c48966f35acb0ad8d1..9c6b12496f0e356bee2ab5d685953e6d16aad2bc 100644 >--- a/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h >+++ b/Source/WebKit2/UIProcess/Launcher/ThreadLauncher.h >@@ -27,7 +27,7 @@ > #define ThreadLauncher_h > > #include "Connection.h" >-#include "PlatformProcessIdentifier.h" >+#include <wtf/PlatformProcessIdentifier.h> > #include <wtf/RefPtr.h> > #include <wtf/Threading.h> > >diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h >index 57ab86c24293b1ad2222412eb58e9a9f56c8c548..0e95be54b7a1aeea50043bcf7543cf1b17362591 100644 >--- a/Source/WebKit2/UIProcess/WebPageProxy.h >+++ b/Source/WebKit2/UIProcess/WebPageProxy.h >@@ -40,7 +40,6 @@ > #endif > #include "LayerTreeContext.h" > #include "NotificationPermissionRequestManagerProxy.h" >-#include "PlatformProcessIdentifier.h" > #include "SandboxExtension.h" > #include "ShareableBitmap.h" > #include "WKBase.h" >@@ -73,6 +72,7 @@ > #include <wtf/OwnPtr.h> > #include <wtf/PassOwnPtr.h> > #include <wtf/PassRefPtr.h> >+#include <wtf/PlatformProcessIdentifier.h> > #include <wtf/RefPtr.h> > #include <wtf/Vector.h> > #include <wtf/text/WTFString.h> >diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h >index 8e768bfb6a889d9ad6b360007694b25676cea686..6419a7a3538c61fe8d4579c306d234b655ddc122 100644 >--- a/Source/WebKit2/UIProcess/WebProcessProxy.h >+++ b/Source/WebKit2/UIProcess/WebProcessProxy.h >@@ -26,7 +26,6 @@ > #ifndef WebProcessProxy_h > #define WebProcessProxy_h > >-#include "PlatformProcessIdentifier.h" > #include "PluginInfoStore.h" > #include "ProcessLauncher.h" > #include "ProcessModel.h" >@@ -39,6 +38,7 @@ > #include <wtf/Forward.h> > #include <wtf/HashMap.h> > #include <wtf/PassRefPtr.h> >+#include <wtf/PlatformProcessIdentifier.h> > #include <wtf/RefCounted.h> > > namespace WebCore { >diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj >index 6077f6d3e38a45101238b542378cc287e04dbaf0..ead478a6840844f2aead3f66403faa2191cc0b00 100644 >--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj >+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj >@@ -476,7 +476,6 @@ > B63403F914910D57001070B5 /* APIObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B63403F814910D57001070B5 /* APIObject.cpp */; }; > B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */ = {isa = PBXBuildFile; fileRef = B878B613133428DC006888E9 /* CorrectionPanel.h */; }; > B878B616133428DC006888E9 /* CorrectionPanel.mm in Sources */ = {isa = PBXBuildFile; fileRef = B878B614133428DC006888E9 /* CorrectionPanel.mm */; }; >- BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */; }; > BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6010F4378D0058C15A /* WebChromeClient.h */; }; > BC032D7710F4378D0058C15A /* WebContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6210F4378D0058C15A /* WebContextMenuClient.h */; }; > BC032D7B10F4378D0058C15A /* WebDragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC032D6610F4378D0058C15A /* WebDragClient.h */; }; >@@ -569,8 +568,6 @@ > BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */; }; > BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; > BC2DFBA312A761A500E732A3 /* WebPreferencesCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */; }; >- BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */; }; >- BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7E1141970C00A63B1E /* WorkQueue.h */; }; > BC3065C412592F8900E71278 /* WebProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3065C312592F8900E71278 /* WebProcessMac.mm */; }; > BC3065FA1259344E00E71278 /* CacheModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3065F91259344E00E71278 /* CacheModel.h */; }; > BC3066BE125A442100E71278 /* WebProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3066BC125A442100E71278 /* WebProcessMessageReceiver.cpp */; }; >@@ -1514,7 +1511,6 @@ > B63403F814910D57001070B5 /* APIObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIObject.cpp; sourceTree = "<group>"; }; > B878B613133428DC006888E9 /* CorrectionPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorrectionPanel.h; sourceTree = "<group>"; }; > B878B614133428DC006888E9 /* CorrectionPanel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CorrectionPanel.mm; sourceTree = "<group>"; }; >- BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueMac.cpp; sourceTree = "<group>"; }; > BC032D6010F4378D0058C15A /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; }; > BC032D6210F4378D0058C15A /* WebContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuClient.h; sourceTree = "<group>"; }; > BC032D6610F4378D0058C15A /* WebDragClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDragClient.h; sourceTree = "<group>"; }; >@@ -1613,8 +1609,6 @@ > BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SameDocumentNavigationType.h; sourceTree = "<group>"; }; > BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypes.h; sourceTree = "<group>"; }; > BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreferencesCF.cpp; path = cf/WebPreferencesCF.cpp; sourceTree = "<group>"; }; >- BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; }; >- BC2E6E7E1141970C00A63B1E /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; }; > BC3065C312592F8900E71278 /* WebProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessMac.mm; sourceTree = "<group>"; }; > BC3065F91259344E00E71278 /* CacheModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheModel.h; sourceTree = "<group>"; }; > BC3066B9125A436300E71278 /* WebProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcess.messages.in; sourceTree = "<group>"; }; >@@ -2298,7 +2292,6 @@ > 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */, > 296BD85B15019BC30071F424 /* StringUtilities.h */, > 296BD85C15019BC30071F424 /* StringUtilities.mm */, >- BC0092F6115837A300E0AE2A /* WorkQueueMac.cpp */, > ); > path = mac; > sourceTree = "<group>"; >@@ -3336,8 +3329,6 @@ > C0E3AA441209E2BA00A49D01 /* Module.h */, > BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */, > 1A24BED3120894D100FBB059 /* SharedMemory.h */, >- BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */, >- BC2E6E7E1141970C00A63B1E /* WorkQueue.h */, > ); > path = Platform; > sourceTree = "<group>"; >@@ -4189,7 +4180,6 @@ > BC8699B5116AADAA002A925B /* WKView.h in Headers */, > BC8699B7116AADAA002A925B /* WKViewInternal.h in Headers */, > BFA6179F12F0B99D0033E0CA /* WKViewPrivate.h in Headers */, >- BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */, > E17BF99614D0A73E00A5A069 /* NetscapeSandboxFunctions.h in Headers */, > BCE0937814FB128C001138D9 /* LayerHostingContext.h in Headers */, > 296BD85D15019BC30071F424 /* StringUtilities.h in Headers */, >@@ -4936,8 +4926,6 @@ > BC40762C124FF0400068F20A /* WKURLResponseNS.mm in Sources */, > F6113E28126CE19B0057D0A7 /* WKUserContentURLPattern.cpp in Sources */, > BC8699B6116AADAA002A925B /* WKView.mm in Sources */, >- BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */, >- BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */, > E17BF99814D0AA8300A5A069 /* NetscapeSandboxFunctions.mm in Sources */, > BCE0937714FB128C001138D9 /* LayerHostingContext.mm in Sources */, > 296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 90780
:
151238
|
151240
|
151241
|
151242
|
151627
|
151643
|
154508