[OSCrypt] KeyStorageLinux supports provided TaskRunners

While we need to jump to a specific thread and back, OSCrypt remains a
synchronous API, therefore we need to wait on the result. An exception
for KeyStorageLinux is made to allow for blocking.

We wrap the Init() and GetKey() methods, such that they are called on
preferred TaskRunner for the targeted backend.

OSCrypt itself has no expectation for which thread it's going to be called
on. It might even already be the thread that the backend requires (e.g. UI).
We avoid a deadlock by only posting the task if the TaskRunner is
different than the current one.

Bug: 782851
Change-Id: I48ae623ce04da23a5e79d0c1e52890df8a8ef79e
Reviewed-on: https://chromium-review.googlesource.com/758854
Reviewed-by: Jochen Eisinger <[email protected]>
Reviewed-by: Vaclav Brozek <[email protected]>
Commit-Queue: Christos Froussios <[email protected]>
Cr-Commit-Position: refs/heads/master@{#520898}
5 files changed