| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include "minidump/minidump_misc_info_writer.h" | 15 #include "minidump/minidump_misc_info_writer.h" |
| 16 | 16 |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "minidump/minidump_writer_util.h" | 20 #include "minidump/minidump_writer_util.h" |
| 21 #include "util/file/file_writer.h" | 21 #include "util/file/file_writer.h" |
| 22 #include "util/numeric/safe_assignment.h" | 22 #include "util/numeric/safe_assignment.h" |
| 23 | 23 |
| 24 namespace crashpad { | 24 namespace crashpad { |
| 25 | 25 |
| 26 MinidumpMiscInfoWriter::MinidumpMiscInfoWriter() | 26 MinidumpMiscInfoWriter::MinidumpMiscInfoWriter() |
| 27 : MinidumpStreamWriter(), misc_info_() { | 27 : MinidumpStreamWriter(), misc_info_() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 MinidumpMiscInfoWriter::~MinidumpMiscInfoWriter() { |
| 31 } |
| 32 |
| 30 void MinidumpMiscInfoWriter::SetProcessId(uint32_t process_id) { | 33 void MinidumpMiscInfoWriter::SetProcessId(uint32_t process_id) { |
| 31 DCHECK_EQ(state(), kStateMutable); | 34 DCHECK_EQ(state(), kStateMutable); |
| 32 | 35 |
| 33 misc_info_.ProcessId = process_id; | 36 misc_info_.ProcessId = process_id; |
| 34 misc_info_.Flags1 |= MINIDUMP_MISC1_PROCESS_ID; | 37 misc_info_.Flags1 |= MINIDUMP_MISC1_PROCESS_ID; |
| 35 } | 38 } |
| 36 | 39 |
| 37 void MinidumpMiscInfoWriter::SetProcessTimes(time_t process_create_time, | 40 void MinidumpMiscInfoWriter::SetProcessTimes(time_t process_create_time, |
| 38 uint32_t process_user_time, | 41 uint32_t process_user_time, |
| 39 uint32_t process_kernel_time) { | 42 uint32_t process_kernel_time) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC3_PROTECTED_PROCESS)) { | 179 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC3_PROTECTED_PROCESS)) { |
| 177 return sizeof(MINIDUMP_MISC_INFO_3); | 180 return sizeof(MINIDUMP_MISC_INFO_3); |
| 178 } | 181 } |
| 179 if (misc_info_.Flags1 & MINIDUMP_MISC1_PROCESSOR_POWER_INFO) { | 182 if (misc_info_.Flags1 & MINIDUMP_MISC1_PROCESSOR_POWER_INFO) { |
| 180 return sizeof(MINIDUMP_MISC_INFO_2); | 183 return sizeof(MINIDUMP_MISC_INFO_2); |
| 181 } | 184 } |
| 182 return sizeof(MINIDUMP_MISC_INFO); | 185 return sizeof(MINIDUMP_MISC_INFO); |
| 183 } | 186 } |
| 184 | 187 |
| 185 } // namespace crashpad | 188 } // namespace crashpad |
| OLD | NEW |