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

Side by Side Diff: src/profiler/profiler-listener.h

Issue 2321073004: [profiler] Allow thread-safe access to add/remove code event observers. (Closed)
Patch Set: addressing the comment. Created 4 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 unified diff | Download patch
« no previous file with comments | « src/code-events.h ('k') | src/profiler/profiler-listener.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « src/code-events.h ('k') | src/profiler/profiler-listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698