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

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