(Cc-ing petewil@ because the context of this question is the current QR Code Generator project; Cc-ing gab@ because this question is somewhat related to TaskRunners)
Doc comments of WrapCallbackWithDefaultInvokeIfNotRun say that "the default form of the callback [...] may not run on the thread you expected" (i.e. the callback may be destructed on a different thread than the thread where Run is typically called). In particular, I assume that mojo async response would typically be run on the same thread that the mojo::Remote is bound to (e.g. the UI thread), while the callback destruction may happen on the IO thread (where I assume mojo connectivity is managed). Is there a recommended pattern or additional helpers to guarantee that the default form will be invoked on a specific thread (or sequence, or TaskRunner, or whatever the current technology is called :-))?
Initially I thought that maybe I can wrap `orignal_callback` (the first argument of WrapCallbackWithDefaultInvokeIfNotRun) with something like: base::BindOnce(PostToOriginalThread, std::move(original_callback), original_task_runner). But then I've looked at base/threading/post_task_and_reply_impl.cc and it seems that calculating the `original_task_runner` may end up quite complicated. Or... maybe it is okay to just get one through SequencedTaskRunner::GetCurrentDefault?
FWIW, the current callers of WrapCallbackWithDefaultInvokeIfNotRun (the few that I briefly looked at) seem to not care about the threading caveat (at least there are no comments that explain why the threading caveat doesn't apply + there are no threading-related wrappers). Are these potential bugs?
Thanks,
Lukasz