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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: | 566 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: |
560 return "blink_style"; | 567 return "blink_style"; |
561 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: | 568 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: |
562 NOTREACHED(); | 569 NOTREACHED(); |
563 } | 570 } |
564 NOTREACHED(); | 571 NOTREACHED(); |
565 return ""; | 572 return ""; |
566 } | 573 } |
567 | 574 |
568 } // namspace content | 575 } // namspace content |
OLD | NEW |