| Log Message: |
Fix threading races on HRTFElevation::audioBusMap
According to the crash report (https://cluster-fuzz.appspot.com/testcase?key=6291334197411840),
there is a threading race in HRTFElevation::getConcatenatedImpulseResponsesForSubject.
static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(...) {
typedef HashMap<String, RefPtr<AudioBus> > AudioBusMap;
DEFINE_STATIC_LOCAL(AudioBusMap, audioBusMap, ());
RefPtr<AudioBus> bus;
AudioBusMap::iterator iterator = audioBusMap.find(subjectName); // (A)
if (iterator == audioBusMap.end()) {
...;
audioBusMap.set(subjectName, bus); // (B)
}
}
It's possible that:
(1) Thread 1 executes (A)
(2) Thread 2 executes (A)
(3) Thread 1 executes (B)
(4) Thread 2 executes (B) and crashes.
This CL protects accesses to the AudioBusMap with mutex.
BUG=270758
No tests because the crash depends on threading races and thus not reproducible.
Review URL: https://chromiumcodereview.appspot.com/23613007
|