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, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 }; | 174 }; |
175 | 175 |
176 struct MinidumpThreadListTraits { | 176 struct MinidumpThreadListTraits { |
177 using ListType = MINIDUMP_THREAD_LIST; | 177 using ListType = MINIDUMP_THREAD_LIST; |
178 enum : size_t { kElementSize = sizeof(MINIDUMP_THREAD) }; | 178 enum : size_t { kElementSize = sizeof(MINIDUMP_THREAD) }; |
179 static size_t ElementCount(const ListType* list) { | 179 static size_t ElementCount(const ListType* list) { |
180 return list->NumberOfThreads; | 180 return list->NumberOfThreads; |
181 } | 181 } |
182 }; | 182 }; |
183 | 183 |
| 184 struct MinidumpHandleDataStreamTraits { |
| 185 using ListType = MINIDUMP_HANDLE_DATA_STREAM; |
| 186 enum : size_t { kElementSize = sizeof(MINIDUMP_HANDLE_DESCRIPTOR) }; |
| 187 static size_t ElementCount(const ListType* list) { |
| 188 return static_cast<size_t>(list->NumberOfDescriptors); |
| 189 } |
| 190 }; |
| 191 |
184 struct MinidumpMemoryInfoListTraits { | 192 struct MinidumpMemoryInfoListTraits { |
185 using ListType = MINIDUMP_MEMORY_INFO_LIST; | 193 using ListType = MINIDUMP_MEMORY_INFO_LIST; |
186 enum : size_t { kElementSize = sizeof(MINIDUMP_MEMORY_INFO) }; | 194 enum : size_t { kElementSize = sizeof(MINIDUMP_MEMORY_INFO) }; |
187 static size_t ElementCount(const ListType* list) { | 195 static size_t ElementCount(const ListType* list) { |
188 return static_cast<size_t>(list->NumberOfEntries); | 196 return static_cast<size_t>(list->NumberOfEntries); |
189 } | 197 } |
190 }; | 198 }; |
191 | 199 |
192 struct MinidumpModuleCrashpadInfoListTraits { | 200 struct MinidumpModuleCrashpadInfoListTraits { |
193 using ListType = MinidumpModuleCrashpadInfoList; | 201 using ListType = MinidumpModuleCrashpadInfoList; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 254 |
247 template <> | 255 template <> |
248 const MINIDUMP_THREAD_LIST* MinidumpWritableAtLocationDescriptor< | 256 const MINIDUMP_THREAD_LIST* MinidumpWritableAtLocationDescriptor< |
249 MINIDUMP_THREAD_LIST>(const std::string& file_contents, | 257 MINIDUMP_THREAD_LIST>(const std::string& file_contents, |
250 const MINIDUMP_LOCATION_DESCRIPTOR& location) { | 258 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
251 return MinidumpListAtLocationDescriptor<MinidumpThreadListTraits>( | 259 return MinidumpListAtLocationDescriptor<MinidumpThreadListTraits>( |
252 file_contents, location); | 260 file_contents, location); |
253 } | 261 } |
254 | 262 |
255 template <> | 263 template <> |
| 264 const MINIDUMP_HANDLE_DATA_STREAM* MinidumpWritableAtLocationDescriptor< |
| 265 MINIDUMP_HANDLE_DATA_STREAM>(const std::string& file_contents, |
| 266 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
| 267 return MinidumpListAtLocationDescriptor<MinidumpHandleDataStreamTraits>( |
| 268 file_contents, location); |
| 269 } |
| 270 |
| 271 template <> |
256 const MINIDUMP_MEMORY_INFO_LIST* MinidumpWritableAtLocationDescriptor< | 272 const MINIDUMP_MEMORY_INFO_LIST* MinidumpWritableAtLocationDescriptor< |
257 MINIDUMP_MEMORY_INFO_LIST>(const std::string& file_contents, | 273 MINIDUMP_MEMORY_INFO_LIST>(const std::string& file_contents, |
258 const MINIDUMP_LOCATION_DESCRIPTOR& location) { | 274 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
259 return MinidumpListAtLocationDescriptor<MinidumpMemoryInfoListTraits>( | 275 return MinidumpListAtLocationDescriptor<MinidumpMemoryInfoListTraits>( |
260 file_contents, location); | 276 file_contents, location); |
261 } | 277 } |
262 | 278 |
263 template <> | 279 template <> |
264 const MinidumpModuleCrashpadInfoList* | 280 const MinidumpModuleCrashpadInfoList* |
265 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>( | 281 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 size_t TestUInt32MinidumpWritable::SizeOfObject() { | 349 size_t TestUInt32MinidumpWritable::SizeOfObject() { |
334 return sizeof(value_); | 350 return sizeof(value_); |
335 } | 351 } |
336 | 352 |
337 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { | 353 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { |
338 return file_writer->Write(&value_, sizeof(value_)); | 354 return file_writer->Write(&value_, sizeof(value_)); |
339 } | 355 } |
340 | 356 |
341 } // namespace test | 357 } // namespace test |
342 } // namespace crashpad | 358 } // namespace crashpad |
OLD | NEW |