• Eric Orth's avatar
    Rewrite StaleHostResolver around CreateRequest() API · 2a27db26
    Eric Orth authored
    Motivation is that HostResolver::Resolve() is soon to be deleted and
    all usage converted to CreateRequest (or to network service APIs). Need
    to ensure cronet/StaleHostResolver continue working during transition.
    
    Fully implemented StaleHostResolver::CreateRequest().
    StaleHostResolver::Resolve() now implemented using CreateRequest() and
    HostResolver::ResolveLegacy().
    
    As the new API is more focused on the ResolveHostRequest object, it
    made more sense to convert the StaleHostResolver::RequestImpl to be a
    direct implementation, rather than using a separate Handle. Main
    difference is lifetime semantics. The object is now owned by the client
    instead of self-destroying on completion.  Extra orphaned requests
    (allowed to complete to backfill the cache) are then detached to be
    owned by StaleHostResolver instance itself as the client will likely
    destroy the request after getting results.
    
    With added weak ptr back to StaleHostResolver, it became simpler to
    have RequestImpl directly read options_ and implement the stale usable
    checks rather than pass in a callback.
    
    Bug: 922699
    Change-Id: Iadb48c0d574cc47ff6f79a6d313164b126c1d76d
    Reviewed-on: https://chromium-review.googlesource.com/c/1452699Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
    Commit-Queue: Eric Orth <ericorth@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#629601}
    2a27db26
stale_host_resolver_unittest.cc 21.5 KB