| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/frame/PerformanceMonitor.h" | 5 #include "core/frame/PerformanceMonitor.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScheduledAction.h" | 7 #include "bindings/core/v8/ScheduledAction.h" |
| 8 #include "bindings/core/v8/ScriptEventListener.h" | 8 #include "bindings/core/v8/ScriptEventListener.h" |
| 9 #include "bindings/core/v8/SourceLocation.h" | 9 #include "bindings/core/v8/SourceLocation.h" |
| 10 #include "core/CoreProbeSink.h" | 10 #include "core/CoreProbeSink.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 Violation violation, | 277 Violation violation, |
| 278 const String& text, | 278 const String& text, |
| 279 double time, | 279 double time, |
| 280 std::unique_ptr<SourceLocation> location) { | 280 std::unique_ptr<SourceLocation> location) { |
| 281 ClientThresholds* client_thresholds = subscriptions_.at(violation); | 281 ClientThresholds* client_thresholds = subscriptions_.at(violation); |
| 282 if (!client_thresholds) | 282 if (!client_thresholds) |
| 283 return; | 283 return; |
| 284 if (!location) | 284 if (!location) |
| 285 location = SourceLocation::Capture(context); | 285 location = SourceLocation::Capture(context); |
| 286 for (const auto& it : *client_thresholds) { | 286 for (const auto& it : *client_thresholds) { |
| 287 if (it.value < time) { | 287 if (it.value < time) |
| 288 if (!location) | |
| 289 location = SourceLocation::Capture(context); | |
| 290 it.key->ReportGenericViolation(violation, text, time, location.get()); | 288 it.key->ReportGenericViolation(violation, text, time, location.get()); |
| 291 } | |
| 292 } | 289 } |
| 293 } | 290 } |
| 294 | 291 |
| 295 DEFINE_TRACE(PerformanceMonitor) { | 292 DEFINE_TRACE(PerformanceMonitor) { |
| 296 visitor->Trace(local_root_); | 293 visitor->Trace(local_root_); |
| 297 visitor->Trace(task_execution_context_); | 294 visitor->Trace(task_execution_context_); |
| 298 visitor->Trace(subscriptions_); | 295 visitor->Trace(subscriptions_); |
| 299 } | 296 } |
| 300 | 297 |
| 301 } // namespace blink | 298 } // namespace blink |
| OLD | NEW |