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

Side by Side Diff: minidump/minidump_string_writer.cc

Issue 707003002: Add MinidumpStringListWriter and test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump_rva_list
Patch Set: Rebase Created 6 years, 1 month 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
« no previous file with comments | « minidump/minidump_string_writer.h ('k') | minidump/minidump_string_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 void MinidumpUTF16StringWriter::SetUTF8(const std::string& string_utf8) { 89 void MinidumpUTF16StringWriter::SetUTF8(const std::string& string_utf8) {
90 DCHECK_EQ(state(), kStateMutable); 90 DCHECK_EQ(state(), kStateMutable);
91 91
92 set_string(MinidumpWriterUtil::ConvertUTF8ToUTF16(string_utf8)); 92 set_string(MinidumpWriterUtil::ConvertUTF8ToUTF16(string_utf8));
93 } 93 }
94 94
95 MinidumpUTF8StringWriter::~MinidumpUTF8StringWriter() { 95 MinidumpUTF8StringWriter::~MinidumpUTF8StringWriter() {
96 } 96 }
97 97
98 template <typename Traits>
99 MinidumpStringListWriter<Traits>::MinidumpStringListWriter()
100 : MinidumpRVAListWriter() {
101 }
102
103 template <typename Traits>
104 MinidumpStringListWriter<Traits>::~MinidumpStringListWriter() {
105 }
106
107 template <typename Traits>
108 void MinidumpStringListWriter<Traits>::InitializeFromVector(
109 const std::vector<std::string>& vector) {
110 DCHECK_EQ(state(), kStateMutable);
111 DCHECK(IsEmpty());
112
113 for (const std::string& string : vector) {
114 AddStringUTF8(string);
115 }
116 }
117
118 template <typename Traits>
119 void MinidumpStringListWriter<Traits>::AddStringUTF8(
120 const std::string& string_utf8) {
121 auto string_writer = make_scoped_ptr(new MinidumpStringWriterType());
122 string_writer->SetUTF8(string_utf8);
123 AddChild(string_writer.Pass());
124 }
125
126 template <typename Traits>
127 bool MinidumpStringListWriter<Traits>::IsUseful() const {
128 return !IsEmpty();
129 }
130
131 // Explicit template instantiation of the forms of MinidumpStringListWriter<>
132 // used as type aliases.
133 template class MinidumpStringListWriter<MinidumpStringListWriterUTF16Traits>;
134 template class MinidumpStringListWriter<MinidumpStringListWriterUTF8Traits>;
135
98 } // namespace internal 136 } // namespace internal
99 } // namespace crashpad 137 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_string_writer.h ('k') | minidump/minidump_string_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698