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

Side by Side Diff: chrome/test/base/tracing.cc

Issue 2047533002: [tracing] Add browser test for background memory tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@set_whitelist
Patch Set: Remove single proc tests. Created 4 years, 6 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
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 "chrome/test/base/tracing.h" 5 #include "chrome/test/base/tracing.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 public: 48 public:
49 static InProcessTraceController* GetInstance() { 49 static InProcessTraceController* GetInstance() {
50 return base::Singleton<InProcessTraceController>::get(); 50 return base::Singleton<InProcessTraceController>::get();
51 } 51 }
52 52
53 InProcessTraceController() 53 InProcessTraceController()
54 : is_waiting_on_watch_(false), 54 : is_waiting_on_watch_(false),
55 watch_notification_count_(0) {} 55 watch_notification_count_(0) {}
56 virtual ~InProcessTraceController() {} 56 virtual ~InProcessTraceController() {}
57 57
58 bool BeginTracing(const std::string& category_patterns) { 58 bool BeginTracing(const base::trace_event::TraceConfig& trace_config) {
59 DCHECK_CURRENTLY_ON(BrowserThread::UI); 59 DCHECK_CURRENTLY_ON(BrowserThread::UI);
60 return content::TracingController::GetInstance()->StartTracing( 60 return content::TracingController::GetInstance()->StartTracing(
61 base::trace_event::TraceConfig(category_patterns, ""), 61 trace_config, content::TracingController::StartTracingDoneCallback());
62 content::TracingController::StartTracingDoneCallback());
63 } 62 }
64 63
65 bool BeginTracingWithWatch(const std::string& category_patterns, 64 bool BeginTracingWithWatch(const std::string& category_patterns,
66 const std::string& category_name, 65 const std::string& category_name,
67 const std::string& event_name, 66 const std::string& event_name,
68 int num_occurrences) { 67 int num_occurrences) {
69 DCHECK_CURRENTLY_ON(BrowserThread::UI); 68 DCHECK_CURRENTLY_ON(BrowserThread::UI);
70 DCHECK(num_occurrences > 0); 69 DCHECK(num_occurrences > 0);
71 watch_notification_count_ = num_occurrences; 70 watch_notification_count_ = num_occurrences;
72 if (!content::TracingController::GetInstance()->SetWatchEvent( 71 if (!content::TracingController::GetInstance()->SetWatchEvent(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 bool is_waiting_on_watch_; 156 bool is_waiting_on_watch_;
158 int watch_notification_count_; 157 int watch_notification_count_;
159 158
160 DISALLOW_COPY_AND_ASSIGN(InProcessTraceController); 159 DISALLOW_COPY_AND_ASSIGN(InProcessTraceController);
161 }; 160 };
162 161
163 } // namespace 162 } // namespace
164 163
165 namespace tracing { 164 namespace tracing {
166 165
167 bool BeginTracing(const std::string& category_patterns) { 166 bool BeginTracing(const base::trace_event::TraceConfig& trace_config) {
168 return InProcessTraceController::GetInstance()->BeginTracing( 167 return InProcessTraceController::GetInstance()->BeginTracing(trace_config);
169 category_patterns);
170 } 168 }
171 169
172 bool BeginTracingWithWatch(const std::string& category_patterns, 170 bool BeginTracingWithWatch(const std::string& category_patterns,
173 const std::string& category_name, 171 const std::string& category_name,
174 const std::string& event_name, 172 const std::string& event_name,
175 int num_occurrences) { 173 int num_occurrences) {
176 return InProcessTraceController::GetInstance()->BeginTracingWithWatch( 174 return InProcessTraceController::GetInstance()->BeginTracingWithWatch(
177 category_patterns, category_name, event_name, num_occurrences); 175 category_patterns, category_name, event_name, num_occurrences);
178 } 176 }
179 177
180 bool WaitForWatchEvent(base::TimeDelta timeout) { 178 bool WaitForWatchEvent(base::TimeDelta timeout) {
181 return InProcessTraceController::GetInstance()->WaitForWatchEvent(timeout); 179 return InProcessTraceController::GetInstance()->WaitForWatchEvent(timeout);
182 } 180 }
183 181
184 bool EndTracing(std::string* json_trace_output) { 182 bool EndTracing(std::string* json_trace_output) {
185 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output); 183 return InProcessTraceController::GetInstance()->EndTracing(json_trace_output);
186 } 184 }
187 185
188 } // namespace tracing 186 } // namespace tracing
189 187
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698