Add a RemoveObserverPolicy parameter to ObserverListThreadSafe
The policy defaults to kAnySequence, the existing behaviour, but can be set to kAddingSequenceOnly to CHECK that observers are only removed from the same sequence that added them. This prevents a mistake where an observer is deleted immediately after calling RemoveObserver from a different sequence, even though it might still be inside a callback. Also adds 3 more cross-thread ObserverListThreadSafeTest's, and reduces the duration of each from 2s to 1s to compensate. R=fdoray Bug: 1471683 Change-Id: I73e9cc21f2186ebdcf8f2dacd1a71aa4d11134c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4781112 Commit-Queue: Matt Mueller <mattm@chromium.org> Reviewed-by:Matt Mueller <mattm@chromium.org> Reviewed-by:
Francois Pierre Doray <fdoray@chromium.org> Auto-Submit: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1184841}
Loading
Please register or sign in to comment