Use UintToString() for unsigned values.
[chromium-blink-merge.git] / base / trace_event / memory_dump_request_args.cc
blob48b5ba6d2c0c76314a435e3a18304b91cc63a351
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
3 // found in the LICENSE file.
5 #include "base/trace_event/memory_dump_request_args.h"
7 #include "base/logging.h"
9 namespace base {
10 namespace trace_event {
12 // static
13 const char* MemoryDumpTypeToString(const MemoryDumpType& dump_type) {
14 switch (dump_type) {
15 case MemoryDumpType::TASK_BEGIN:
16 return "task_begin";
17 case MemoryDumpType::TASK_END:
18 return "task_end";
19 case MemoryDumpType::PERIODIC_INTERVAL:
20 return "periodic_interval";
21 case MemoryDumpType::EXPLICITLY_TRIGGERED:
22 return "explicitly_triggered";
24 NOTREACHED();
25 return "unknown";
28 const char* MemoryDumpLevelOfDetailToString(
29 const MemoryDumpLevelOfDetail& level_of_detail) {
30 switch (level_of_detail) {
31 case MemoryDumpLevelOfDetail::LIGHT:
32 return "light";
33 case MemoryDumpLevelOfDetail::DETAILED:
34 return "detailed";
36 NOTREACHED();
37 return "unknown";
40 MemoryDumpLevelOfDetail StringToMemoryDumpLevelOfDetail(
41 const std::string& str) {
42 if (str == "light")
43 return MemoryDumpLevelOfDetail::LIGHT;
44 if (str == "detailed")
45 return MemoryDumpLevelOfDetail::DETAILED;
46 NOTREACHED();
47 return MemoryDumpLevelOfDetail::LAST;
50 } // namespace trace_event
51 } // namespace base