OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PROFILER_PROFILER_LISTENER_H_ | 5 #ifndef V8_PROFILER_PROFILER_LISTENER_H_ |
6 #define V8_PROFILER_PROFILER_LISTENER_H_ | 6 #define V8_PROFILER_PROFILER_LISTENER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/code-events.h" | 10 #include "src/code-events.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 const char* GetFunctionName(const char* name) { | 73 const char* GetFunctionName(const char* name) { |
74 return function_and_resource_names_.GetFunctionName(name); | 74 return function_and_resource_names_.GetFunctionName(name); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 void RecordInliningInfo(CodeEntry* entry, AbstractCode* abstract_code); | 78 void RecordInliningInfo(CodeEntry* entry, AbstractCode* abstract_code); |
79 void RecordDeoptInlinedFrames(CodeEntry* entry, AbstractCode* abstract_code); | 79 void RecordDeoptInlinedFrames(CodeEntry* entry, AbstractCode* abstract_code); |
80 Name* InferScriptName(Name* name, SharedFunctionInfo* info); | 80 Name* InferScriptName(Name* name, SharedFunctionInfo* info); |
81 V8_INLINE void DispatchCodeEvent(const CodeEventsContainer& evt_rec) { | 81 V8_INLINE void DispatchCodeEvent(const CodeEventsContainer& evt_rec) { |
| 82 base::LockGuard<base::Mutex> guard(&mutex_); |
82 for (auto observer : observers_) { | 83 for (auto observer : observers_) { |
83 observer->CodeEventHandler(evt_rec); | 84 observer->CodeEventHandler(evt_rec); |
84 } | 85 } |
85 } | 86 } |
86 | 87 |
87 StringsStorage function_and_resource_names_; | 88 StringsStorage function_and_resource_names_; |
88 std::vector<CodeEntry*> code_entries_; | 89 std::vector<CodeEntry*> code_entries_; |
89 std::vector<CodeEventObserver*> observers_; | 90 std::vector<CodeEventObserver*> observers_; |
| 91 base::Mutex mutex_; |
90 | 92 |
91 DISALLOW_COPY_AND_ASSIGN(ProfilerListener); | 93 DISALLOW_COPY_AND_ASSIGN(ProfilerListener); |
92 }; | 94 }; |
93 | 95 |
94 } // namespace internal | 96 } // namespace internal |
95 } // namespace v8 | 97 } // namespace v8 |
96 | 98 |
97 #endif // V8_PROFILER_PROFILER_LISTENER_H_ | 99 #endif // V8_PROFILER_PROFILER_LISTENER_H_ |
OLD | NEW |