OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CHROMECAST_CRASH_DUMP_INFO_H_ | |
6 #define CHROMECAST_CRASH_DUMP_INFO_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 | |
12 namespace chromecast { | |
13 | |
14 struct MinidumpParams { | |
gunsch
2015/06/09 18:46:19
This struct could/should be in its own file. This
slan
2015/06/10 01:49:13
Done.
| |
15 MinidumpParams(); | |
16 MinidumpParams(const std::string& p_process_name, | |
17 const uint64_t p_process_uptime, | |
18 const std::string& p_suffix, | |
19 const std::string& p_previous_app_name, | |
20 const std::string& p_current_app_name, | |
21 const std::string& p_last_app_name, | |
22 const std::string& p_cast_release_version, | |
23 const std::string& p_cast_build_number); | |
24 MinidumpParams(const MinidumpParams& params); | |
25 ~MinidumpParams(); | |
26 | |
27 std::string process_name; | |
28 uint64_t process_uptime; | |
29 std::string suffix; | |
30 std::string previous_app_name; | |
31 std::string current_app_name; | |
32 std::string last_app_name; | |
33 // Release version is in the format of "major.minor", such as "1.15". | |
34 std::string cast_release_version; | |
35 // Build number is numerical string such as "20000". | |
36 std::string cast_build_number; | |
37 }; | |
38 | |
39 // Class that encapsulates the construction and parsing of dump entries | |
40 // in the log file. | |
41 class DumpInfo { | |
42 public: | |
43 // Attempt to construct a DumpInfo object by parsing the given entry string | |
44 // and extracting the contained information and populate the relevant | |
45 // fields. | |
46 explicit DumpInfo(const std::string& entry); | |
47 | |
48 // Attempt to construct a DumpInfo object that has the following info: | |
49 // | |
50 // -crashed_process_dump: the full path of the dump written | |
51 // -crashed_process_logfile: the full path of the logfile written | |
52 // -dump_time: the time of the dump written | |
53 // -params: a structure containing other useful crash information | |
54 // | |
55 // As a result of construction, the |entry_| will be filled with the | |
56 // appropriate string to add to the log file. | |
57 DumpInfo(const std::string& crashed_process_dump, | |
58 const std::string& crashed_process_logfile, | |
59 const time_t& dump_time, | |
60 const MinidumpParams& params); | |
61 | |
62 ~DumpInfo(); | |
63 | |
64 // Accessors. | |
gunsch
2015/06/09 18:46:19
nit: remove comment
slan
2015/06/10 01:49:13
Done.
| |
65 std::string crashed_process_dump() const { return crashed_process_dump_; } | |
66 std::string logfile() const { return logfile_; } | |
67 time_t dump_time() const { return dump_time_; } | |
68 std::string entry() const { return entry_; } | |
69 MinidumpParams params() const { return params_; } | |
70 bool valid() const { return valid_; } | |
71 | |
72 private: | |
73 bool ParseEntry(const std::string& entry); | |
74 bool SetDumpTimeFromString(const std::string& timestr); | |
75 std::string GetEntryAsString(); | |
76 | |
77 std::string crashed_process_dump_; | |
78 std::string logfile_; | |
79 time_t dump_time_; | |
80 std::string entry_; | |
81 MinidumpParams params_; | |
82 bool valid_; | |
83 | |
84 DISALLOW_COPY_AND_ASSIGN(DumpInfo); | |
85 }; | |
86 | |
87 } // namespace chromecast | |
88 | |
89 #endif // CHROMECAST_CRASH_DUMP_INFO_H_ | |
OLD | NEW |