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

Side by Side Diff: minidump/minidump_module_crashpad_info_writer.cc

Issue 674153002: minidump: Change the ownership model (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 1 month 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
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 14 matching lines...) Expand all
25 25
26 MinidumpModuleCrashpadInfoWriter::MinidumpModuleCrashpadInfoWriter() 26 MinidumpModuleCrashpadInfoWriter::MinidumpModuleCrashpadInfoWriter()
27 : MinidumpWritable(), module_(), simple_annotations_() { 27 : MinidumpWritable(), module_(), simple_annotations_() {
28 module_.version = MinidumpModuleCrashpadInfo::kVersion; 28 module_.version = MinidumpModuleCrashpadInfo::kVersion;
29 } 29 }
30 30
31 MinidumpModuleCrashpadInfoWriter::~MinidumpModuleCrashpadInfoWriter() { 31 MinidumpModuleCrashpadInfoWriter::~MinidumpModuleCrashpadInfoWriter() {
32 } 32 }
33 33
34 void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations( 34 void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
35 MinidumpSimpleStringDictionaryWriter* simple_annotations) { 35 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
36 DCHECK_EQ(state(), kStateMutable); 36 DCHECK_EQ(state(), kStateMutable);
37 37
38 simple_annotations_ = simple_annotations; 38 simple_annotations_ = simple_annotations.Pass();
39 } 39 }
40 40
41 bool MinidumpModuleCrashpadInfoWriter::Freeze() { 41 bool MinidumpModuleCrashpadInfoWriter::Freeze() {
42 DCHECK_EQ(state(), kStateMutable); 42 DCHECK_EQ(state(), kStateMutable);
43 43
44 if (!MinidumpWritable::Freeze()) { 44 if (!MinidumpWritable::Freeze()) {
45 return false; 45 return false;
46 } 46 }
47 47
48 if (simple_annotations_) { 48 if (simple_annotations_) {
49 simple_annotations_->RegisterLocationDescriptor( 49 simple_annotations_->RegisterLocationDescriptor(
50 &module_.simple_annotations); 50 &module_.simple_annotations);
51 } 51 }
52 52
53 return true; 53 return true;
54 } 54 }
55 55
56 size_t MinidumpModuleCrashpadInfoWriter::SizeOfObject() { 56 size_t MinidumpModuleCrashpadInfoWriter::SizeOfObject() {
57 DCHECK_GE(state(), kStateFrozen); 57 DCHECK_GE(state(), kStateFrozen);
58 58
59 return sizeof(module_); 59 return sizeof(module_);
60 } 60 }
61 61
62 std::vector<internal::MinidumpWritable*> 62 std::vector<internal::MinidumpWritable*>
63 MinidumpModuleCrashpadInfoWriter::Children() { 63 MinidumpModuleCrashpadInfoWriter::Children() {
64 DCHECK_GE(state(), kStateFrozen); 64 DCHECK_GE(state(), kStateFrozen);
65 65
66 std::vector<MinidumpWritable*> children; 66 std::vector<MinidumpWritable*> children;
67 if (simple_annotations_) { 67 if (simple_annotations_) {
68 children.push_back(simple_annotations_); 68 children.push_back(simple_annotations_.get());
69 } 69 }
70 70
71 return children; 71 return children;
72 } 72 }
73 73
74 bool MinidumpModuleCrashpadInfoWriter::WriteObject( 74 bool MinidumpModuleCrashpadInfoWriter::WriteObject(
75 FileWriterInterface* file_writer) { 75 FileWriterInterface* file_writer) {
76 DCHECK_EQ(state(), kStateWritable); 76 DCHECK_EQ(state(), kStateWritable);
77 77
78 return file_writer->Write(&module_, sizeof(module_)); 78 return file_writer->Write(&module_, sizeof(module_));
79 } 79 }
80 80
81 MinidumpModuleCrashpadInfoListWriter::MinidumpModuleCrashpadInfoListWriter() 81 MinidumpModuleCrashpadInfoListWriter::MinidumpModuleCrashpadInfoListWriter()
82 : MinidumpWritable(), 82 : MinidumpWritable(),
83 module_list_base_(), 83 module_list_base_(),
84 modules_(), 84 modules_(),
85 module_location_descriptors_() { 85 module_location_descriptors_() {
86 } 86 }
87 87
88 MinidumpModuleCrashpadInfoListWriter::~MinidumpModuleCrashpadInfoListWriter() { 88 MinidumpModuleCrashpadInfoListWriter::~MinidumpModuleCrashpadInfoListWriter() {
89 } 89 }
90 90
91 void MinidumpModuleCrashpadInfoListWriter::AddModule( 91 void MinidumpModuleCrashpadInfoListWriter::AddModule(
92 MinidumpModuleCrashpadInfoWriter* module) { 92 scoped_ptr<MinidumpModuleCrashpadInfoWriter> module) {
93 DCHECK_EQ(state(), kStateMutable); 93 DCHECK_EQ(state(), kStateMutable);
94 94
95 modules_.push_back(module); 95 modules_.push_back(module.release());
96 } 96 }
97 97
98 bool MinidumpModuleCrashpadInfoListWriter::Freeze() { 98 bool MinidumpModuleCrashpadInfoListWriter::Freeze() {
99 DCHECK_EQ(state(), kStateMutable); 99 DCHECK_EQ(state(), kStateMutable);
100 DCHECK(module_location_descriptors_.empty()); 100 DCHECK(module_location_descriptors_.empty());
101 101
102 if (!MinidumpWritable::Freeze()) { 102 if (!MinidumpWritable::Freeze()) {
103 return false; 103 return false;
104 } 104 }
105 105
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 iov.iov_base = &module_location_descriptors_[0]; 151 iov.iov_base = &module_location_descriptors_[0];
152 iov.iov_len = module_location_descriptors_.size() * 152 iov.iov_len = module_location_descriptors_.size() *
153 sizeof(MINIDUMP_LOCATION_DESCRIPTOR); 153 sizeof(MINIDUMP_LOCATION_DESCRIPTOR);
154 iovecs.push_back(iov); 154 iovecs.push_back(iov);
155 } 155 }
156 156
157 return file_writer->WriteIoVec(&iovecs); 157 return file_writer->WriteIoVec(&iovecs);
158 } 158 }
159 159
160 } // namespace crashpad 160 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_module_crashpad_info_writer.h ('k') | minidump/minidump_module_crashpad_info_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698