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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 const ExceptionSnapshot* ProcessSnapshotMac::Exception() const { | 137 const ExceptionSnapshot* ProcessSnapshotMac::Exception() const { |
138 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 138 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
139 return exception_.get(); | 139 return exception_.get(); |
140 } | 140 } |
141 | 141 |
142 void ProcessSnapshotMac::InitializeThreads() { | 142 void ProcessSnapshotMac::InitializeThreads() { |
143 const std::vector<ProcessReader::Thread>& process_reader_threads = | 143 const std::vector<ProcessReader::Thread>& process_reader_threads = |
144 process_reader_.Threads(); | 144 process_reader_.Threads(); |
145 for (const ProcessReader::Thread& process_reader_thread : | 145 for (const ProcessReader::Thread& process_reader_thread : |
146 process_reader_threads) { | 146 process_reader_threads) { |
147 internal::ThreadSnapshotMac* thread = new internal::ThreadSnapshotMac(); | 147 auto thread = make_scoped_ptr(new internal::ThreadSnapshotMac()); |
148 threads_.push_back(thread); | 148 if (thread->Initialize(&process_reader_, process_reader_thread)) { |
149 if (!thread->Initialize(&process_reader_, process_reader_thread)) { | 149 threads_.push_back(thread.release()); |
150 threads_.pop_back(); | |
151 } | 150 } |
152 } | 151 } |
153 } | 152 } |
154 | 153 |
155 void ProcessSnapshotMac::InitializeModules() { | 154 void ProcessSnapshotMac::InitializeModules() { |
156 const std::vector<ProcessReader::Module>& process_reader_modules = | 155 const std::vector<ProcessReader::Module>& process_reader_modules = |
157 process_reader_.Modules(); | 156 process_reader_.Modules(); |
158 for (const ProcessReader::Module& process_reader_module : | 157 for (const ProcessReader::Module& process_reader_module : |
159 process_reader_modules) { | 158 process_reader_modules) { |
160 internal::ModuleSnapshotMac* module = new internal::ModuleSnapshotMac(); | 159 auto module = make_scoped_ptr(new internal::ModuleSnapshotMac()); |
161 modules_.push_back(module); | 160 if (module->Initialize(&process_reader_, process_reader_module)) { |
162 if (!module->Initialize(&process_reader_, process_reader_module)) { | 161 modules_.push_back(module.release()); |
163 modules_.pop_back(); | |
164 } | 162 } |
165 } | 163 } |
166 } | 164 } |
167 | 165 |
168 } // namespace crashpad | 166 } // namespace crashpad |
OLD | NEW |