Chromium Code Reviews| Index: content/browser/tracing/background_tracing_manager_impl.cc |
| diff --git a/content/browser/tracing/background_tracing_manager_impl.cc b/content/browser/tracing/background_tracing_manager_impl.cc |
| index 560e5a4c1e40ba6bfe49eb16c6c9f7a1c06d7aa9..352c7bb8eb18bda58b98fa61bb2ea118149afe02 100644 |
| --- a/content/browser/tracing/background_tracing_manager_impl.cc |
| +++ b/content/browser/tracing/background_tracing_manager_impl.cc |
| @@ -93,7 +93,8 @@ bool BackgroundTracingManagerImpl::IsSupportedConfig( |
| bool BackgroundTracingManagerImpl::SetActiveScenario( |
| scoped_ptr<BackgroundTracingConfig> config, |
| const BackgroundTracingManager::ReceiveCallback& receive_callback, |
| - bool requires_anonymized_data) { |
| + const base::Closure& enabled_callback, |
| + DataFiltering data_filtering) { |
| CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| if (is_tracing_) |
| return false; |
| @@ -107,21 +108,23 @@ bool BackgroundTracingManagerImpl::SetActiveScenario( |
| config_ = config.Pass(); |
| receive_callback_ = receive_callback; |
| - requires_anonymized_data_ = requires_anonymized_data; |
| + requires_anonymized_data_ = (data_filtering == ANONYMIZE_DATA); |
| - EnableRecordingIfConfigNeedsIt(); |
| + EnableRecordingIfConfigNeedsIt(enabled_callback); |
| return true; |
| } |
| -void BackgroundTracingManagerImpl::EnableRecordingIfConfigNeedsIt() { |
| +void BackgroundTracingManagerImpl::EnableRecordingIfConfigNeedsIt( |
| + const base::Closure& enabled_callback) { |
| if (!config_) |
| return; |
| if (config_->mode == BackgroundTracingConfig::PREEMPTIVE_TRACING_MODE) { |
| EnableRecording(GetCategoryFilterForCategoryPreset( |
| - static_cast<BackgroundTracingPreemptiveConfig*>(config_.get()) |
| - ->category_preset)); |
| + static_cast<BackgroundTracingPreemptiveConfig*>( |
| + config_.get())->category_preset), |
| + enabled_callback); |
| } else { |
| // TODO(simonhatch): Implement reactive tracing path. |
| NOTREACHED(); |
| @@ -228,11 +231,13 @@ void BackgroundTracingManagerImpl::InvalidateTriggerHandlesForTesting() { |
| } |
| void BackgroundTracingManagerImpl::EnableRecording( |
| - base::trace_event::CategoryFilter category_filter) { |
| + base::trace_event::CategoryFilter category_filter, |
| + const base::Closure& enabled_callback) { |
| + base::trace_event::TraceOptions trace_options( |
| + base::trace_event::RECORD_CONTINUOUSLY); |
| + trace_options.enable_argument_filter = requires_anonymized_data_; |
| is_tracing_ = TracingController::GetInstance()->EnableRecording( |
| - category_filter, |
| - base::trace_event::TraceOptions(base::trace_event::RECORD_CONTINUOUSLY), |
| - TracingController::EnableRecordingDoneCallback()); |
|
dsinclair
2015/06/01 18:50:05
Where does this callback get set, I'm not seeing i
oystein (OOO til 10th of July)
2015/06/01 20:46:20
It's the same one from the other review comments t
|
| + category_filter, trace_options, enabled_callback); |
| } |
| void BackgroundTracingManagerImpl::OnFinalizeStarted( |
| @@ -241,7 +246,7 @@ void BackgroundTracingManagerImpl::OnFinalizeStarted( |
| if (!receive_callback_.is_null()) |
| receive_callback_.Run( |
| - file_contents.get(), |
| + file_contents, |
| base::Bind(&BackgroundTracingManagerImpl::OnFinalizeComplete, |
| base::Unretained(this))); |
| } |
| @@ -263,7 +268,7 @@ void BackgroundTracingManagerImpl::OnFinalizeComplete() { |
| idle_callback_.Run(); |
| // Now that a trace has completed, we may need to enable recording again. |
| - EnableRecordingIfConfigNeedsIt(); |
| + EnableRecordingIfConfigNeedsIt(base::Closure()); |
| } |
| void BackgroundTracingManagerImpl::BeginFinalizing( |