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

Side by Side Diff: minidump/minidump_module_crashpad_info_writer.cc

Issue 1513573005: Provide std::move() in compat instead of using crashpad::move() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 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_crashpad_info_writer.h" 15 #include "minidump/minidump_module_crashpad_info_writer.h"
16 16
17 #include <sys/types.h> 17 #include <sys/types.h>
18 18
19 #include <utility>
20
19 #include "base/logging.h" 21 #include "base/logging.h"
20 #include "minidump/minidump_simple_string_dictionary_writer.h" 22 #include "minidump/minidump_simple_string_dictionary_writer.h"
21 #include "snapshot/module_snapshot.h" 23 #include "snapshot/module_snapshot.h"
22 #include "util/file/file_writer.h" 24 #include "util/file/file_writer.h"
23 #include "util/stdlib/move.h"
24 #include "util/numeric/safe_assignment.h" 25 #include "util/numeric/safe_assignment.h"
25 26
26 namespace crashpad { 27 namespace crashpad {
27 28
28 MinidumpModuleCrashpadInfoWriter::MinidumpModuleCrashpadInfoWriter() 29 MinidumpModuleCrashpadInfoWriter::MinidumpModuleCrashpadInfoWriter()
29 : MinidumpWritable(), 30 : MinidumpWritable(),
30 module_(), 31 module_(),
31 list_annotations_(), 32 list_annotations_(),
32 simple_annotations_() { 33 simple_annotations_() {
33 module_.version = MinidumpModuleCrashpadInfo::kVersion; 34 module_.version = MinidumpModuleCrashpadInfo::kVersion;
34 } 35 }
35 36
36 MinidumpModuleCrashpadInfoWriter::~MinidumpModuleCrashpadInfoWriter() { 37 MinidumpModuleCrashpadInfoWriter::~MinidumpModuleCrashpadInfoWriter() {
37 } 38 }
38 39
39 void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot( 40 void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
40 const ModuleSnapshot* module_snapshot) { 41 const ModuleSnapshot* module_snapshot) {
41 DCHECK_EQ(state(), kStateMutable); 42 DCHECK_EQ(state(), kStateMutable);
42 DCHECK(!list_annotations_); 43 DCHECK(!list_annotations_);
43 DCHECK(!simple_annotations_); 44 DCHECK(!simple_annotations_);
44 45
45 auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter()); 46 auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter());
46 list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector()); 47 list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
47 if (list_annotations->IsUseful()) { 48 if (list_annotations->IsUseful()) {
48 SetListAnnotations(crashpad::move(list_annotations)); 49 SetListAnnotations(std::move(list_annotations));
49 } 50 }
50 51
51 auto simple_annotations = 52 auto simple_annotations =
52 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); 53 make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
53 simple_annotations->InitializeFromMap( 54 simple_annotations->InitializeFromMap(
54 module_snapshot->AnnotationsSimpleMap()); 55 module_snapshot->AnnotationsSimpleMap());
55 if (simple_annotations->IsUseful()) { 56 if (simple_annotations->IsUseful()) {
56 SetSimpleAnnotations(crashpad::move(simple_annotations)); 57 SetSimpleAnnotations(std::move(simple_annotations));
57 } 58 }
58 } 59 }
59 60
60 void MinidumpModuleCrashpadInfoWriter::SetListAnnotations( 61 void MinidumpModuleCrashpadInfoWriter::SetListAnnotations(
61 scoped_ptr<MinidumpUTF8StringListWriter> list_annotations) { 62 scoped_ptr<MinidumpUTF8StringListWriter> list_annotations) {
62 DCHECK_EQ(state(), kStateMutable); 63 DCHECK_EQ(state(), kStateMutable);
63 64
64 list_annotations_ = crashpad::move(list_annotations); 65 list_annotations_ = std::move(list_annotations);
65 } 66 }
66 67
67 void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations( 68 void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
68 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) { 69 scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
69 DCHECK_EQ(state(), kStateMutable); 70 DCHECK_EQ(state(), kStateMutable);
70 71
71 simple_annotations_ = crashpad::move(simple_annotations); 72 simple_annotations_ = std::move(simple_annotations);
72 } 73 }
73 74
74 bool MinidumpModuleCrashpadInfoWriter::IsUseful() const { 75 bool MinidumpModuleCrashpadInfoWriter::IsUseful() const {
75 return list_annotations_ || simple_annotations_; 76 return list_annotations_ || simple_annotations_;
76 } 77 }
77 78
78 bool MinidumpModuleCrashpadInfoWriter::Freeze() { 79 bool MinidumpModuleCrashpadInfoWriter::Freeze() {
79 DCHECK_EQ(state(), kStateMutable); 80 DCHECK_EQ(state(), kStateMutable);
80 81
81 if (!MinidumpWritable::Freeze()) { 82 if (!MinidumpWritable::Freeze()) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 DCHECK(module_crashpad_infos_.empty()); 139 DCHECK(module_crashpad_infos_.empty());
139 DCHECK(module_crashpad_info_links_.empty()); 140 DCHECK(module_crashpad_info_links_.empty());
140 141
141 size_t count = module_snapshots.size(); 142 size_t count = module_snapshots.size();
142 for (size_t index = 0; index < count; ++index) { 143 for (size_t index = 0; index < count; ++index) {
143 const ModuleSnapshot* module_snapshot = module_snapshots[index]; 144 const ModuleSnapshot* module_snapshot = module_snapshots[index];
144 145
145 auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); 146 auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
146 module->InitializeFromSnapshot(module_snapshot); 147 module->InitializeFromSnapshot(module_snapshot);
147 if (module->IsUseful()) { 148 if (module->IsUseful()) {
148 AddModule(crashpad::move(module), index); 149 AddModule(std::move(module), index);
149 } 150 }
150 } 151 }
151 } 152 }
152 153
153 void MinidumpModuleCrashpadInfoListWriter::AddModule( 154 void MinidumpModuleCrashpadInfoListWriter::AddModule(
154 scoped_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info, 155 scoped_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info,
155 size_t minidump_module_list_index) { 156 size_t minidump_module_list_index) {
156 DCHECK_EQ(state(), kStateMutable); 157 DCHECK_EQ(state(), kStateMutable);
157 DCHECK_EQ(module_crashpad_infos_.size(), module_crashpad_info_links_.size()); 158 DCHECK_EQ(module_crashpad_infos_.size(), module_crashpad_info_links_.size());
158 159
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 iov.iov_base = &module_crashpad_info_links_[0]; 232 iov.iov_base = &module_crashpad_info_links_[0];
232 iov.iov_len = module_crashpad_info_links_.size() * 233 iov.iov_len = module_crashpad_info_links_.size() *
233 sizeof(module_crashpad_info_links_[0]); 234 sizeof(module_crashpad_info_links_[0]);
234 iovecs.push_back(iov); 235 iovecs.push_back(iov);
235 } 236 }
236 237
237 return file_writer->WriteIoVec(&iovecs); 238 return file_writer->WriteIoVec(&iovecs);
238 } 239 }
239 240
240 } // namespace crashpad 241 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_misc_info_writer_test.cc ('k') | minidump/minidump_module_crashpad_info_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698