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

Side by Side Diff: minidump/minidump_module_writer.cc

Issue 1483073004: Replace use of .Pass() with crashpad::move(). (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: pass: . Created 5 years 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,
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 "minidump/minidump_module_writer.h" 15 #include "minidump/minidump_module_writer.h"
16 16
17 #include <sys/types.h> 17 #include <sys/types.h>
18 18
19 #include <limits> 19 #include <limits>
20 20
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/numerics/safe_conversions.h" 22 #include "base/numerics/safe_conversions.h"
23 #include "minidump/minidump_string_writer.h" 23 #include "minidump/minidump_string_writer.h"
24 #include "minidump/minidump_writer_util.h" 24 #include "minidump/minidump_writer_util.h"
25 #include "snapshot/module_snapshot.h" 25 #include "snapshot/module_snapshot.h"
26 #include "util/file/file_writer.h" 26 #include "util/file/file_writer.h"
27 #include "util/misc/implicit_cast.h" 27 #include "util/misc/implicit_cast.h"
28 #include "util/stdlib/move.h"
28 #include "util/numeric/in_range_cast.h" 29 #include "util/numeric/in_range_cast.h"
29 #include "util/numeric/safe_assignment.h" 30 #include "util/numeric/safe_assignment.h"
30 31
31 namespace crashpad { 32 namespace crashpad {
32 33
33 MinidumpModuleCodeViewRecordWriter::~MinidumpModuleCodeViewRecordWriter() { 34 MinidumpModuleCodeViewRecordWriter::~MinidumpModuleCodeViewRecordWriter() {
34 } 35 }
35 36
36 namespace internal { 37 namespace internal {
37 38
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 break; 238 break;
238 default: 239 default:
239 file_type = VFT_UNKNOWN; 240 file_type = VFT_UNKNOWN;
240 break; 241 break;
241 } 242 }
242 SetFileTypeAndSubtype(file_type, VFT2_UNKNOWN); 243 SetFileTypeAndSubtype(file_type, VFT2_UNKNOWN);
243 244
244 auto codeview_record = 245 auto codeview_record =
245 make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer()); 246 make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
246 codeview_record->InitializeFromSnapshot(module_snapshot); 247 codeview_record->InitializeFromSnapshot(module_snapshot);
247 SetCodeViewRecord(codeview_record.Pass()); 248 SetCodeViewRecord(crashpad::move(codeview_record));
248 } 249 }
249 250
250 const MINIDUMP_MODULE* MinidumpModuleWriter::MinidumpModule() const { 251 const MINIDUMP_MODULE* MinidumpModuleWriter::MinidumpModule() const {
251 DCHECK_EQ(state(), kStateWritable); 252 DCHECK_EQ(state(), kStateWritable);
252 253
253 return &module_; 254 return &module_;
254 } 255 }
255 256
256 void MinidumpModuleWriter::SetName(const std::string& name) { 257 void MinidumpModuleWriter::SetName(const std::string& name) {
257 DCHECK_EQ(state(), kStateMutable); 258 DCHECK_EQ(state(), kStateMutable);
258 259
259 if (!name_) { 260 if (!name_) {
260 name_.reset(new internal::MinidumpUTF16StringWriter()); 261 name_.reset(new internal::MinidumpUTF16StringWriter());
261 } 262 }
262 name_->SetUTF8(name); 263 name_->SetUTF8(name);
263 } 264 }
264 265
265 void MinidumpModuleWriter::SetCodeViewRecord( 266 void MinidumpModuleWriter::SetCodeViewRecord(
266 scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) { 267 scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) {
267 DCHECK_EQ(state(), kStateMutable); 268 DCHECK_EQ(state(), kStateMutable);
268 269
269 codeview_record_ = codeview_record.Pass(); 270 codeview_record_ = crashpad::move(codeview_record);
270 } 271 }
271 272
272 void MinidumpModuleWriter::SetMiscDebugRecord( 273 void MinidumpModuleWriter::SetMiscDebugRecord(
273 scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) { 274 scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) {
274 DCHECK_EQ(state(), kStateMutable); 275 DCHECK_EQ(state(), kStateMutable);
275 276
276 misc_debug_record_ = misc_debug_record.Pass(); 277 misc_debug_record_ = crashpad::move(misc_debug_record);
277 } 278 }
278 279
279 void MinidumpModuleWriter::SetTimestamp(time_t timestamp) { 280 void MinidumpModuleWriter::SetTimestamp(time_t timestamp) {
280 DCHECK_EQ(state(), kStateMutable); 281 DCHECK_EQ(state(), kStateMutable);
281 282
282 internal::MinidumpWriterUtil::AssignTimeT(&module_.TimeDateStamp, timestamp); 283 internal::MinidumpWriterUtil::AssignTimeT(&module_.TimeDateStamp, timestamp);
283 } 284 }
284 285
285 void MinidumpModuleWriter::SetFileVersion(uint16_t version_0, 286 void MinidumpModuleWriter::SetFileVersion(uint16_t version_0,
286 uint16_t version_1, 287 uint16_t version_1,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 379 }
379 380
380 void MinidumpModuleListWriter::InitializeFromSnapshot( 381 void MinidumpModuleListWriter::InitializeFromSnapshot(
381 const std::vector<const ModuleSnapshot*>& module_snapshots) { 382 const std::vector<const ModuleSnapshot*>& module_snapshots) {
382 DCHECK_EQ(state(), kStateMutable); 383 DCHECK_EQ(state(), kStateMutable);
383 DCHECK(modules_.empty()); 384 DCHECK(modules_.empty());
384 385
385 for (const ModuleSnapshot* module_snapshot : module_snapshots) { 386 for (const ModuleSnapshot* module_snapshot : module_snapshots) {
386 auto module = make_scoped_ptr(new MinidumpModuleWriter()); 387 auto module = make_scoped_ptr(new MinidumpModuleWriter());
387 module->InitializeFromSnapshot(module_snapshot); 388 module->InitializeFromSnapshot(module_snapshot);
388 AddModule(module.Pass()); 389 AddModule(crashpad::move(module));
389 } 390 }
390 } 391 }
391 392
392 void MinidumpModuleListWriter::AddModule( 393 void MinidumpModuleListWriter::AddModule(
393 scoped_ptr<MinidumpModuleWriter> module) { 394 scoped_ptr<MinidumpModuleWriter> module) {
394 DCHECK_EQ(state(), kStateMutable); 395 DCHECK_EQ(state(), kStateMutable);
395 396
396 modules_.push_back(module.release()); 397 modules_.push_back(module.release());
397 } 398 }
398 399
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 } 445 }
445 446
446 return file_writer->WriteIoVec(&iovecs); 447 return file_writer->WriteIoVec(&iovecs);
447 } 448 }
448 449
449 MinidumpStreamType MinidumpModuleListWriter::StreamType() const { 450 MinidumpStreamType MinidumpModuleListWriter::StreamType() const {
450 return kMinidumpStreamTypeModuleList; 451 return kMinidumpStreamTypeModuleList;
451 } 452 }
452 453
453 } // namespace crashpad 454 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_module_crashpad_info_writer_test.cc ('k') | minidump/minidump_module_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698