RESOLVED FIXED167953
Initialize the main RunLoop in iOS WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=167953
Summary Initialize the main RunLoop in iOS WebKitLegacy
Joseph Pecoraro
Reported 2017-02-07 13:19:47 PST
Initialize the main RunLoop in iOS WebKitLegacy in WebKitInitialize. Most API entry points initialize the main runloop on mac, but iOS ignores them. Do it here along with the other initialization.
Attachments
[PATCH] Proposed Fix (1.37 KB, patch)
2017-02-07 13:29 PST, Joseph Pecoraro
joepeck: review-
[PATCH] Proposed Fix (1.40 KB, patch)
2017-02-07 14:10 PST, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2017-02-07 13:28:44 PST
While this is under WebKitInitialize it is not inside it. Retitling.
Joseph Pecoraro
Comment 2 2017-02-07 13:29:49 PST
Created attachment 300843 [details] [PATCH] Proposed Fix
Alexey Proskuryakov
Comment 3 2017-02-07 13:42:32 PST
Comment on attachment 300843 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=300843&action=review > Source/WebCore/platform/ios/wak/WebCoreThread.mm:655 > + RunLoop::initializeMainRunLoop(); Will RunLoop be confused because its initialization happens on the web thread, not the main one?
Joseph Pecoraro
Comment 4 2017-02-07 13:50:32 PST
Comment on attachment 300843 [details] [PATCH] Proposed Fix I believe you are correct. What concerns me is that there is an ASSERT(pthread_main_np()) that I added that doesn't fire, so now I'm rather confused.
Joseph Pecoraro
Comment 5 2017-02-07 14:09:34 PST
I found my problem. I added the ASSERT in WTF and built WTF and WebCore but didn't build JavaScriptCore. So my assertion didn't actually materialize. Thanks for the careful review
Joseph Pecoraro
Comment 6 2017-02-07 14:10:19 PST
Created attachment 300851 [details] [PATCH] Proposed Fix
Alexey Proskuryakov
Comment 7 2017-02-07 15:09:08 PST
Comment on attachment 300851 [details] [PATCH] Proposed Fix r=me, however I have another thought about this. Since apparently nothing uses the runloop with iOS WK1, wouldn't it be better to leave it uninitialized for a clear failure to occur if someone tries to use it? As we initialize it to the actual main thread, it may become more likely that WebCore code will schedule something to run on this thread, which is a bad bad idea.
Alexey Proskuryakov
Comment 8 2017-02-07 15:09:43 PST
I suggest double checking with Anders about what he thinks.
Joseph Pecoraro
Comment 9 2017-02-07 16:12:20 PST
(In reply to comment #7) > Comment on attachment 300851 [details] > [PATCH] Proposed Fix > > r=me, however I have another thought about this. Since apparently nothing > uses the runloop with iOS WK1, wouldn't it be better to leave it > uninitialized for a clear failure to occur if someone tries to use it? > > As we initialize it to the actual main thread, it may become more likely > that WebCore code will schedule something to run on this thread, which is a > bad bad idea. There are already a few places in WebCore that use RunLoop::main, but as you point out in iOS WebKit1 they may want to be using the WebThread.
Alexey Proskuryakov
Comment 10 2017-02-07 17:00:25 PST
Maybe we should assert when trying to use an uninitialized RunLoop instead.
Joseph Pecoraro
Comment 11 2017-02-08 11:37:36 PST
> There are already a few places in WebCore that use RunLoop::main, but as you > point out in iOS WebKit1 they may want to be using the WebThread. Filed Bug 168008.
Joseph Pecoraro
Comment 12 2017-02-08 11:38:18 PST
(In reply to comment #10) > Maybe we should assert when trying to use an uninitialized RunLoop instead. That is the assert that is already firing in a few TestAPI Tests in iso-simulator already.
WebKit Commit Bot
Comment 13 2017-02-08 12:05:35 PST
Comment on attachment 300851 [details] [PATCH] Proposed Fix Clearing flags on attachment: 300851 Committed r211890: <http://trac.webkit.org/changeset/211890>
WebKit Commit Bot
Comment 14 2017-02-08 12:05:39 PST
All reviewed patches have been landed. Closing bug.
Alexey Proskuryakov
Comment 15 2017-02-08 12:07:58 PST
> > Maybe we should assert when trying to use an uninitialized RunLoop instead. > That is the assert that is already firing in a few TestAPI Tests in iso-simulator already. I'm confused. Does this landed change mean that it won't fire any more?
Joseph Pecoraro
Comment 16 2017-02-08 14:39:02 PST
(In reply to comment #15) > > > Maybe we should assert when trying to use an uninitialized RunLoop instead. > > > That is the assert that is already firing in a few TestAPI Tests in iso-simulator already. > > I'm confused. Does this landed change mean that it won't fire any more? Correct this fixes those assertions by ensuring we initialize on iOS.
Note You need to log in before you can comment on or make changes to this bug.