Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 2466873002: Enable FILTERING_MODE for tracing if event filters were given in config (Closed)
Patch Set: rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/tracing/tracing_controller_impl.cc
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index 5fc480346a29332414bbd150039dfcabea0385ee..9d5b0eb9d9f4608e797ca264d5f9a0b247948e68 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -196,7 +196,7 @@ TracingControllerImpl::TracingControllerImpl()
pending_memory_dump_ack_count_(0),
failed_memory_dump_count_(0),
pending_clock_sync_ack_count_(0),
- is_tracing_(false) {
+ enabled_tracing_modes_(0) {
base::trace_event::MemoryDumpManager::GetInstance()->Initialize(
this /* delegate */, true /* is_coordinator */);
@@ -233,12 +233,10 @@ bool TracingControllerImpl::GetCategories(
void TracingControllerImpl::SetEnabledOnFileThread(
const TraceConfig& trace_config,
- int mode,
const base::Closure& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- TraceLog::GetInstance()->SetEnabled(
- trace_config, static_cast<TraceLog::Mode>(mode));
+ TraceLog::GetInstance()->SetEnabled(trace_config, enabled_tracing_modes_);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
}
@@ -246,7 +244,8 @@ void TracingControllerImpl::SetDisabledOnFileThread(
const base::Closure& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- TraceLog::GetInstance()->SetDisabled();
+ DCHECK(enabled_tracing_modes_);
+ TraceLog::GetInstance()->SetDisabled(enabled_tracing_modes_);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
}
@@ -258,10 +257,12 @@ bool TracingControllerImpl::StartTracing(
if (!can_start_tracing())
return false;
- is_tracing_ = true;
start_tracing_done_callback_ = callback;
start_tracing_trace_config_.reset(
new base::trace_event::TraceConfig(trace_config));
+ enabled_tracing_modes_ = TraceLog::RECORDING_MODE;
+ if (!start_tracing_trace_config_->event_filters().empty())
+ enabled_tracing_modes_ |= TraceLog::FILTERING_MODE;
metadata_.reset(new base::DictionaryValue());
pending_start_tracing_ack_count_ = 0;
@@ -462,7 +463,7 @@ bool TracingControllerImpl::GetTraceBufferUsage(
}
bool TracingControllerImpl::IsTracing() const {
- return is_tracing_;
+ return !!enabled_tracing_modes_;
}
void TracingControllerImpl::AddTraceMessageFilter(
@@ -647,7 +648,7 @@ void TracingControllerImpl::OnStopTracingAcked(
// All acks (including from the subprocesses and the local trace) have been
// received.
- is_tracing_ = false;
+ enabled_tracing_modes_ = 0;
// Trigger callback if one is set.
if (!pending_get_categories_done_callback_.is_null()) {
@@ -776,12 +777,10 @@ void TracingControllerImpl::StartAgentTracing(
BrowserThread::FILE, FROM_HERE,
base::Bind(&TracingControllerImpl::SetEnabledOnFileThread,
base::Unretained(this), trace_config,
- base::trace_event::TraceLog::RECORDING_MODE,
on_agent_started))) {
// BrowserThread::PostTask fails if the threads haven't been created yet,
// so it should be safe to just use TraceLog::SetEnabled directly.
- base::trace_event::TraceLog::GetInstance()->SetEnabled(
- trace_config, base::trace_event::TraceLog::RECORDING_MODE);
+ TraceLog::GetInstance()->SetEnabled(trace_config, enabled_tracing_modes_);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, on_agent_started);
}
}

Powered by Google App Engine
This is Rietveld 408576698