RESOLVED FIXED Bug 209254
Delay calling 'notifyThisWebProcessPoolWasCreated' until constructor finishes
https://bugs.webkit.org/show_bug.cgi?id=209254
Summary Delay calling 'notifyThisWebProcessPoolWasCreated' until constructor finishes
Brent Fulgham
Reported 2020-03-18 16:11:23 PDT
The constructor for WebProcessPool calls a method 'notifyThisWebProcessPoolWasCreated', which calls a set of functions registered by observers interested in knowing that the pool was constructed. However, since this call is made during the construction of the object, code that attempts to do things like Ref<> the WebProcessPool do so with a partially-constructed object. Instead, we should enqueue the notification call so that it fires on the next spin of the runloop, after the current object is finished being constructed.
Attachments
Patch (1.60 KB, patch)
2020-03-18 16:31 PDT, Brent Fulgham
no flags
Patch for landing (1.61 KB, patch)
2020-03-18 16:58 PDT, Brent Fulgham
no flags
Patch for landing (1.63 KB, patch)
2020-03-18 17:04 PDT, Brent Fulgham
no flags
Brent Fulgham
Comment 1 2020-03-18 16:15:46 PDT
Brent Fulgham
Comment 2 2020-03-18 16:31:12 PDT
Chris Dumez
Comment 3 2020-03-18 16:43:00 PDT
Comment on attachment 393914 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393914&action=review I think this is likely fine. I have added Brady in cc though because I think he added this code. > Source/WebKit/UIProcess/WebProcessPool.cpp:309 > + ASSERT(isMainThread()); We should not be using isMainThread() in the UIProcess because an app on iOS may be using for WK1 and WK2. You want RunLoop::isMain() instead. > Source/WebKit/UIProcess/WebProcessPool.cpp:310 > + callOnMainThread([weakPtr = makeWeakPtr(this)] { makeWeakPtr(*this) will save a branch. Also this needs to be RunLoop::main() dispatch() for same reasons as above.
Brent Fulgham
Comment 4 2020-03-18 16:58:27 PDT
Created attachment 393918 [details] Patch for landing
Brent Fulgham
Comment 5 2020-03-18 17:04:16 PDT
Created attachment 393920 [details] Patch for landing
EWS
Comment 6 2020-03-18 17:41:41 PDT
Committed r258671: <https://trac.webkit.org/changeset/258671> All reviewed patches have been landed. Closing bug and clearing flags on attachment 393920 [details].
Note You need to log in before you can comment on or make changes to this bug.