Bug 159626

Summary: Implement RunLoop::runNowIfMainThreadOrDispatch
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ap, calvaris, cgarcia, commit-queue, pnormand
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 159552    
Bug Blocks:    

Philippe Normand
Reported 2016-07-11 07:34:25 PDT
+++ This bug was initially created as a clone of Bug #159552 +++
Attachments
Alexey Proskuryakov
Comment 1 2016-07-12 16:47:38 PDT
It's been a few times before that I wanted such functionality, but then convinced myself that it shouldn't be added. It would be pretty hard to know about code without knowing whether a block executes right away or races with other code in the function.
Carlos Garcia Campos
Comment 2 2016-07-13 00:39:39 PDT
I'm not sure either, and in any case I don't this would belong to RunLoop class, this could probably be a function on MainThread
Xabier Rodríguez Calvar
Comment 3 2016-07-13 01:21:34 PDT
(In reply to comment #1) > It's been a few times before that I wanted such functionality, but then > convinced myself that it shouldn't be added. It would be pretty hard to know > about code without knowing whether a block executes right away or races with > other code in the function. Yes, I understand the concern, which is not that important if you use a debugger and step into the function to see if it is run immediately. We write functions because they are a way to avoid duplicating code. The block: if (isMainThread()) { // do } else RunLoop()... happens a lot and I think it can be simplified in many places.
Xabier Rodríguez Calvar
Comment 4 2016-07-13 01:22:46 PDT
(In reply to comment #2) > I'm not sure either, and in any case I don't this would belong to RunLoop > class, this could probably be a function on MainThread I thought of RunLoop because it is the one with the dispatch, but it is true that MainThread could be a better place.
Note You need to log in before you can comment on or make changes to this bug.