-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Nearby] Distribute weak pointers for PayloadStatusListener
Background: ShareTargetInfo owns the PayloadStatusListener (PayloadTracker), which handles payload status updates from Nearby Connections. In order to trigger these updates, the Nearby Connections managers needs access to the listener. Previously, ShareTargetInfo was distributing raw listener pointers to the Nearby Connection manager. This is an issue when multiple payloads are included in the same transfer. The payloads all share the same listener. When a transfer is cancelled or fails, we receive a cancellation/failure signal for *each* payload; however, the listener is destroyed after the *first* cancellation/failure signal. The Nearby Connections manager will then try to use a non-existent listener when it receives subsequent cancellation/failure updates for the other payloads. Fix: In this CL, we distribute weak pointers instead of raw pointers. When ShareTargetInfo destroys the PayloadStatusListener, the weak pointers are invalidated and the Nearby Connections manager knows not to use the listener anymore. Tested: Manually verified that the browser process crashes before this fix but not after the fix. Also, verified that the added unit test crashes before this fix but not after. (cherry picked from commit e4e1955) Fixed: 1196435, b/181274197 Change-Id: I6cd34883aaed847ac05d963cdd4719749cb5a3b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2818518 Reviewed-by: James Vecore <vecore@google.com> Commit-Queue: Josh Nohle <nohle@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#871988} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826790 Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Josh Nohle <nohle@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/branch-heads/4472@{#62} Cr-Branched-From: 3d60439-refs/heads/master@{#870763}
- Loading branch information
Showing
9 changed files
with
273 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.