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
+++ This bug was initially created as a clone of Bug #159552 +++
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
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
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
(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
(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.