Chromium Code Reviews
DescriptionEnsure Origin Thread Affinity for BlameContext
Currently, it is possible that instances of BlameContext (and its subclasses)
to be created and managed in one thread, but its callbacks OnTraceLogEnabled()
and OnTraceLogDisabled() are called in a different one, which potentially
causes threading issues.
This patch sets new policies to ensure thread safety:
1. The two callbacks, when called from a different thread, must post tasks to
the thread where the instance was created, instead of doing their business
directly;
2. BlameContext and any of its subclasses must remove itself from TraceLog's
observer list at the beginning of destruction, so that the destructor does not
race with the callbacks.
BUG=546021
Patch Set 1 #Patch Set 2 : Add MessageLoop to BlameContextTest #Patch Set 3 : Error fix #
Total comments: 7
Patch Set 4 : Use origin thread affinity #
Total comments: 2
Patch Set 5 : Introduce UnregisterFromTraceLog() to prevent racing with dtor #Patch Set 6 : Apply UnregisterFromTraceLog() to subclasses #Patch Set 7 : Fix windows bot compile error #
Depends on Patchset: Messages
Total messages: 17 (4 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||