Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: Source/core/platform/audio/HRTFElevation.cpp

Issue 23613007: Fix threading races on HRTFElevation::audioBusMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/audio/HRTFElevation.cpp
diff --git a/Source/core/platform/audio/HRTFElevation.cpp b/Source/core/platform/audio/HRTFElevation.cpp
index a37e696f50ed6ec52fd056bb615d41d7667a572b..a5c606cdb95535ce11d81a107c0da00fe832fcc6 100644
--- a/Source/core/platform/audio/HRTFElevation.cpp
+++ b/Source/core/platform/audio/HRTFElevation.cpp
@@ -37,6 +37,7 @@
#include "core/platform/audio/AudioBus.h"
#include "core/platform/audio/HRTFPanner.h"
#include "wtf/OwnPtr.h"
+#include "wtf/ThreadingPrimitives.h"
using namespace std;
@@ -64,7 +65,9 @@ static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(const Stri
{
typedef HashMap<String, RefPtr<AudioBus> > AudioBusMap;
DEFINE_STATIC_LOCAL(AudioBusMap, audioBusMap, ());
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
Ken Russell (switch to Gerrit) 2013/09/04 19:57:55 This doesn't look any safer to me. If there is rea
+ MutexLocker locker(mutex);
RefPtr<AudioBus> bus;
AudioBusMap::iterator iterator = audioBusMap.find(subjectName);
if (iterator == audioBusMap.end()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698