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

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

Issue 2440443002: tracing: remove WatchEvent feature (Closed)
Patch Set: Created 4 years, 2 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 | « chrome/test/base/tracing.h ('k') | chrome/test/base/tracing_browsertest.cc » ('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 51570a2aa5ddf7ee46f9f8de25cf16adb320ef71..f210652a5aaba2190ae6c3c60322b543bacc5bcc 100644
--- a/chrome/test/base/tracing.cc
+++ b/chrome/test/base/tracing.cc
@@ -50,9 +50,7 @@ class InProcessTraceController {
return base::Singleton<InProcessTraceController>::get();
}
- InProcessTraceController()
- : is_waiting_on_watch_(false),
- watch_notification_count_(0) {}
+ InProcessTraceController() {}
virtual ~InProcessTraceController() {}
bool BeginTracing(const base::trace_event::TraceConfig& trace_config) {
@@ -61,49 +59,6 @@ class InProcessTraceController {
trace_config, content::TracingController::StartTracingDoneCallback());
}
- bool BeginTracingWithWatch(const std::string& category_patterns,
- const std::string& category_name,
- const std::string& event_name,
- int num_occurrences) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- DCHECK(num_occurrences > 0);
- watch_notification_count_ = num_occurrences;
- if (!content::TracingController::GetInstance()->SetWatchEvent(
- category_name, event_name,
- base::Bind(&InProcessTraceController::OnWatchEventMatched,
- base::Unretained(this)))) {
- return false;
- }
- if (!content::TracingController::GetInstance()->StartTracing(
- base::trace_event::TraceConfig(category_patterns, ""),
- 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) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (watch_notification_count_ == 0)
- return true;
-
- if (!timeout.is_zero()) {
- timer_.Start(FROM_HERE, timeout, this,
- &InProcessTraceController::Timeout);
- }
-
- is_waiting_on_watch_ = true;
- message_loop_runner_ = new content::MessageLoopRunner;
- message_loop_runner_->Run();
- is_waiting_on_watch_ = false;
-
- return watch_notification_count_ == 0;
- }
-
bool EndTracing(std::string* json_trace_output) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
using namespace base::debug;
@@ -119,9 +74,6 @@ class InProcessTraceController {
message_loop_runner_ = new content::MessageLoopRunner;
message_loop_runner_->Run();
- // Watch notifications can occur during this method's message loop run, but
- // not after, so clear them here.
- watch_notification_count_ = 0;
return true;
}
@@ -134,28 +86,10 @@ class InProcessTraceController {
void OnTracingComplete() { message_loop_runner_->Quit(); }
- void OnWatchEventMatched() {
- if (watch_notification_count_ == 0)
- return;
- if (--watch_notification_count_ == 0) {
- timer_.Stop();
- if (is_waiting_on_watch_)
- message_loop_runner_->Quit();
- }
- }
-
- void Timeout() {
- DCHECK(is_waiting_on_watch_);
- message_loop_runner_->Quit();
- }
-
scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
base::OneShotTimer timer_;
- bool is_waiting_on_watch_;
- int watch_notification_count_;
-
DISALLOW_COPY_AND_ASSIGN(InProcessTraceController);
};
@@ -168,26 +102,13 @@ bool BeginTracing(const std::string& category_patterns) {
base::trace_event::TraceConfig(category_patterns, ""));
}
-bool BeginTracingWithWatch(const std::string& category_patterns,
- const std::string& category_name,
- const std::string& event_name,
- int num_occurrences) {
- return InProcessTraceController::GetInstance()->BeginTracingWithWatch(
- category_patterns, category_name, event_name, num_occurrences);
-}
-
bool BeginTracingWithTraceConfig(
const base::trace_event::TraceConfig& trace_config) {
return InProcessTraceController::GetInstance()->BeginTracing(trace_config);
}
-bool WaitForWatchEvent(base::TimeDelta timeout) {
- return InProcessTraceController::GetInstance()->WaitForWatchEvent(timeout);
-}
-
bool EndTracing(std::string* json_trace_output) {
return InProcessTraceController::GetInstance()->EndTracing(json_trace_output);
}
} // namespace tracing
-
« no previous file with comments | « chrome/test/base/tracing.h ('k') | chrome/test/base/tracing_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698