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

Side by Side Diff: tools/json_schema_compiler/util.cc

Issue 1926933002: Convert generated extension bindings to use base::Value::CreateDeepCopy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 4 years, 7 months 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 | « tools/json_schema_compiler/cc_generator.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/json_schema_compiler/util.h" 5 #include "tools/json_schema_compiler/util.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 9
10 namespace json_schema_compiler { 10 namespace json_schema_compiler {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 out->Append(new base::StringValue(from)); 153 out->Append(new base::StringValue(from));
154 } 154 }
155 155
156 void AddItemToList(const std::vector<char>& from, base::ListValue* out) { 156 void AddItemToList(const std::vector<char>& from, base::ListValue* out) {
157 out->Append( 157 out->Append(
158 base::BinaryValue::CreateWithCopiedBuffer(from.data(), from.size())); 158 base::BinaryValue::CreateWithCopiedBuffer(from.data(), from.size()));
159 } 159 }
160 160
161 void AddItemToList(const std::unique_ptr<base::Value>& from, 161 void AddItemToList(const std::unique_ptr<base::Value>& from,
162 base::ListValue* out) { 162 base::ListValue* out) {
163 out->Append(from->DeepCopy()); 163 out->Append(from->CreateDeepCopy());
164 } 164 }
165 165
166 void AddItemToList(const std::unique_ptr<base::DictionaryValue>& from, 166 void AddItemToList(const std::unique_ptr<base::DictionaryValue>& from,
167 base::ListValue* out) { 167 base::ListValue* out) {
168 out->Append(static_cast<base::Value*>(from->DeepCopy())); 168 out->Append(from->CreateDeepCopy());
169 } 169 }
170 170
171 std::string ValueTypeToString(base::Value::Type type) { 171 std::string ValueTypeToString(base::Value::Type type) {
172 switch (type) { 172 switch (type) {
173 case base::Value::TYPE_NULL: 173 case base::Value::TYPE_NULL:
174 return "null"; 174 return "null";
175 case base::Value::TYPE_BOOLEAN: 175 case base::Value::TYPE_BOOLEAN:
176 return "boolean"; 176 return "boolean";
177 case base::Value::TYPE_INTEGER: 177 case base::Value::TYPE_INTEGER:
178 return "integer"; 178 return "integer";
179 case base::Value::TYPE_DOUBLE: 179 case base::Value::TYPE_DOUBLE:
180 return "number"; 180 return "number";
181 case base::Value::TYPE_STRING: 181 case base::Value::TYPE_STRING:
182 return "string"; 182 return "string";
183 case base::Value::TYPE_BINARY: 183 case base::Value::TYPE_BINARY:
184 return "binary"; 184 return "binary";
185 case base::Value::TYPE_DICTIONARY: 185 case base::Value::TYPE_DICTIONARY:
186 return "dictionary"; 186 return "dictionary";
187 case base::Value::TYPE_LIST: 187 case base::Value::TYPE_LIST:
188 return "list"; 188 return "list";
189 } 189 }
190 NOTREACHED(); 190 NOTREACHED();
191 return ""; 191 return "";
192 } 192 }
193 193
194 } // namespace util 194 } // namespace util
195 } // namespace json_schema_compiler 195 } // namespace json_schema_compiler
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/cc_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698