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

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

Issue 11823016: Trace category groups and category filter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Category group and category filter basics. Created 7 years, 10 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/trace_controller_impl.cc
diff --git a/content/browser/tracing/trace_controller_impl.cc b/content/browser/tracing/trace_controller_impl.cc
index e0aed6edcd7969acd9f874f2fd7ed73f414a3f87..2819fd1f26af48ee6a0a452599a436a9d18a69d1 100644
--- a/content/browser/tracing/trace_controller_impl.cc
+++ b/content/browser/tracing/trace_controller_impl.cc
@@ -119,22 +119,6 @@ bool TraceControllerImpl::GetKnownCategoriesAsync(TraceSubscriber* subscriber) {
return success;
}
-bool TraceControllerImpl::BeginTracing(
- TraceSubscriber* subscriber,
- const std::vector<std::string>& included_categories,
- const std::vector<std::string>& excluded_categories) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- if (!can_begin_tracing(subscriber))
- return false;
-
- // Enable tracing
- TraceLog::GetInstance()->SetEnabled(included_categories, excluded_categories);
- OnTracingBegan(subscriber);
-
- return true;
-}
-
bool TraceControllerImpl::BeginTracing(TraceSubscriber* subscriber,
const std::string& categories) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -143,7 +127,8 @@ bool TraceControllerImpl::BeginTracing(TraceSubscriber* subscriber,
return false;
// Enable tracing
- TraceLog::GetInstance()->SetEnabled(categories);
+ base::debug::CategoryFilter category_filter(categories);
+ TraceLog::GetInstance()->SetEnabled(category_filter);
OnTracingBegan(subscriber);
@@ -261,7 +246,10 @@ void TraceControllerImpl::AddFilter(TraceMessageFilter* filter) {
filters_.insert(filter);
if (is_tracing_enabled()) {
- filter->SendBeginTracing(included_categories_, excluded_categories_);
+ scoped_refptr<base::RefCountedString> category_filter_str_ptr =
+ new base::RefCountedString();
+ category_filter_.ToString(&(category_filter_str_ptr->data()));
+ filter->SendBeginTracing(category_filter_str_ptr->data());
if (!watch_category_.empty())
filter->SendSetWatchEvent(watch_category_, watch_name_);
}
@@ -283,11 +271,13 @@ void TraceControllerImpl::OnTracingBegan(TraceSubscriber* subscriber) {
subscriber_ = subscriber;
- TraceLog::GetInstance()->GetEnabledTraceCategories(&included_categories_,
- &excluded_categories_);
+ category_filter_ = TraceLog::GetInstance()->GetCurrentCategoryFilter();
+ scoped_refptr<base::RefCountedString> category_filter_str_ptr =
+ new base::RefCountedString();
+ category_filter_.ToString(&(category_filter_str_ptr->data()));
// Notify all child processes.
for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) {
- it->get()->SendBeginTracing(included_categories_, excluded_categories_);
+ it->get()->SendBeginTracing(category_filter_str_ptr->data());
}
}

Powered by Google App Engine
This is Rietveld 408576698