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

Side by Side Diff: content/browser/tracing/background_tracing_manager_impl.cc

Issue 1165673002: [Startup Tracing] Hook up TraceConfig and remove CategoryFilter & TraceOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/tracing/background_tracing_manager_impl.h" 5 #include "content/browser/tracing/background_tracing_manager_impl.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "content/public/browser/background_tracing_preemptive_config.h" 8 #include "content/public/browser/background_tracing_preemptive_config.h"
9 #include "content/public/browser/background_tracing_reactive_config.h" 9 #include "content/public/browser/background_tracing_reactive_config.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 EnableRecordingIfConfigNeedsIt(); 112 EnableRecordingIfConfigNeedsIt();
113 113
114 return true; 114 return true;
115 } 115 }
116 116
117 void BackgroundTracingManagerImpl::EnableRecordingIfConfigNeedsIt() { 117 void BackgroundTracingManagerImpl::EnableRecordingIfConfigNeedsIt() {
118 if (!config_) 118 if (!config_)
119 return; 119 return;
120 120
121 if (config_->mode == BackgroundTracingConfig::PREEMPTIVE_TRACING_MODE) { 121 if (config_->mode == BackgroundTracingConfig::PREEMPTIVE_TRACING_MODE) {
122 EnableRecording(GetCategoryFilterForCategoryPreset( 122 EnableRecording(GetCategoryFilterStringForCategoryPreset(
123 static_cast<BackgroundTracingPreemptiveConfig*>(config_.get()) 123 static_cast<BackgroundTracingPreemptiveConfig*>(config_.get())
124 ->category_preset)); 124 ->category_preset));
125 } else { 125 } else {
126 // TODO(simonhatch): Implement reactive tracing path. 126 // TODO(simonhatch): Implement reactive tracing path.
127 NOTREACHED(); 127 NOTREACHED();
128 } 128 }
129 } 129 }
130 130
131 bool BackgroundTracingManagerImpl::IsAbleToTriggerTracing( 131 bool BackgroundTracingManagerImpl::IsAbleToTriggerTracing(
132 TriggerHandle handle) const { 132 TriggerHandle handle) const {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 trigger_handles_.begin(); 221 trigger_handles_.begin();
222 it != trigger_handles_.end(); ++it) 222 it != trigger_handles_.end(); ++it)
223 trigger_names->push_back(it->second); 223 trigger_names->push_back(it->second);
224 } 224 }
225 225
226 void BackgroundTracingManagerImpl::InvalidateTriggerHandlesForTesting() { 226 void BackgroundTracingManagerImpl::InvalidateTriggerHandlesForTesting() {
227 trigger_handles_.clear(); 227 trigger_handles_.clear();
228 } 228 }
229 229
230 void BackgroundTracingManagerImpl::EnableRecording( 230 void BackgroundTracingManagerImpl::EnableRecording(
231 base::trace_event::CategoryFilter category_filter) { 231 std::string category_filter_str) {
232 is_tracing_ = TracingController::GetInstance()->EnableRecording( 232 is_tracing_ = TracingController::GetInstance()->EnableRecording(
233 category_filter, 233 base::trace_event::TraceConfig(category_filter_str,
234 base::trace_event::TraceOptions(base::trace_event::RECORD_CONTINUOUSLY), 234 base::trace_event::RECORD_CONTINUOUSLY),
235 TracingController::EnableRecordingDoneCallback()); 235 TracingController::EnableRecordingDoneCallback());
236 } 236 }
237 237
238 void BackgroundTracingManagerImpl::OnFinalizeStarted( 238 void BackgroundTracingManagerImpl::OnFinalizeStarted(
239 scoped_refptr<base::RefCountedString> file_contents) { 239 scoped_refptr<base::RefCountedString> file_contents) {
240 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 240 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
241 241
242 if (!receive_callback_.is_null()) 242 if (!receive_callback_.is_null())
243 receive_callback_.Run( 243 receive_callback_.Run(
244 file_contents.get(), 244 file_contents.get(),
(...skipping 27 matching lines...) Expand all
272 is_tracing_ = false; 272 is_tracing_ = false;
273 273
274 content::TracingController::GetInstance()->DisableRecording( 274 content::TracingController::GetInstance()->DisableRecording(
275 content::TracingController::CreateCompressedStringSink( 275 content::TracingController::CreateCompressedStringSink(
276 data_endpoint_wrapper_)); 276 data_endpoint_wrapper_));
277 277
278 if (!callback.is_null()) 278 if (!callback.is_null())
279 callback.Run(true); 279 callback.Run(true);
280 } 280 }
281 281
282 base::trace_event::CategoryFilter 282 std::string
283 BackgroundTracingManagerImpl::GetCategoryFilterForCategoryPreset( 283 BackgroundTracingManagerImpl::GetCategoryFilterStringForCategoryPreset(
284 BackgroundTracingConfig::CategoryPreset preset) const { 284 BackgroundTracingConfig::CategoryPreset preset) const {
285 switch (preset) { 285 switch (preset) {
286 case BackgroundTracingConfig::CategoryPreset::BENCHMARK: 286 case BackgroundTracingConfig::CategoryPreset::BENCHMARK:
287 return base::trace_event::CategoryFilter( 287 return "benchmark,"
288 "benchmark," 288 "disabled-by-default-toplevel.flow,"
289 "disabled-by-default-toplevel.flow," 289 "disabled-by-default-ipc.flow";
290 "disabled-by-default-ipc.flow");
291 case BackgroundTracingConfig::CategoryPreset::BENCHMARK_DEEP: 290 case BackgroundTracingConfig::CategoryPreset::BENCHMARK_DEEP:
292 return base::trace_event::CategoryFilter( 291 return "*,disabled-by-default-blink.debug.layout";
293 "*,disabled-by-default-blink.debug.layout");
294 } 292 }
295 NOTREACHED(); 293 NOTREACHED();
296 return base::trace_event::CategoryFilter(); 294 return "";
297 } 295 }
298 296
299 scoped_ptr<BackgroundTracingConfig> BackgroundTracingConfig::FromDict( 297 scoped_ptr<BackgroundTracingConfig> BackgroundTracingConfig::FromDict(
300 const base::DictionaryValue* dict) { 298 const base::DictionaryValue* dict) {
301 // TODO(simonhatch): Implement this. 299 // TODO(simonhatch): Implement this.
302 CHECK(false); 300 CHECK(false);
303 return NULL; 301 return NULL;
304 } 302 }
305 303
306 void BackgroundTracingConfig::IntoDict(const BackgroundTracingConfig* config, 304 void BackgroundTracingConfig::IntoDict(const BackgroundTracingConfig* config,
307 base::DictionaryValue* dict) { 305 base::DictionaryValue* dict) {
308 // TODO(simonhatch): Implement this. 306 // TODO(simonhatch): Implement this.
309 CHECK(false); 307 CHECK(false);
310 } 308 }
311 309
312 } // namspace content 310 } // namspace content
OLDNEW
« no previous file with comments | « content/browser/tracing/background_tracing_manager_impl.h ('k') | content/browser/tracing/trace_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698