OLD | NEW |
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 "base/trace_event/memory_dump_request_args.h" | 5 #include "base/trace_event/memory_dump_request_args.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 namespace trace_event { | 10 namespace trace_event { |
11 | 11 |
12 // static | 12 // static |
13 const char* MemoryDumpTypeToString( | 13 const char* MemoryDumpTypeToString(const MemoryDumpType& dump_type) { |
14 const MemoryDumpType& dump_type) { | |
15 switch (dump_type) { | 14 switch (dump_type) { |
16 case MemoryDumpType::TASK_BEGIN: | 15 case MemoryDumpType::TASK_BEGIN: |
17 return "TASK_BEGIN"; | 16 return "task_begin"; |
18 case MemoryDumpType::TASK_END: | 17 case MemoryDumpType::TASK_END: |
19 return "TASK_END"; | 18 return "task_end"; |
20 case MemoryDumpType::PERIODIC_INTERVAL: | 19 case MemoryDumpType::PERIODIC_INTERVAL: |
21 return "PERIODIC_INTERVAL"; | 20 return "periodic_interval"; |
22 case MemoryDumpType::EXPLICITLY_TRIGGERED: | 21 case MemoryDumpType::EXPLICITLY_TRIGGERED: |
23 return "EXPLICITLY_TRIGGERED"; | 22 return "explicitly_triggered"; |
24 } | 23 } |
25 NOTREACHED(); | 24 NOTREACHED(); |
26 return "UNKNOWN"; | 25 return "unknown"; |
| 26 } |
| 27 |
| 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"; |
| 35 } |
| 36 NOTREACHED(); |
| 37 return "unknown"; |
| 38 } |
| 39 |
| 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; |
27 } | 48 } |
28 | 49 |
29 } // namespace trace_event | 50 } // namespace trace_event |
30 } // namespace base | 51 } // namespace base |
OLD | NEW |