Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: minidump/minidump_module_writer.cc

Issue 633163002: Simplify MinidumpModuleWriter’s module name requirement implementation (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 uint32_t file_flags_mask) { 243 uint32_t file_flags_mask) {
244 DCHECK_EQ(state(), kStateMutable); 244 DCHECK_EQ(state(), kStateMutable);
245 DCHECK_EQ(file_flags & ~file_flags_mask, 0u); 245 DCHECK_EQ(file_flags & ~file_flags_mask, 0u);
246 246
247 module_.VersionInfo.dwFileFlags = file_flags; 247 module_.VersionInfo.dwFileFlags = file_flags;
248 module_.VersionInfo.dwFileFlagsMask = file_flags_mask; 248 module_.VersionInfo.dwFileFlagsMask = file_flags_mask;
249 } 249 }
250 250
251 bool MinidumpModuleWriter::Freeze() { 251 bool MinidumpModuleWriter::Freeze() {
252 DCHECK_EQ(state(), kStateMutable); 252 DCHECK_EQ(state(), kStateMutable);
253 CHECK(name_);
253 254
254 if (!MinidumpWritable::Freeze()) { 255 if (!MinidumpWritable::Freeze()) {
255 return false; 256 return false;
256 } 257 }
257 258
258 CHECK(name_);
259
260 name_->RegisterRVA(&module_.ModuleNameRva); 259 name_->RegisterRVA(&module_.ModuleNameRva);
261 260
262 if (codeview_record_) { 261 if (codeview_record_) {
263 codeview_record_->RegisterLocationDescriptor(&module_.CvRecord); 262 codeview_record_->RegisterLocationDescriptor(&module_.CvRecord);
264 } 263 }
265 264
266 if (misc_debug_record_) { 265 if (misc_debug_record_) {
267 misc_debug_record_->RegisterLocationDescriptor(&module_.MiscRecord); 266 misc_debug_record_->RegisterLocationDescriptor(&module_.MiscRecord);
268 } 267 }
269 268
270 return true; 269 return true;
271 } 270 }
272 271
273 size_t MinidumpModuleWriter::SizeOfObject() { 272 size_t MinidumpModuleWriter::SizeOfObject() {
274 DCHECK_GE(state(), kStateFrozen); 273 DCHECK_GE(state(), kStateFrozen);
275 274
276 // This object doesn’t directly write anything itself. Its MINIDUMP_MODULE is 275 // This object doesn’t directly write anything itself. Its MINIDUMP_MODULE is
277 // written by its parent as part of a MINIDUMP_MODULE_LIST, and its children 276 // written by its parent as part of a MINIDUMP_MODULE_LIST, and its children
278 // are responsible for writing themselves. 277 // are responsible for writing themselves.
279 return 0; 278 return 0;
280 } 279 }
281 280
282 std::vector<internal::MinidumpWritable*> MinidumpModuleWriter::Children() { 281 std::vector<internal::MinidumpWritable*> MinidumpModuleWriter::Children() {
283 DCHECK_GE(state(), kStateFrozen); 282 DCHECK_GE(state(), kStateFrozen);
283 DCHECK(name_);
284 284
285 std::vector<MinidumpWritable*> children; 285 std::vector<MinidumpWritable*> children;
286 if (name_) { 286 children.push_back(name_.get());
287 children.push_back(name_.get());
288 }
289 if (codeview_record_) { 287 if (codeview_record_) {
290 children.push_back(codeview_record_); 288 children.push_back(codeview_record_);
291 } 289 }
292 if (misc_debug_record_) { 290 if (misc_debug_record_) {
293 children.push_back(misc_debug_record_); 291 children.push_back(misc_debug_record_);
294 } 292 }
295 293
296 return children; 294 return children;
297 } 295 }
298 296
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 364 }
367 365
368 return file_writer->WriteIoVec(&iovecs); 366 return file_writer->WriteIoVec(&iovecs);
369 } 367 }
370 368
371 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { 369 MinidumpStreamType MinidumpModuleListWriter::StreamType() const {
372 return kMinidumpStreamTypeModuleList; 370 return kMinidumpStreamTypeModuleList;
373 } 371 }
374 372
375 } // namespace crashpad 373 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698