[webkit-reviews] review granted: [Bug 213043] Unify some of RunLoop and callOnMainThread : [Attachment 401572] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 10 13:28:31 PDT 2020


Darin Adler <darin at apple.com> has granted Geoffrey Garen <ggaren at apple.com>'s
request for review:
Bug 213043: Unify some of RunLoop and callOnMainThread
https://bugs.webkit.org/show_bug.cgi?id=213043

Attachment 401572: Patch

https://bugs.webkit.org/attachment.cgi?id=401572&action=review




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 401572
  --> https://bugs.webkit.org/attachment.cgi?id=401572
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=401572&action=review

> Source/WTF/wtf/RunLoop.h:66
>      WTF_EXPORT_PRIVATE static void initializeMainRunLoop();
> +#if USE(WEB_THREAD)
> +    WTF_EXPORT_PRIVATE static void initializeWebRunLoop();
> +#endif

Funny that these initialize functions include the word "RunLoop" but the getter
functions don’t. Seems we don’t need to repeat the words "run loop".

> Source/WTF/wtf/cocoa/MainThreadCocoa.mm:104
>      if (mainThreadPthread) {

I don’t understand this if statement. (Not new, but I find it really
mysterious.)

> Source/WTF/wtf/cocoa/MainThreadCocoa.mm:107
> +	   RunLoop::web().dispatch([] {
> +	       WTF::dispatchFunctionsFromMainThread();
> +	   });

Since this is just calling a function can we write this instead?

    RunLoop::web().dispatch(WTF::dispatchFunctionsFromMainThread);

I suspect it might be slightly more efficient as well.

> Source/WTF/wtf/cocoa/MainThreadCocoa.mm:119
> +    RunLoop::main().dispatch([] {
> +	   WTF::dispatchFunctionsFromMainThread();
> +    });

Ditto.


More information about the webkit-reviews mailing list