fido: avoid hairpinning of FidoRequestHandlerBase callbacks

Currently, the |FidoRequestHandlerBase::AddAuthenticator| method
synchronously invokes the virtual |DispatchRequest| method, which
subclasses implement to process the request and invoke the response
handling callback. Most authenticators are instantiated by a
|FidoDiscovery| which does some asynchronous discovery work and then
calls |AddAuthenticator|.

Platform authenticators, on the other hand, are instantiated by
|MaybeAddPlatformAuthenticator|, which gets invoked synchronously with
request handler instantiation. This makes it possible to have a
synchronous code path from request handler instantation to response
callback invocation (i.e.  hairpinning). In those cases,
|AuthenticatorImpl| is unable to handle the response (see e.g.
https://cs.chromium.org/chromium/src/content/browser/webauth/authenticator_impl.cc?sq=package:chromium&dr&g=0&l=749).

This change makes |DispatchRequest| invocation asynchronous, which
eliminates any possibility of response callback hairpinning.

Bug: 678128
Change-Id: I6bf273775885abac1fa38fe12c964e930407cc7e
Reviewed-on: https://chromium-review.googlesource.com/1172917
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Reviewed-by: Jun Choi <hongjunchoi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583051}
7 files changed