-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call each NetworkStateObserver separately.
NetworkStateNotifier used to have NetworkStateObserver list as HashMap<SingleThreadTaskRunner*, Vector<NetworkStateObserver*>> and call each observer on a taskrunner sequentially. That caused race condition and use-after-free: what if an observer calls wait and other observer removes all? We also should not guarantee the order of registering observers is kept as notification order: each observer should not depend on others. To fix that, this patch reconstructs the structure to HashMap<NetworkStateObserver*, SingleThreadTaskRunner*> and call each observer on each taskrunner separately. This implementation follows base/observer_list_threadsafe.h except the taskrunner is given by the caller. Fixed: 1278708 Change-Id: Iff5d0008d5b0d98caa5931e2806db3ffc52be6fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4280021 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Yoichi Osato <yoichio@chromium.org> Cr-Commit-Position: refs/heads/main@{#1111448}
- Loading branch information
Yoichi Osato
authored and
Chromium LUCI CQ
committed
Mar 1, 2023
1 parent
dd0a52a
commit 9c3ac3d
Showing
3 changed files
with
101 additions
and
196 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