• Robert Sesek's avatar
    Reland "mac: Simplify the local_discovery ServiceWatcher and ServiceResolver." · 9ec27692
    Robert Sesek authored
    This is a reland of f4240b29
    
    This fixes two issues:
    
    - A real UAF in ServiceResolverImplMac::OnResolveComplete, where the
      callback can delete |this|, so StopResolving() is now called before
      the callback.
    - A test-only UAF caused by the background thread outliving the object.
      The thread is now flushed and joined. The -stop methods for both
      NetServiceBrowser and NetServiceResolver are now called in their
      respective -deallocs, in case the Stop posted task does not run.
    
    Original change's description:
    > mac: Simplify the local_discovery ServiceWatcher and ServiceResolver.
    >
    > This removes the inner Container classes by moving the logic into the
    > ObjC classes that already exist.
    >
    > Bug: 1072841
    > Change-Id: If22d2d90ce3235ce160a0b740337fd71353a7ef7
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2243995
    > Commit-Queue: Robert Sesek <rsesek@chromium.org>
    > Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#778341}
    
    Bug: 1072841
    Change-Id: Ice53eb92d6c73c75ad6f276b301eaa1841536c8d
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248076Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
    Commit-Queue: Robert Sesek <rsesek@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#779350}
    9ec27692
service_discovery_client_mac.mm 18.7 KB