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

Unified Diff: base/trace_event/trace_config.cc

Issue 1337943003: [tracing] Non-functional refactor of memory dump arg names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows test Created 5 years, 3 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 | « base/trace_event/trace_config.h ('k') | base/trace_event/trace_config_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_config.cc
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
index fe822a6635f825f4b24525c5ba97ab53a6d68f5c..9f0367bd2a21b09789ac81f060639f375caf1f73 100644
--- a/base/trace_event/trace_config.cc
+++ b/base/trace_event/trace_config.cc
@@ -11,6 +11,7 @@
#include "base/strings/string_tokenizer.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/memory_dump_manager.h"
+#include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/trace_event.h"
namespace base {
@@ -44,16 +45,14 @@ const char kMemoryDumpConfigParam[] = "memory_dump_config";
const char kTriggersParam[] = "triggers";
const char kPeriodicIntervalParam[] = "periodic_interval_ms";
const char kModeParam[] = "mode";
-const char kDetailedParam[] = "detailed";
-const char kLightParam[] = "light";
// Default configuration of memory dumps.
const TraceConfig::MemoryDumpTriggerConfig kDefaultHeavyMemoryDumpTrigger = {
2000, // periodic_interval_ms
- MemoryDumpArgs::LevelOfDetail::HIGH};
+ MemoryDumpLevelOfDetail::DETAILED};
const TraceConfig::MemoryDumpTriggerConfig kDefaultLightMemoryDumpTrigger = {
250, // periodic_interval_ms
- MemoryDumpArgs::LevelOfDetail::LOW};
+ MemoryDumpLevelOfDetail::LIGHT};
} // namespace
@@ -465,7 +464,6 @@ void TraceConfig::SetMemoryDumpConfig(
continue;
MemoryDumpTriggerConfig dump_config;
- std::string dump_type;
int interval = 0;
if (!trigger->GetInteger(kPeriodicIntervalParam, &interval)) {
@@ -473,14 +471,10 @@ void TraceConfig::SetMemoryDumpConfig(
}
DCHECK_GT(interval, 0);
dump_config.periodic_interval_ms = static_cast<uint32>(interval);
- dump_config.level_of_detail = MemoryDumpArgs::LevelOfDetail::LOW;
-
- if (trigger->GetString(kModeParam, &dump_type)) {
- if (dump_type == kDetailedParam) {
- dump_config.level_of_detail = MemoryDumpArgs::LevelOfDetail::HIGH;
- }
- }
-
+ std::string level_of_detail_str;
+ trigger->GetString(kModeParam, &level_of_detail_str);
+ dump_config.level_of_detail =
+ StringToMemoryDumpLevelOfDetail(level_of_detail_str);
memory_dump_config_.push_back(dump_config);
}
}
@@ -541,17 +535,8 @@ void TraceConfig::ToDict(base::DictionaryValue& dict) const {
new base::DictionaryValue());
trigger_dict->SetInteger(kPeriodicIntervalParam,
static_cast<int>(config.periodic_interval_ms));
-
- switch (config.level_of_detail) {
- case MemoryDumpArgs::LevelOfDetail::LOW:
- trigger_dict->SetString(kModeParam, kLightParam);
- break;
- case MemoryDumpArgs::LevelOfDetail::HIGH:
- trigger_dict->SetString(kModeParam, kDetailedParam);
- break;
- default:
- NOTREACHED();
- }
+ trigger_dict->SetString(
+ kModeParam, MemoryDumpLevelOfDetailToString(config.level_of_detail));
triggers_list->Append(trigger_dict.Pass());
}
« no previous file with comments | « base/trace_event/trace_config.h ('k') | base/trace_event/trace_config_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698