| 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 | |
| 110 bool enable_systrace; | 92 bool enable_systrace; |
| 111 options_ok &= options->GetBoolean("useSystemTracing", &enable_systrace); | 93 options_ok &= options->GetBoolean("useSystemTracing", &enable_systrace); |
| 112 if (enable_systrace) | 94 if (enable_systrace) |
| 113 trace_config->EnableSystrace(); | 95 trace_config->EnableSystrace(); |
| 114 | 96 |
| 115 if (!options_ok) { | 97 if (!options_ok) { |
| 116 LOG(ERROR) << "Malformed options"; | 98 LOG(ERROR) << "Malformed options"; |
| 117 return false; | 99 return false; |
| 118 } | 100 } |
| 119 return true; | 101 return true; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 web_ui()->CallJavascriptFunctionUnsafe("onUploadComplete", | 307 web_ui()->CallJavascriptFunctionUnsafe("onUploadComplete", |
| 326 base::Value(feedback)); | 308 base::Value(feedback)); |
| 327 } else { | 309 } else { |
| 328 web_ui()->CallJavascriptFunctionUnsafe("onUploadError", | 310 web_ui()->CallJavascriptFunctionUnsafe("onUploadError", |
| 329 base::Value(feedback)); | 311 base::Value(feedback)); |
| 330 } | 312 } |
| 331 trace_uploader_.reset(); | 313 trace_uploader_.reset(); |
| 332 } | 314 } |
| 333 | 315 |
| 334 } // namespace content | 316 } // namespace content |
| OLD | NEW |