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 "content/browser/tracing/tracing_ui.h" | 5 #include "content/browser/tracing/tracing_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool options_ok = true; | 82 bool options_ok = true; |
83 std::string category_filter_string; | 83 std::string category_filter_string; |
84 options_ok &= options->GetString("categoryFilter", &category_filter_string); | 84 options_ok &= options->GetString("categoryFilter", &category_filter_string); |
85 | 85 |
86 std::string record_mode; | 86 std::string record_mode; |
87 options_ok &= options->GetString("tracingRecordMode", &record_mode); | 87 options_ok &= options->GetString("tracingRecordMode", &record_mode); |
88 | 88 |
89 *trace_config = base::trace_event::TraceConfig(category_filter_string, | 89 *trace_config = base::trace_event::TraceConfig(category_filter_string, |
90 record_mode); | 90 record_mode); |
91 | 91 |
| 92 // When enabling memory-infra via tracing, use periodic dumping to trigger a |
| 93 // detailed dump every 5s. |
| 94 if (trace_config->IsCategoryGroupEnabled( |
| 95 base::trace_event::MemoryDumpManager::kTraceCategory)) { |
| 96 base::trace_event::TraceConfig::MemoryDumpConfig::Trigger trigger = { |
| 97 5000, // min_time_between_dumps_ms |
| 98 base::trace_event::MemoryDumpLevelOfDetail::DETAILED, |
| 99 base::trace_event::MemoryDumpType::PERIODIC_INTERVAL}; |
| 100 base::trace_event::TraceConfig::MemoryDumpConfig memory_dump_config; |
| 101 memory_dump_config.triggers.push_back(trigger); |
| 102 |
| 103 // TODO(ssid): Make a newly constructed MemoryDumpConfig use the default |
| 104 // dump modes. |
| 105 memory_dump_config.allowed_dump_modes.insert( |
| 106 base::trace_event::MemoryDumpLevelOfDetail::DETAILED); |
| 107 trace_config->ResetMemoryDumpConfig(memory_dump_config); |
| 108 } |
| 109 |
92 bool enable_systrace; | 110 bool enable_systrace; |
93 options_ok &= options->GetBoolean("useSystemTracing", &enable_systrace); | 111 options_ok &= options->GetBoolean("useSystemTracing", &enable_systrace); |
94 if (enable_systrace) | 112 if (enable_systrace) |
95 trace_config->EnableSystrace(); | 113 trace_config->EnableSystrace(); |
96 | 114 |
97 if (!options_ok) { | 115 if (!options_ok) { |
98 LOG(ERROR) << "Malformed options"; | 116 LOG(ERROR) << "Malformed options"; |
99 return false; | 117 return false; |
100 } | 118 } |
101 return true; | 119 return true; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 web_ui()->CallJavascriptFunctionUnsafe("onUploadComplete", | 325 web_ui()->CallJavascriptFunctionUnsafe("onUploadComplete", |
308 base::Value(feedback)); | 326 base::Value(feedback)); |
309 } else { | 327 } else { |
310 web_ui()->CallJavascriptFunctionUnsafe("onUploadError", | 328 web_ui()->CallJavascriptFunctionUnsafe("onUploadError", |
311 base::Value(feedback)); | 329 base::Value(feedback)); |
312 } | 330 } |
313 trace_uploader_.reset(); | 331 trace_uploader_.reset(); |
314 } | 332 } |
315 | 333 |
316 } // namespace content | 334 } // namespace content |
OLD | NEW |