• Ryan Sleevi's avatar
    Make CertVerifier provide stronger lifetime guarantees. · c36930b0
    Ryan Sleevi authored
    CertVerifier today guarantees that if the associated
    CertVerifier::Request is deleted, the caller-supplied
    callback will not be invoked. However, it does not provide
    any guarantees as to when the callback itself will be
    freed.
    
    This strengthens the guarantee, such that when a ::Request
    is deleted, it will also Reset() the callback. Similarly,
    it provides a strong guarantee that if the CertVerifier is
    deleted, the associated Callbacks will be Reset. Put
    differently, if either (CertVerifier is deleted ||
    Request is deleted), then the Callback will be Reset. This
    makes it easier for callers to be confident of an
    "eventually consistent" approach.
    
    Prior to this change, when the Callback was destroyed was
    a bit indeterminate. In some cases, when the underlying
    CertVerifier went away, the Callback would be destroyed. In
    other cases, it was not until the ::Request was deleted by
    the caller. And in one, it was not until both the ::Request
    was deleted and the underlying CertVerifier had been
    deleted/the asynchronous job completed before the callback
    would be destroyed.
    
    Bug: none
    Change-Id: I527fa9f3700016269d4236bae03c13510ab69b7b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862116Reviewed-by: default avatarMatthew Denton <mpdenton@chromium.org>
    Reviewed-by: default avatarMatt Mueller <mattm@chromium.org>
    Commit-Queue: Ryan Sleevi <rsleevi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#707472}
    c36930b0
trial_comparison_cert_verifier.cc 24.8 KB