[WK2] callOnMainThread() from main thread sometimes results in ASSERTs.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jan 2014 21:16:50 +0000 (21:16 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jan 2014 21:16:50 +0000 (21:16 +0000)
commit35dc40ee3225580dc26ccc90b0aca68b53a8f727
tree9d594f9c823579f48fd93e67989308da60b8689a
parentee06ae1729c5ab57a59006633a460c6cee1e8351
[WK2] callOnMainThread() from main thread sometimes results in ASSERTs.
https://bugs.webkit.org/show_bug.cgi?id=127370

Reviewed by Alexey Proskuryakov.

When WEB_THREAD is enabled, and callOnMainThread() is called from the main
thread, if the web thread is locked, a timer is set and the passed-in function
is called on the next run-loop. However, by that time the web thread may have
been unlocked, and isMainThread() will no longer return true, resulting in
an assert.

Instead, scheduleDispatchFunctionsOnMainThread() should check isWebThread(),
which is equivalent to isMainThread() when the WEB_THREAD is disabled, but
will do the correct thing when WEB_THREAD is enabled.

* wtf/mac/MainThreadMac.mm:
(WTF::scheduleDispatchFunctionsOnMainThread):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162862 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/mac/MainThreadMac.mm