-
fdoray authored
Instead of a single function that takes a base::ExecutionMode as argument, post_task.h now exposes one task runner creation function per execution mode. These functions return typed task runners. scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits(TaskTraits); scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits(TaskTraits); scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits(TaskTraits); We had originally explicitly opted against providing typed TaskRunners per them lacking all other traits and thus merely being weakly typed (a compile time name for every combination of trait would be ridiculous). It is however now becoming obvious that the ExecutionMode is by far the most important type to spread through the codebase as having a compile time guarantee that something is single-threaded or sequenced is a pretty big deal and such usage is spread throughout the codebase already. Other traits (e.g. file I/O allowed) are also important but more easily enforced (e.g. AssertIOAllowed()) and we are thus fine keeping the compile-time enforcement to the execution mode only. This, in general, doesn't change the desire to have components get their own TaskRunner instead of having it passed in in the TaskScheduler world. BUG=553459 Review-Url: https://codereview.chromium.org/2464963002 Cr-Commit-Position: refs/heads/master@{#429276}
e72adfa1