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

Unified Diff: chrome/test/base/tracing.cc

Issue 105893004: Sampling profiling thread should be joined in a FILE thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | content/browser/tracing/tracing_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/tracing.cc
diff --git a/chrome/test/base/tracing.cc b/chrome/test/base/tracing.cc
index 5aa07e7e4d6f287e8de7564f6a258e09dd087e63..87e6aaa34342a684e1e3775b93c5ccb7320414ce 100644
--- a/chrome/test/base/tracing.cc
+++ b/chrome/test/base/tracing.cc
@@ -34,7 +34,6 @@ class InProcessTraceController {
return content::TracingController::GetInstance()->EnableRecording(
category_patterns, content::TracingController::DEFAULT_OPTIONS,
content::TracingController::EnableRecordingDoneCallback());
- return true;
}
bool BeginTracingWithWatch(const std::string& category_patterns,
@@ -44,11 +43,22 @@ class InProcessTraceController {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(num_occurrences > 0);
watch_notification_count_ = num_occurrences;
- return content::TracingController::GetInstance()->SetWatchEvent(
- category_name, event_name,
- base::Bind(&InProcessTraceController::OnWatchEventMatched,
- base::Unretained(this))) &&
- BeginTracing(category_patterns);
+ if (!content::TracingController::GetInstance()->SetWatchEvent(
+ category_name, event_name,
+ base::Bind(&InProcessTraceController::OnWatchEventMatched,
+ base::Unretained(this)))) {
sky 2014/01/06 18:14:24 How do you know unretained is safe here and on 55?
haraken 2014/01/07 02:04:43 InProcessTraceController is a Singleton, so I thin
+ return false;
+ }
+ if (!content::TracingController::GetInstance()->EnableRecording(
+ category_patterns, content::TracingController::DEFAULT_OPTIONS,
+ base::Bind(&InProcessTraceController::OnEnableTracingComplete,
+ base::Unretained(this)))) {
+ return false;
+ }
+
+ message_loop_runner_ = new content::MessageLoopRunner;
+ message_loop_runner_->Run();
+ return true;
}
bool WaitForWatchEvent(base::TimeDelta timeout) {
@@ -93,6 +103,10 @@ class InProcessTraceController {
private:
friend struct DefaultSingletonTraits<InProcessTraceController>;
+ void OnEnableTracingComplete() {
+ message_loop_runner_->Quit();
+ }
+
void OnEndTracingComplete() {
message_loop_runner_->Quit();
}
« no previous file with comments | « no previous file | content/browser/tracing/tracing_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698