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

Side by Side Diff: third_party/crashpad/crashpad/snapshot/win/pe_image_reader.cc

Issue 1911823002: Convert //third_party from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update crashpad's README.chromium Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "snapshot/win/pe_image_reader.h" 15 #include "snapshot/win/pe_image_reader.h"
16 16
17 #include <string.h> 17 #include <string.h>
18 18
19 #include <memory>
20
19 #include "base/logging.h" 21 #include "base/logging.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "client/crashpad_info.h" 22 #include "client/crashpad_info.h"
22 #include "snapshot/win/pe_image_resource_reader.h" 23 #include "snapshot/win/pe_image_resource_reader.h"
23 #include "util/misc/pdb_structures.h" 24 #include "util/misc/pdb_structures.h"
24 #include "util/win/process_structs.h" 25 #include "util/win/process_structs.h"
25 26
26 namespace crashpad { 27 namespace crashpad {
27 28
28 namespace { 29 namespace {
29 30
30 // Map from Traits to an IMAGE_NT_HEADERSxx. 31 // Map from Traits to an IMAGE_NT_HEADERSxx.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (debug_directory.Type != IMAGE_DEBUG_TYPE_CODEVIEW) 140 if (debug_directory.Type != IMAGE_DEBUG_TYPE_CODEVIEW)
140 continue; 141 continue;
141 142
142 if (debug_directory.AddressOfRawData) { 143 if (debug_directory.AddressOfRawData) {
143 if (debug_directory.SizeOfData < sizeof(CodeViewRecordPDB70)) { 144 if (debug_directory.SizeOfData < sizeof(CodeViewRecordPDB70)) {
144 LOG(WARNING) << "CodeView debug entry of unexpected size in " 145 LOG(WARNING) << "CodeView debug entry of unexpected size in "
145 << module_subrange_reader_.name(); 146 << module_subrange_reader_.name();
146 continue; 147 continue;
147 } 148 }
148 149
149 scoped_ptr<char[]> data(new char[debug_directory.SizeOfData]); 150 std::unique_ptr<char[]> data(new char[debug_directory.SizeOfData]);
150 if (!module_subrange_reader_.ReadMemory( 151 if (!module_subrange_reader_.ReadMemory(
151 Address() + debug_directory.AddressOfRawData, 152 Address() + debug_directory.AddressOfRawData,
152 debug_directory.SizeOfData, 153 debug_directory.SizeOfData,
153 data.get())) { 154 data.get())) {
154 LOG(WARNING) << "could not read debug directory from " 155 LOG(WARNING) << "could not read debug directory from "
155 << module_subrange_reader_.name(); 156 << module_subrange_reader_.name();
156 return false; 157 return false;
157 } 158 }
158 159
159 if (*reinterpret_cast<DWORD*>(data.get()) != 160 if (*reinterpret_cast<DWORD*>(data.get()) !=
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Explicit instantiations with the only 2 valid template arguments to avoid 379 // Explicit instantiations with the only 2 valid template arguments to avoid
379 // putting the body of the function in the header. 380 // putting the body of the function in the header.
380 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits32>( 381 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits32>(
381 process_types::CrashpadInfo<process_types::internal::Traits32>* 382 process_types::CrashpadInfo<process_types::internal::Traits32>*
382 crashpad_info) const; 383 crashpad_info) const;
383 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits64>( 384 template bool PEImageReader::GetCrashpadInfo<process_types::internal::Traits64>(
384 process_types::CrashpadInfo<process_types::internal::Traits64>* 385 process_types::CrashpadInfo<process_types::internal::Traits64>*
385 crashpad_info) const; 386 crashpad_info) const;
386 387
387 } // namespace crashpad 388 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698