OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/tracing/background_tracing_manager_impl.h" | 5 #include "content/browser/tracing/background_tracing_manager_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 if (config_->tracing_mode() == BackgroundTracingConfigImpl::REACTIVE) { | 322 if (config_->tracing_mode() == BackgroundTracingConfigImpl::REACTIVE) { |
323 // In reactive mode, a trigger starts tracing, or finalizes tracing | 323 // In reactive mode, a trigger starts tracing, or finalizes tracing |
324 // immediately if it's already running. | 324 // immediately if it's already running. |
325 RecordBackgroundTracingMetric(REACTIVE_TRIGGERED); | 325 RecordBackgroundTracingMetric(REACTIVE_TRIGGERED); |
326 | 326 |
327 if (!is_tracing_) { | 327 if (!is_tracing_) { |
328 // It was not already tracing, start a new trace. | 328 // It was not already tracing, start a new trace. |
329 StartTracing(triggered_rule->category_preset(), | 329 StartTracing(triggered_rule->category_preset(), |
330 base::trace_event::RECORD_UNTIL_FULL); | 330 base::trace_event::RECORD_UNTIL_FULL); |
331 } else { | 331 } else { |
332 // Reactive configs that trigger again while tracing should just | 332 // Some reactive configs that trigger again while tracing should just |
333 // end right away (to not capture multiple navigations, for example). | 333 // end right away (to not capture multiple navigations, for example). |
334 trace_delay = -1; | 334 // For others we just want to ignore the repeated trigger. |
| 335 if (triggered_rule->stop_tracing_on_repeated_reactive()) { |
| 336 trace_delay = -1; |
| 337 } else { |
| 338 if (!callback.is_null()) |
| 339 callback.Run(false); |
| 340 return; |
| 341 } |
335 } | 342 } |
336 } else { | 343 } else { |
337 // In preemptive mode, a trigger starts finalizing a trace if one is | 344 // In preemptive mode, a trigger starts finalizing a trace if one is |
338 // running and we're not got a finalization timer running, | 345 // running and we're not got a finalization timer running, |
339 // otherwise we do nothing. | 346 // otherwise we do nothing. |
340 if (!is_tracing_ || is_gathering_ || tracing_timer_) { | 347 if (!is_tracing_ || is_gathering_ || tracing_timer_) { |
341 if (!callback.is_null()) | 348 if (!callback.is_null()) |
342 callback.Run(false); | 349 callback.Run(false); |
343 return; | 350 return; |
344 } | 351 } |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: | 567 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: |
561 return "blink_style"; | 568 return "blink_style"; |
562 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: | 569 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: |
563 NOTREACHED(); | 570 NOTREACHED(); |
564 } | 571 } |
565 NOTREACHED(); | 572 NOTREACHED(); |
566 return ""; | 573 return ""; |
567 } | 574 } |
568 | 575 |
569 } // namspace content | 576 } // namspace content |
OLD | NEW |