Allow use of the chrome trace categories string from the tracing ui internals.

BUG=96123
TEST=manual & run pyauto tracing smoke tests


Review URL: https://chromiumcodereview.appspot.com/10855062

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151998 0039d316-1c4b-4281-b951-d872f2087c98
parent 37a770b0
...@@ -62,7 +62,7 @@ deps = { ...@@ -62,7 +62,7 @@ deps = {
(Var("googlecode_url") % "angleproject") + "/trunk@1250", (Var("googlecode_url") % "angleproject") + "/trunk@1250",
"src/third_party/trace-viewer": "src/third_party/trace-viewer":
(Var("googlecode_url") % "trace-viewer") + "/trunk@116", (Var("googlecode_url") % "trace-viewer") + "/trunk@118",
# Note that this is *not* where we check out WebKit -- this just # Note that this is *not* where we check out WebKit -- this just
# puts some extra files into place for the real WebKit checkout to # puts some extra files into place for the real WebKit checkout to
......
...@@ -431,18 +431,22 @@ void TracingMessageHandler::SaveTraceFileComplete() { ...@@ -431,18 +431,22 @@ void TracingMessageHandler::SaveTraceFileComplete() {
void TracingMessageHandler::OnBeginTracing(const ListValue* args) { void TracingMessageHandler::OnBeginTracing(const ListValue* args) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(args->GetSize() == 1); DCHECK_EQ(args->GetSize(), (size_t) 2);
bool system_tracing_requested = false; bool system_tracing_requested = false;
bool ok = args->GetBoolean(0, &system_tracing_requested); bool ok = args->GetBoolean(0, &system_tracing_requested);
DCHECK(ok); DCHECK(ok);
std::string chrome_categories;
ok = args->GetString(1, &chrome_categories);
DCHECK(ok);
trace_enabled_ = true; trace_enabled_ = true;
// TODO(jbates) This may fail, but that's OK for current use cases. // TODO(jbates) This may fail, but that's OK for current use cases.
// Ex: Multiple about:gpu traces can not trace simultaneously. // Ex: Multiple about:gpu traces can not trace simultaneously.
// TODO(nduca) send feedback to javascript about whether or not BeginTracing // TODO(nduca) send feedback to javascript about whether or not BeginTracing
// was successful. // was successful.
TraceController::GetInstance()->BeginTracing(this); TraceController::GetInstance()->BeginTracing(this, chrome_categories);
if (system_tracing_requested) { if (system_tracing_requested) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -109,18 +109,12 @@ bool TraceControllerImpl::GetKnownCategoriesAsync(TraceSubscriber* subscriber) { ...@@ -109,18 +109,12 @@ bool TraceControllerImpl::GetKnownCategoriesAsync(TraceSubscriber* subscriber) {
// message. So to get known categories, just begin and end tracing immediately // message. So to get known categories, just begin and end tracing immediately
// afterwards. This will ping all the child processes for categories. // afterwards. This will ping all the child processes for categories.
is_get_categories_ = true; is_get_categories_ = true;
bool success = BeginTracing(subscriber) && EndTracingAsync(subscriber); bool success = BeginTracing(subscriber, "*") &&
EndTracingAsync(subscriber);
is_get_categories_ = success; is_get_categories_ = success;
return success; return success;
} }
bool TraceControllerImpl::BeginTracing(TraceSubscriber* subscriber) {
std::vector<std::string> include, exclude;
// By default, exclude all categories that begin with test_
exclude.push_back("test_*");
return BeginTracing(subscriber, include, exclude);
}
bool TraceControllerImpl::BeginTracing( bool TraceControllerImpl::BeginTracing(
TraceSubscriber* subscriber, TraceSubscriber* subscriber,
const std::vector<std::string>& included_categories, const std::vector<std::string>& included_categories,
......
...@@ -28,7 +28,7 @@ class TraceControllerImpl : public TraceController { ...@@ -28,7 +28,7 @@ class TraceControllerImpl : public TraceController {
// Get set of known categories. This can change as new code paths are reached. // Get set of known categories. This can change as new code paths are reached.
// If true is returned, subscriber->OnKnownCategoriesCollected will be called // If true is returned, subscriber->OnKnownCategoriesCollected will be called
// when once the categories are retrieved from child processes. // once the categories are retrieved from child processes.
bool GetKnownCategoriesAsync(TraceSubscriber* subscriber); bool GetKnownCategoriesAsync(TraceSubscriber* subscriber);
// Same as above, but specifies which categories to trace. // Same as above, but specifies which categories to trace.
...@@ -41,7 +41,6 @@ class TraceControllerImpl : public TraceController { ...@@ -41,7 +41,6 @@ class TraceControllerImpl : public TraceController {
const std::vector<std::string>& excluded_categories); const std::vector<std::string>& excluded_categories);
// TraceController implementation: // TraceController implementation:
virtual bool BeginTracing(TraceSubscriber* subscriber) OVERRIDE;
virtual bool BeginTracing(TraceSubscriber* subscriber, virtual bool BeginTracing(TraceSubscriber* subscriber,
const std::string& categories) OVERRIDE; const std::string& categories) OVERRIDE;
virtual bool EndTracingAsync(TraceSubscriber* subscriber) OVERRIDE; virtual bool EndTracingAsync(TraceSubscriber* subscriber) OVERRIDE;
......
...@@ -24,14 +24,12 @@ class TraceController { ...@@ -24,14 +24,12 @@ class TraceController {
// Currently only one subscriber is allowed at a time. // Currently only one subscriber is allowed at a time.
// Tracing begins immediately locally, and asynchronously on child processes // Tracing begins immediately locally, and asynchronously on child processes
// as soon as they receive the BeginTracing request. // as soon as they receive the BeginTracing request.
// By default, all categories are traced except those matching "test_*".
// //
// If BeginTracing was already called previously, // If BeginTracing was already called previously,
// or if an EndTracingAsync is pending, // or if an EndTracingAsync is pending,
// or if another subscriber is tracing, // or if another subscriber is tracing,
// BeginTracing will return false meaning it failed. // BeginTracing will return false meaning it failed.
virtual bool BeginTracing(TraceSubscriber* subscriber) = 0; //
// |categories| is a comma-delimited list of category wildcards. // |categories| is a comma-delimited list of category wildcards.
// A category can have an optional '-' prefix to make it an excluded category. // A category can have an optional '-' prefix to make it an excluded category.
// All the same rules apply above, so for example, having both included and // All the same rules apply above, so for example, having both included and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment