Chromium Code Reviews| Index: src/profiler/profiler-listener.h |
| diff --git a/src/profiler/profiler-listener.h b/src/profiler/profiler-listener.h |
| index 7e24ceaa8629d4e9bd34446f6237c62008ed43fe..72feb02ff5829069f197e0f3c83ad0d9967c810a 100644 |
| --- a/src/profiler/profiler-listener.h |
| +++ b/src/profiler/profiler-listener.h |
| @@ -79,6 +79,8 @@ class ProfilerListener : public CodeEventListener { |
| void RecordDeoptInlinedFrames(CodeEntry* entry, AbstractCode* abstract_code); |
| Name* InferScriptName(Name* name, SharedFunctionInfo* info); |
| V8_INLINE void DispatchCodeEvent(const CodeEventsContainer& evt_rec) { |
| + if (observers_.empty()) return; |
| + base::LockGuard<base::Mutex> guard(&mutex_); |
|
jochen (gone - plz use gerrit)
2016/09/09 13:21:09
shouldn't you lock before checking observers_?
alph
2016/09/09 21:03:30
I'd like to have a fast path if there're no observ
|
| for (auto observer : observers_) { |
| observer->CodeEventHandler(evt_rec); |
| } |
| @@ -87,6 +89,7 @@ class ProfilerListener : public CodeEventListener { |
| StringsStorage function_and_resource_names_; |
| std::vector<CodeEntry*> code_entries_; |
| std::vector<CodeEventObserver*> observers_; |
| + base::Mutex mutex_; |
| DISALLOW_COPY_AND_ASSIGN(ProfilerListener); |
| }; |