DescriptionCleanup: Remove if (!CurrentlyOn()) PostTask() pattern in EmbeddedWorkerInstance
Per discussion on chromium-dev (https://groups.google.com/a/chromium.org/d/msg/chromium-dev/uWGNk-hVlGc/M92wu3izhGEJ)
I'm removing following code pattern from non-thread-safe code.
void DoSomething() {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE,
base::Bind(DoSomething);
return;
}
...
}
This pattern is handy, but this could mislead readers to think that the method can be called from any threads, while it's not.
(We use similar patterns a lot in ServiceWorkerContextWrapper, but the class is intended to be thread-safe so I think the usage there should be ok)
BUG=N/A
TEST=existing tests
Committed: https://crrev.com/6f6121790f0f4f5f97fc3b125b261f4e5efd8334
Cr-Commit-Position: refs/heads/master@{#310447}
Patch Set 1 : #
Messages
Total messages: 8 (3 generated)
|