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

Side by Side Diff: content/browser/trace_controller_impl.cc

Issue 10855062: Allow use of the chrome trace categories string from the tracing ui internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/trace_controller_impl.h ('k') | content/public/browser/trace_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/trace_controller_impl.h" 5 #include "content/browser/trace_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 base::TimeDelta::FromSeconds(delay_secs)); 102 base::TimeDelta::FromSeconds(delay_secs));
103 } 103 }
104 104
105 bool TraceControllerImpl::GetKnownCategoriesAsync(TraceSubscriber* subscriber) { 105 bool TraceControllerImpl::GetKnownCategoriesAsync(TraceSubscriber* subscriber) {
106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
107 107
108 // Known categories come back from child processes with the EndTracingAck 108 // Known categories come back from child processes with the EndTracingAck
109 // message. So to get known categories, just begin and end tracing immediately 109 // message. So to get known categories, just begin and end tracing immediately
110 // afterwards. This will ping all the child processes for categories. 110 // afterwards. This will ping all the child processes for categories.
111 is_get_categories_ = true; 111 is_get_categories_ = true;
112 bool success = BeginTracing(subscriber) && EndTracingAsync(subscriber); 112 bool success = BeginTracing(subscriber, "-test_*") &&
jbates 2012/08/09 00:44:06 I think the category string should just be "*".
Russ Harmon 2012/08/09 00:45:32 Ok. I was preserving the existing behavior since I
113 EndTracingAsync(subscriber);
113 is_get_categories_ = success; 114 is_get_categories_ = success;
114 return success; 115 return success;
115 } 116 }
116 117
117 bool TraceControllerImpl::BeginTracing(TraceSubscriber* subscriber) {
118 std::vector<std::string> include, exclude;
119 // By default, exclude all categories that begin with test_
120 exclude.push_back("test_*");
121 return BeginTracing(subscriber, include, exclude);
122 }
123
124 bool TraceControllerImpl::BeginTracing( 118 bool TraceControllerImpl::BeginTracing(
125 TraceSubscriber* subscriber, 119 TraceSubscriber* subscriber,
126 const std::vector<std::string>& included_categories, 120 const std::vector<std::string>& included_categories,
127 const std::vector<std::string>& excluded_categories) { 121 const std::vector<std::string>& excluded_categories) {
128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
129 123
130 if (!can_begin_tracing(subscriber)) 124 if (!can_begin_tracing(subscriber))
131 return false; 125 return false;
132 126
133 // Enable tracing 127 // Enable tracing
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // The last ack represents local trace, so we need to ack it now. Note that 356 // The last ack represents local trace, so we need to ack it now. Note that
363 // this code only executes if there were child processes. 357 // this code only executes if there were child processes.
364 float bpf = TraceLog::GetInstance()->GetBufferPercentFull(); 358 float bpf = TraceLog::GetInstance()->GetBufferPercentFull();
365 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 359 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
366 base::Bind(&TraceControllerImpl::OnTraceBufferPercentFullReply, 360 base::Bind(&TraceControllerImpl::OnTraceBufferPercentFullReply,
367 base::Unretained(this), bpf)); 361 base::Unretained(this), bpf));
368 } 362 }
369 } 363 }
370 364
371 } // namespace content 365 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/trace_controller_impl.h ('k') | content/public/browser/trace_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698