| OLD | NEW |
| 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 "chrome/test/base/tracing.h" | 5 #include "chrome/test/base/tracing.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 InProcessTraceController() | 25 InProcessTraceController() |
| 26 : is_waiting_on_watch_(false), | 26 : is_waiting_on_watch_(false), |
| 27 watch_notification_count_(0) {} | 27 watch_notification_count_(0) {} |
| 28 virtual ~InProcessTraceController() {} | 28 virtual ~InProcessTraceController() {} |
| 29 | 29 |
| 30 bool BeginTracing(const std::string& categories) { | 30 bool BeginTracing(const std::string& categories) { |
| 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 32 return content::TraceController::GetInstance()->BeginTracing( | 32 return content::TraceController::GetInstance()->BeginTracing( |
| 33 this, categories); | 33 this, categories, base::debug::TraceLog::RECORD_UNTIL_FULL); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool BeginTracingWithWatch(const std::string& categories, | 36 bool BeginTracingWithWatch(const std::string& categories, |
| 37 const std::string& category_name, | 37 const std::string& category_name, |
| 38 const std::string& event_name, | 38 const std::string& event_name, |
| 39 int num_occurrences) { | 39 int num_occurrences) { |
| 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 41 DCHECK(num_occurrences > 0); | 41 DCHECK(num_occurrences > 0); |
| 42 watch_notification_count_ = num_occurrences; | 42 watch_notification_count_ = num_occurrences; |
| 43 return BeginTracing(categories) && | 43 return BeginTracing(categories) && |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 bool WaitForWatchEvent(base::TimeDelta timeout) { | 150 bool WaitForWatchEvent(base::TimeDelta timeout) { |
| 151 return InProcessTraceController::GetInstance()->WaitForWatchEvent(timeout); | 151 return InProcessTraceController::GetInstance()->WaitForWatchEvent(timeout); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool EndTracing(std::string* json_trace_output) { | 154 bool EndTracing(std::string* json_trace_output) { |
| 155 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output); | 155 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace tracing | 158 } // namespace tracing |
| 159 | 159 |
| OLD | NEW |