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

Unified Diff: gin/v8_platform.cc

Issue 2650943008: [gin] Fire observer after added when recording is in progress. (Closed)
Patch Set: Add tests Created 3 years, 11 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 | « gin/BUILD.gn ('k') | gin/v8_platform_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/v8_platform.cc
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
index 6e5491bff11801397e353cb371b1a9762fffb970..6be7b88d4f594be6895e142ada20e8da5077f265 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
@@ -217,12 +217,18 @@ class EnabledStateObserverImpl final
}
void AddObserver(v8::Platform::TraceStateObserver* observer) {
- base::AutoLock lock(mutex_);
- DCHECK(!observers_.count(observer));
- observers_.insert(observer);
- if (observers_.size() == 1) {
- base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this);
+ {
+ base::AutoLock lock(mutex_);
+ DCHECK(!observers_.count(observer));
+ observers_.insert(observer);
alph 2017/01/25 22:39:06 Can you please move this line past 225. Just to be
lpy 2017/01/25 23:11:15 I don't understand here, what do you mean similar
alph 2017/01/25 23:26:32 My suggestion implied you change "observers_.size(
lpy 2017/01/26 02:26:41 Done.
+ if (observers_.size() == 1) {
+ base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(
+ this);
+ }
}
+ // Fire the observer if recording is already in progress.
+ if (base::trace_event::TraceLog::GetInstance()->IsEnabled())
+ observer->OnTraceEnabled();
}
void RemoveObserver(v8::Platform::TraceStateObserver* observer) {
« no previous file with comments | « gin/BUILD.gn ('k') | gin/v8_platform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698