OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 #include "gin/public/v8_platform.h" | 5 #include "gin/public/v8_platform.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 namespace { | 195 namespace { |
196 | 196 |
197 class EnabledStateObserverImpl final | 197 class EnabledStateObserverImpl final |
198 : public base::trace_event::TraceLog::EnabledStateObserver { | 198 : public base::trace_event::TraceLog::EnabledStateObserver { |
199 public: | 199 public: |
200 EnabledStateObserverImpl() = default; | 200 EnabledStateObserverImpl() = default; |
201 | 201 |
202 void OnTraceLogEnabled() final { | 202 void OnTraceLogEnabled() final { |
203 base::AutoLock lock(mutex_); | 203 base::AutoLock lock(mutex_); |
204 for (auto o : observers_) { | 204 for (auto* o : observers_) { |
205 o->OnTraceEnabled(); | 205 o->OnTraceEnabled(); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 void OnTraceLogDisabled() final { | 209 void OnTraceLogDisabled() final { |
210 base::AutoLock lock(mutex_); | 210 base::AutoLock lock(mutex_); |
211 for (auto o : observers_) { | 211 for (auto* o : observers_) { |
212 o->OnTraceDisabled(); | 212 o->OnTraceDisabled(); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 void AddObserver(v8::Platform::TraceStateObserver* observer) { | 216 void AddObserver(v8::Platform::TraceStateObserver* observer) { |
217 { | 217 { |
218 base::AutoLock lock(mutex_); | 218 base::AutoLock lock(mutex_); |
219 DCHECK(!observers_.count(observer)); | 219 DCHECK(!observers_.count(observer)); |
220 if (observers_.empty()) { | 220 if (observers_.empty()) { |
221 base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver( | 221 base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 v8::Platform::TraceStateObserver* observer) { | 254 v8::Platform::TraceStateObserver* observer) { |
255 g_trace_state_dispatcher.Get().AddObserver(observer); | 255 g_trace_state_dispatcher.Get().AddObserver(observer); |
256 } | 256 } |
257 | 257 |
258 void V8Platform::RemoveTraceStateObserver( | 258 void V8Platform::RemoveTraceStateObserver( |
259 v8::Platform::TraceStateObserver* observer) { | 259 v8::Platform::TraceStateObserver* observer) { |
260 g_trace_state_dispatcher.Get().RemoveObserver(observer); | 260 g_trace_state_dispatcher.Get().RemoveObserver(observer); |
261 } | 261 } |
262 | 262 |
263 } // namespace gin | 263 } // namespace gin |
OLD | NEW |