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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-events.h ('k') | src/profiler/profiler-listener.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/profiler-listener.h
diff --git a/src/profiler/profiler-listener.h b/src/profiler/profiler-listener.h
index 7e24ceaa8629d4e9bd34446f6237c62008ed43fe..500b7ae6befd11b0942ef3d032423ad185713565 100644
--- a/src/profiler/profiler-listener.h
+++ b/src/profiler/profiler-listener.h
@@ -79,6 +79,7 @@ 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) {
+ base::LockGuard<base::Mutex> guard(&mutex_);
for (auto observer : observers_) {
observer->CodeEventHandler(evt_rec);
}
@@ -87,6 +88,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);
};
« 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