Closed domfarolino closed 3 years ago
FYI @pmusgrave @musgravejw feel free to take a look if you want. This PR is an exciting one in that it lets you access cross-thread TaskLoops without having an explicit reference a base::Thread or a base::TaskLoop that is bound to another thread. I'll probably land this soon.
Closes https://github.com/domfarolino/browser/issues/15.
This PR introduces:
... as well as a:
These pointers are set by TaskLoop::BindToCurrentThread(), which is called by TaskLoop::Create. We also expose TaskLoop::CreateUnbound so that you can create TaskLoops that are not bound upon construction. This is important for base::Thread, which is currently the only non-test-only consumer of TaskLoop. base::Thread creates an unbound TaskLoop in base::Thread::Start, and then spins up a new physical thread. When the new thread is up and running, we then bind the TaskLoop to the current thread.
(After this PR we'll need to add base::Thread tests, since we are seriously lacking test support there)