[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 13:11:42 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 38e1d097a756dd3e58cc80c85d768d379176ab8f
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 8 19:20:17 2010 +0000
Get rid of WorkQueue::m_performWorkEvent
We were signaling m_performWorkEvent to spawn a worker thread. We can
use ::QueueUserWorkItem to spawn the thread instead.
Fixes <http://webkit.org/b/45407> WorkQueue::m_performWorkEvent is
unnecessary
Reviewed by Anders Carlsson.
* Platform/WorkQueue.h: Removed m_performWorkEvent.
* Platform/win/WorkQueueWin.cpp:
(WorkQueue::workThreadCallback): Replaced eventCallback with this
function. Its functionality is unchanged.
(WorkQueue::platformInitialize):
(WorkQueue::platformInvalidate):
Removed code to set up and clean up m_performWorkEvent.
(WorkQueue::scheduleWork): Use ::QueueUserWorkItem instead of
signaling m_performWorkEvent to spawn a worker thread.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index bf0e773..e436344 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,30 @@
2010-09-08 Adam Roben <aroben at apple.com>
+ Get rid of WorkQueue::m_performWorkEvent
+
+ We were signaling m_performWorkEvent to spawn a worker thread. We can
+ use ::QueueUserWorkItem to spawn the thread instead.
+
+ Fixes <http://webkit.org/b/45407> WorkQueue::m_performWorkEvent is
+ unnecessary
+
+ Reviewed by Anders Carlsson.
+
+ * Platform/WorkQueue.h: Removed m_performWorkEvent.
+
+ * Platform/win/WorkQueueWin.cpp:
+ (WorkQueue::workThreadCallback): Replaced eventCallback with this
+ function. Its functionality is unchanged.
+
+ (WorkQueue::platformInitialize):
+ (WorkQueue::platformInvalidate):
+ Removed code to set up and clean up m_performWorkEvent.
+
+ (WorkQueue::scheduleWork): Use ::QueueUserWorkItem instead of
+ signaling m_performWorkEvent to spawn a worker thread.
+
+2010-09-08 Adam Roben <aroben at apple.com>
+
Fix WebKit2Common.vsprops line-endings
* win/WebKit2Common.vsprops: Made all line-endings be CRLF, as this is
diff --git a/WebKit2/Platform/WorkQueue.h b/WebKit2/Platform/WorkQueue.h
index 499434b..364eed7 100644
--- a/WebKit2/Platform/WorkQueue.h
+++ b/WebKit2/Platform/WorkQueue.h
@@ -108,14 +108,12 @@ private:
};
static void CALLBACK handleCallback(void* context, BOOLEAN timerOrWaitFired);
- static void CALLBACK eventCallback(void* context, BOOLEAN timerOrWaitFired);
+ static DWORD WINAPI workThreadCallback(void* context);
bool tryRegisterAsWorkThread();
void unregisterAsWorkThread();
void performWorkOnRegisteredWorkThread();
- HANDLE m_performWorkEvent;
-
volatile LONG m_isWorkThreadRegistered;
Mutex m_workItemQueueLock;
diff --git a/WebKit2/Platform/win/WorkQueueWin.cpp b/WebKit2/Platform/win/WorkQueueWin.cpp
index 284d7ba..9fbe641 100644
--- a/WebKit2/Platform/win/WorkQueueWin.cpp
+++ b/WebKit2/Platform/win/WorkQueueWin.cpp
@@ -81,17 +81,17 @@ void WorkQueue::registerHandle(HANDLE handle, PassOwnPtr<WorkItem> item)
}
}
-void WorkQueue::eventCallback(void* context, BOOLEAN timerOrWaitFired)
+DWORD WorkQueue::workThreadCallback(void* context)
{
ASSERT_ARG(context, context);
- ASSERT_ARG(timerOrWaitFired, !timerOrWaitFired);
WorkQueue* queue = static_cast<WorkQueue*>(context);
if (!queue->tryRegisterAsWorkThread())
- return;
+ return 0;
queue->performWorkOnRegisteredWorkThread();
+ return 0;
}
void WorkQueue::performWorkOnRegisteredWorkThread()
@@ -129,16 +129,6 @@ void WorkQueue::performWorkOnRegisteredWorkThread()
void WorkQueue::platformInitialize(const char* name)
{
m_isWorkThreadRegistered = 0;
-
- // Create our event.
- m_performWorkEvent = ::CreateEventW(0, FALSE, FALSE, 0);
-
- // FIXME: We need to hold onto waitHandle so that we can unregister the wait later.
- HANDLE waitHandle;
- if (!::RegisterWaitForSingleObject(&waitHandle, m_performWorkEvent, eventCallback, this, INFINITE, WT_EXECUTEDEFAULT)) {
- DWORD error = ::GetLastError();
- ASSERT_NOT_REACHED();
- }
}
bool WorkQueue::tryRegisterAsWorkThread()
@@ -156,8 +146,6 @@ void WorkQueue::unregisterAsWorkThread()
void WorkQueue::platformInvalidate()
{
- ::CloseHandle(m_performWorkEvent);
-
// FIXME: Stop the thread and do other cleanup.
}
@@ -167,12 +155,12 @@ void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item)
m_workItemQueue.append(WorkItemWin::create(item, this));
- // Signal our event so that work thread will perform the work we just added. As an optimization,
- // we avoid signaling the event 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
+ // 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)
- ::SetEvent(m_performWorkEvent);
+ ::QueueUserWorkItem(workThreadCallback, this, WT_EXECUTEDEFAULT);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list