Implement base::BindPostTask()
This function binds a callback to a task runner. The functionality already existed in media::BindToLoop() so it's intended to replace it and is built on the same BindPostTaskTrampoline logic. BindToLoop() and BindToCurrentLoop() will be replaced in a follow up CL since they are used rather widely already. There are some changes to the existing BindToLoop implementation: 1. Get the FROM_HERE location from the caller automatically rather than using the BindPostTask() location. 2. If BindPostTaskTrampoline has a OnceClosure, don't rebind the closure before posting a task. 3. Add static_assert to provide a readable error message explaining the input callback must have a void return type. 4. Don't support RepeatingCallback. This is more problematic since we will always PostTask() to destroy the callback. This is easier to add later than it would be to remove support. Bug: 1140582 Change-Id: Ibb224b44c0b0c01dd88d29e94c7e9449d3353ef5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495055 Commit-Queue: kylechar <kylechar@chromium.org> Reviewed-by:Daniel Cheng <dcheng@chromium.org> Reviewed-by:
Gabriel Charette <gab@chromium.org> Reviewed-by:
danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#827818}
Showing
base/bind_post_task.h
0 → 100644
Please register or sign in to comment