diff options
author | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 20:04:13 +0000 |
---|---|---|
committer | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 20:04:13 +0000 |
commit | 820d851f56e3712a2f9ac7db545601d1b0355718 (patch) | |
tree | 18f4af5173da3f78086b409fa4ae9ceefb3f9f71 /content/browser/trace_controller.cc | |
parent | 91c3c300069d27c6ec8749636fec1c4c9018b29f (diff) | |
download | chromium_src-820d851f56e3712a2f9ac7db545601d1b0355718.zip chromium_src-820d851f56e3712a2f9ac7db545601d1b0355718.tar.gz chromium_src-820d851f56e3712a2f9ac7db545601d1b0355718.tar.bz2 |
Merge gpu_trace_event back into base/debug/trace_event.
Initial land attempt at http://codereview.chromium.org/6551019/
gpu_trace_event fork at http://codereview.chromium.org/6691013
- gpu_trace_event renamed to base/debug/trace_event and modified as appropriate for base::debug
- Unit Tests implemented for trace_event
- gpu_common library removed (was added only for gpu_trace_event)
- Existing calls to trace_event suffixed with _ETW to make ETW calls (see decisions and incremental plans at end of 6551019)
- GPU trace calls renamed to new calls.
- Tracing switch removed from test_shell, as linux log file support removed.
BUG=79509
TEST=trace_event_win_unittest and about:gpu
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=84284
Review URL: http://codereview.chromium.org/6862002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/trace_controller.cc')
-rw-r--r-- | content/browser/trace_controller.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/content/browser/trace_controller.cc b/content/browser/trace_controller.cc index 5bf2efa..f04f4b2 100644 --- a/content/browser/trace_controller.cc +++ b/content/browser/trace_controller.cc @@ -4,11 +4,12 @@ #include "content/browser/trace_controller.h" +#include "base/bind.h" +#include "base/debug/trace_event.h" #include "base/task.h" #include "content/browser/browser_message_filter.h" #include "content/browser/trace_message_filter.h" #include "content/common/child_process_messages.h" -#include "gpu/common/gpu_trace_event.h" TraceController::TraceController() : @@ -17,12 +18,14 @@ TraceController::TraceController() : pending_bpf_ack_count_(0), maximum_bpf_(0.0f), is_tracing_(false) { - gpu::TraceLog::GetInstance()->SetOutputCallback( - NewCallback(this, &TraceController::OnTraceDataCollected)); + base::debug::TraceLog::GetInstance()->SetOutputCallback( + base::Bind(&TraceController::OnTraceDataCollected, + base::Unretained(this))); } TraceController::~TraceController() { - gpu::TraceLog::GetInstance()->SetOutputCallback(NULL); + if (base::debug::TraceLog* trace_log = base::debug::TraceLog::GetInstance()) + trace_log->SetOutputCallback(base::debug::TraceLog::OutputCallback()); } //static @@ -41,7 +44,7 @@ bool TraceController::BeginTracing(TraceSubscriber* subscriber) { // Enable tracing is_tracing_ = true; - gpu::TraceLog::GetInstance()->SetEnabled(true); + base::debug::TraceLog::GetInstance()->SetEnabled(true); // Notify all child processes. for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { @@ -92,7 +95,7 @@ bool TraceController::GetTraceBufferPercentFullAsync( // Handle special case of zero child processes. if (pending_bpf_ack_count_ == 1) { // Ack asynchronously now, because we don't have any children to wait for. - float bpf = gpu::TraceLog::GetInstance()->GetBufferPercentFull(); + float bpf = base::debug::TraceLog::GetInstance()->GetBufferPercentFull(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod(this, &TraceController::OnTraceBufferPercentFullReply, @@ -161,7 +164,7 @@ void TraceController::OnEndTracingAck() { // called with the last of the local trace data. Since we are on the UI // thread, the call to OnTraceDataCollected will be synchronous, so we can // immediately call OnEndTracingComplete below. - gpu::TraceLog::GetInstance()->SetEnabled(false); + base::debug::TraceLog::GetInstance()->SetEnabled(false); // Trigger callback if one is set. if (subscriber_) { @@ -179,17 +182,21 @@ void TraceController::OnEndTracingAck() { } } -void TraceController::OnTraceDataCollected(const std::string& data) { +void TraceController::OnTraceDataCollected( + const scoped_refptr<base::debug::TraceLog::RefCountedString>& + json_events_str_ptr) { // OnTraceDataCollected may be called from any browser thread, either by the // local event trace system or from child processes via TraceMessageFilter. if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &TraceController::OnTraceDataCollected, data)); + NewRunnableMethod(this, + &TraceController::OnTraceDataCollected, + json_events_str_ptr)); return; } if (subscriber_) - subscriber_->OnTraceDataCollected(data); + subscriber_->OnTraceDataCollected(json_events_str_ptr->data); } void TraceController::OnTraceBufferFull() { @@ -229,7 +236,7 @@ void TraceController::OnTraceBufferPercentFullReply(float percent_full) { if (pending_bpf_ack_count_ == 1) { // The last ack represents local trace, so we need to ack it now. Note that // this code only executes if there were child processes. - float bpf = gpu::TraceLog::GetInstance()->GetBufferPercentFull(); + float bpf = base::debug::TraceLog::GetInstance()->GetBufferPercentFull(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod(this, &TraceController::OnTraceBufferPercentFullReply, |