| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void MinidumpModuleWriter::SetName(const std::string& name) { | 192 void MinidumpModuleWriter::SetName(const std::string& name) { |
| 193 DCHECK_EQ(state(), kStateMutable); | 193 DCHECK_EQ(state(), kStateMutable); |
| 194 | 194 |
| 195 if (!name_) { | 195 if (!name_) { |
| 196 name_.reset(new internal::MinidumpUTF16StringWriter()); | 196 name_.reset(new internal::MinidumpUTF16StringWriter()); |
| 197 } | 197 } |
| 198 name_->SetUTF8(name); | 198 name_->SetUTF8(name); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void MinidumpModuleWriter::SetCodeViewRecord( | 201 void MinidumpModuleWriter::SetCodeViewRecord( |
| 202 MinidumpModuleCodeViewRecordWriter* codeview_record) { | 202 scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) { |
| 203 DCHECK_EQ(state(), kStateMutable); | 203 DCHECK_EQ(state(), kStateMutable); |
| 204 | 204 |
| 205 codeview_record_ = codeview_record; | 205 codeview_record_ = codeview_record.Pass(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void MinidumpModuleWriter::SetMiscDebugRecord( | 208 void MinidumpModuleWriter::SetMiscDebugRecord( |
| 209 MinidumpModuleMiscDebugRecordWriter* misc_debug_record) { | 209 scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) { |
| 210 DCHECK_EQ(state(), kStateMutable); | 210 DCHECK_EQ(state(), kStateMutable); |
| 211 | 211 |
| 212 misc_debug_record_ = misc_debug_record; | 212 misc_debug_record_ = misc_debug_record.Pass(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void MinidumpModuleWriter::SetTimestamp(time_t timestamp) { | 215 void MinidumpModuleWriter::SetTimestamp(time_t timestamp) { |
| 216 DCHECK_EQ(state(), kStateMutable); | 216 DCHECK_EQ(state(), kStateMutable); |
| 217 | 217 |
| 218 internal::MinidumpWriterUtil::AssignTimeT(&module_.TimeDateStamp, timestamp); | 218 internal::MinidumpWriterUtil::AssignTimeT(&module_.TimeDateStamp, timestamp); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void MinidumpModuleWriter::SetFileVersion(uint16_t version_0, | 221 void MinidumpModuleWriter::SetFileVersion(uint16_t version_0, |
| 222 uint16_t version_1, | 222 uint16_t version_1, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return 0; | 281 return 0; |
| 282 } | 282 } |
| 283 | 283 |
| 284 std::vector<internal::MinidumpWritable*> MinidumpModuleWriter::Children() { | 284 std::vector<internal::MinidumpWritable*> MinidumpModuleWriter::Children() { |
| 285 DCHECK_GE(state(), kStateFrozen); | 285 DCHECK_GE(state(), kStateFrozen); |
| 286 DCHECK(name_); | 286 DCHECK(name_); |
| 287 | 287 |
| 288 std::vector<MinidumpWritable*> children; | 288 std::vector<MinidumpWritable*> children; |
| 289 children.push_back(name_.get()); | 289 children.push_back(name_.get()); |
| 290 if (codeview_record_) { | 290 if (codeview_record_) { |
| 291 children.push_back(codeview_record_); | 291 children.push_back(codeview_record_.get()); |
| 292 } | 292 } |
| 293 if (misc_debug_record_) { | 293 if (misc_debug_record_) { |
| 294 children.push_back(misc_debug_record_); | 294 children.push_back(misc_debug_record_.get()); |
| 295 } | 295 } |
| 296 | 296 |
| 297 return children; | 297 return children; |
| 298 } | 298 } |
| 299 | 299 |
| 300 bool MinidumpModuleWriter::WriteObject(FileWriterInterface* file_writer) { | 300 bool MinidumpModuleWriter::WriteObject(FileWriterInterface* file_writer) { |
| 301 DCHECK_EQ(state(), kStateWritable); | 301 DCHECK_EQ(state(), kStateWritable); |
| 302 | 302 |
| 303 // This object doesn’t directly write anything itself. Its MINIDUMP_MODULE is | 303 // This object doesn’t directly write anything itself. Its MINIDUMP_MODULE is |
| 304 // written by its parent as part of a MINIDUMP_MODULE_LIST, and its children | 304 // written by its parent as part of a MINIDUMP_MODULE_LIST, and its children |
| 305 // are responsible for writing themselves. | 305 // are responsible for writing themselves. |
| 306 return true; | 306 return true; |
| 307 } | 307 } |
| 308 | 308 |
| 309 MinidumpModuleListWriter::MinidumpModuleListWriter() | 309 MinidumpModuleListWriter::MinidumpModuleListWriter() |
| 310 : MinidumpStreamWriter(), module_list_base_(), modules_() { | 310 : MinidumpStreamWriter(), module_list_base_(), modules_() { |
| 311 } | 311 } |
| 312 | 312 |
| 313 MinidumpModuleListWriter::~MinidumpModuleListWriter() { | 313 MinidumpModuleListWriter::~MinidumpModuleListWriter() { |
| 314 } | 314 } |
| 315 | 315 |
| 316 void MinidumpModuleListWriter::AddModule(MinidumpModuleWriter* module) { | 316 void MinidumpModuleListWriter::AddModule( |
| 317 scoped_ptr<MinidumpModuleWriter> module) { |
| 317 DCHECK_EQ(state(), kStateMutable); | 318 DCHECK_EQ(state(), kStateMutable); |
| 318 | 319 |
| 319 modules_.push_back(module); | 320 modules_.push_back(module.release()); |
| 320 } | 321 } |
| 321 | 322 |
| 322 bool MinidumpModuleListWriter::Freeze() { | 323 bool MinidumpModuleListWriter::Freeze() { |
| 323 DCHECK_EQ(state(), kStateMutable); | 324 DCHECK_EQ(state(), kStateMutable); |
| 324 | 325 |
| 325 if (!MinidumpStreamWriter::Freeze()) { | 326 if (!MinidumpStreamWriter::Freeze()) { |
| 326 return false; | 327 return false; |
| 327 } | 328 } |
| 328 | 329 |
| 329 size_t module_count = modules_.size(); | 330 size_t module_count = modules_.size(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 368 } |
| 368 | 369 |
| 369 return file_writer->WriteIoVec(&iovecs); | 370 return file_writer->WriteIoVec(&iovecs); |
| 370 } | 371 } |
| 371 | 372 |
| 372 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { | 373 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { |
| 373 return kMinidumpStreamTypeModuleList; | 374 return kMinidumpStreamTypeModuleList; |
| 374 } | 375 } |
| 375 | 376 |
| 376 } // namespace crashpad | 377 } // namespace crashpad |
| OLD | NEW |