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

Side by Side Diff: minidump/minidump_simple_string_dictionary_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_simple_string_dictionary_writer.h" 15 #include "minidump/minidump_simple_string_dictionary_writer.h"
16 16
17 #include <utility>
18
17 #include "base/logging.h" 19 #include "base/logging.h"
18 #include "base/stl_util.h" 20 #include "base/stl_util.h"
19 #include "util/file/file_writer.h" 21 #include "util/file/file_writer.h"
20 #include "util/stdlib/move.h"
21 #include "util/numeric/safe_assignment.h" 22 #include "util/numeric/safe_assignment.h"
22 23
23 namespace crashpad { 24 namespace crashpad {
24 25
25 MinidumpSimpleStringDictionaryEntryWriter:: 26 MinidumpSimpleStringDictionaryEntryWriter::
26 MinidumpSimpleStringDictionaryEntryWriter() 27 MinidumpSimpleStringDictionaryEntryWriter()
27 : MinidumpWritable(), entry_(), key_(), value_() { 28 : MinidumpWritable(), entry_(), key_(), value_() {
28 } 29 }
29 30
30 MinidumpSimpleStringDictionaryEntryWriter:: 31 MinidumpSimpleStringDictionaryEntryWriter::
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 104
104 void MinidumpSimpleStringDictionaryWriter::InitializeFromMap( 105 void MinidumpSimpleStringDictionaryWriter::InitializeFromMap(
105 const std::map<std::string, std::string>& map) { 106 const std::map<std::string, std::string>& map) {
106 DCHECK_EQ(state(), kStateMutable); 107 DCHECK_EQ(state(), kStateMutable);
107 DCHECK(entries_.empty()); 108 DCHECK(entries_.empty());
108 109
109 for (const auto& iterator : map) { 110 for (const auto& iterator : map) {
110 auto entry = 111 auto entry =
111 make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); 112 make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
112 entry->SetKeyValue(iterator.first, iterator.second); 113 entry->SetKeyValue(iterator.first, iterator.second);
113 AddEntry(crashpad::move(entry)); 114 AddEntry(std::move(entry));
114 } 115 }
115 } 116 }
116 117
117 void MinidumpSimpleStringDictionaryWriter::AddEntry( 118 void MinidumpSimpleStringDictionaryWriter::AddEntry(
118 scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry) { 119 scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry) {
119 DCHECK_EQ(state(), kStateMutable); 120 DCHECK_EQ(state(), kStateMutable);
120 121
121 const std::string& key = entry->Key(); 122 const std::string& key = entry->Key();
122 auto iterator = entries_.find(key); 123 auto iterator = entries_.find(key);
123 if (iterator != entries_.end()) { 124 if (iterator != entries_.end()) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 for (const auto& key_entry : entries_) { 180 for (const auto& key_entry : entries_) {
180 iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry(); 181 iov.iov_base = key_entry.second->MinidumpSimpleStringDictionaryEntry();
181 iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry); 182 iov.iov_len = sizeof(MinidumpSimpleStringDictionaryEntry);
182 iovecs.push_back(iov); 183 iovecs.push_back(iov);
183 } 184 }
184 185
185 return file_writer->WriteIoVec(&iovecs); 186 return file_writer->WriteIoVec(&iovecs);
186 } 187 }
187 188
188 } // namespace crashpad 189 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_rva_list_writer_test.cc ('k') | minidump/minidump_simple_string_dictionary_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698