Title: [137580] trunk/Source/WebCore
Revision
137580
Author
[email protected]
Date
2012-12-13 03:00:12 -0800 (Thu, 13 Dec 2012)

Log Message

[EFL] Remove redundant pipe write to prevent pipe buffer full.
https://bugs.webkit.org/show_bug.cgi?id=101135

Patch by Byungwoo Lee <[email protected]> on 2012-12-13
Reviewed by Gyuyoung Kim.

To prevent a source of a deadlock, remove the redundant pipe write
in wakeUp() function.

EFL uses ecore_pipe_write() to wake up main run loop, and the function
uses POSIX pipe write with O_NONBLOCK disabled.
With O_NONBLOCK disabled, when written data is more than PIPE_BUF,
pipe write will be blocked until it can be written.

Currently, every wakeUp() function calls ecore_pipe_write() to invoke
wakeUpEvent() callback. And this can make pipe buffer full status
which is the one reason of the lockup problem described in Bug 99494.

* platform/RunLoop.h:
(RunLoop):
* platform/efl/RunLoopEfl.cpp:
(WebCore::RunLoop::RunLoop):
(WebCore::RunLoop::wakeUpEvent):
(WebCore::RunLoop::wakeUp):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137579 => 137580)


--- trunk/Source/WebCore/ChangeLog	2012-12-13 10:56:09 UTC (rev 137579)
+++ trunk/Source/WebCore/ChangeLog	2012-12-13 11:00:12 UTC (rev 137580)
@@ -1,3 +1,29 @@
+2012-12-13  Byungwoo Lee  <[email protected]>
+
+        [EFL] Remove redundant pipe write to prevent pipe buffer full.
+        https://bugs.webkit.org/show_bug.cgi?id=101135
+
+        Reviewed by Gyuyoung Kim.
+
+        To prevent a source of a deadlock, remove the redundant pipe write
+        in wakeUp() function.
+
+        EFL uses ecore_pipe_write() to wake up main run loop, and the function
+        uses POSIX pipe write with O_NONBLOCK disabled.
+        With O_NONBLOCK disabled, when written data is more than PIPE_BUF,
+        pipe write will be blocked until it can be written.
+
+        Currently, every wakeUp() function calls ecore_pipe_write() to invoke
+        wakeUpEvent() callback. And this can make pipe buffer full status
+        which is the one reason of the lockup problem described in Bug 99494.
+
+        * platform/RunLoop.h:
+        (RunLoop):
+        * platform/efl/RunLoopEfl.cpp:
+        (WebCore::RunLoop::RunLoop):
+        (WebCore::RunLoop::wakeUpEvent):
+        (WebCore::RunLoop::wakeUp):
+
 2012-12-13  Antti Harju  <[email protected]>
 
         [Qt] Fix deleteAllCookies() invalid SQL statement

Modified: trunk/Source/WebCore/platform/RunLoop.h (137579 => 137580)


--- trunk/Source/WebCore/platform/RunLoop.h	2012-12-13 10:56:09 UTC (rev 137579)
+++ trunk/Source/WebCore/platform/RunLoop.h	2012-12-13 11:00:12 UTC (rev 137580)
@@ -171,6 +171,9 @@
     Mutex m_pipeLock;
     OwnPtr<Ecore_Pipe> m_pipe;
 
+    Mutex m_wakeUpEventRequestedLock;
+    bool m_wakeUpEventRequested;
+
     static void wakeUpEvent(void* data, void*, unsigned int);
 #endif
 };

Modified: trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp (137579 => 137580)


--- trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp	2012-12-13 10:56:09 UTC (rev 137579)
+++ trunk/Source/WebCore/platform/efl/RunLoopEfl.cpp	2012-12-13 11:00:12 UTC (rev 137580)
@@ -41,6 +41,7 @@
 
 RunLoop::RunLoop()
     : m_initEfl(false)
+    , m_wakeUpEventRequested(false)
 {
     if (!ecore_init()) {
         LOG_ERROR("could not init ecore.");
@@ -97,13 +98,29 @@
 
 void RunLoop::wakeUpEvent(void* data, void*, unsigned int)
 {
-    static_cast<RunLoop*>(data)->performWork();
+    RunLoop* loop = static_cast<RunLoop*>(data);
+
+    {
+        MutexLocker locker(loop->m_wakeUpEventRequestedLock);
+        loop->m_wakeUpEventRequested = false;
+    }
+
+    loop->performWork();
 }
 
 void RunLoop::wakeUp()
 {
-    MutexLocker locker(m_pipeLock);
-    ecore_pipe_write(m_pipe.get(), wakupEcorePipeMessage, ecorePipeMessageSize);
+    {
+        MutexLocker locker(m_wakeUpEventRequestedLock);
+        if (m_wakeUpEventRequested)
+            return;
+        m_wakeUpEventRequested = true;
+    }
+
+    {
+        MutexLocker locker(m_pipeLock);
+        ecore_pipe_write(m_pipe.get(), wakupEcorePipeMessage, ecorePipeMessageSize);
+    }
 }
 
 RunLoop::TimerBase::TimerBase(RunLoop*)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to