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 // Some reactive configs that trigger again while tracing should just | 332 // 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 // For others we just want to ignore the repeated trigger. | 334 trace_delay = -1; |
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 } | |
342 } | 335 } |
343 } else { | 336 } else { |
344 // In preemptive mode, a trigger starts finalizing a trace if one is | 337 // In preemptive mode, a trigger starts finalizing a trace if one is |
345 // running and we're not got a finalization timer running, | 338 // running and we're not got a finalization timer running, |
346 // otherwise we do nothing. | 339 // otherwise we do nothing. |
347 if (!is_tracing_ || is_gathering_ || tracing_timer_) { | 340 if (!is_tracing_ || is_gathering_ || tracing_timer_) { |
348 if (!callback.is_null()) | 341 if (!callback.is_null()) |
349 callback.Run(false); | 342 callback.Run(false); |
350 return; | 343 return; |
351 } | 344 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: | 559 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: |
567 return "blink_style"; | 560 return "blink_style"; |
568 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: | 561 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: |
569 NOTREACHED(); | 562 NOTREACHED(); |
570 } | 563 } |
571 NOTREACHED(); | 564 NOTREACHED(); |
572 return ""; | 565 return ""; |
573 } | 566 } |
574 | 567 |
575 } // namspace content | 568 } // namspace content |
OLD | NEW |