Index: src/profiler/profiler-listener.cc |
diff --git a/src/profiler/profiler-listener.cc b/src/profiler/profiler-listener.cc |
index 7ce874e6c1ef82dcdd927252095ba9856ba3f561..4bceac2e89530e4182a866168728bf7e813ca011 100644 |
--- a/src/profiler/profiler-listener.cc |
+++ b/src/profiler/profiler-listener.cc |
@@ -319,6 +319,7 @@ CodeEntry* ProfilerListener::NewCodeEntry( |
} |
void ProfilerListener::AddObserver(CodeEventObserver* observer) { |
+ base::LockGuard<base::Mutex> guard(&mutex_); |
if (std::find(observers_.begin(), observers_.end(), observer) != |
observers_.end()) |
return; |
@@ -326,6 +327,7 @@ void ProfilerListener::AddObserver(CodeEventObserver* observer) { |
} |
void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { |
+ base::LockGuard<base::Mutex> guard(&mutex_); |
auto it = std::find(observers_.begin(), observers_.end(), observer); |
if (it == observers_.end()) return; |
observers_.erase(it); |