Skip to content
Commit 7eda6612 authored by Joe Mason's avatar Joe Mason Committed by Chromium LUCI CQ
Browse files

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: default avatarMatt Mueller <mattm@chromium.org>
Reviewed-by: default avatarFrancois Pierre Doray <fdoray@chromium.org>
Auto-Submit: Joe Mason <joenotcharles@google.com>
Cr-Commit-Position: refs/heads/main@{#1184841}
parent f3a9781c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment