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

Side by Side Diff: base/values.cc

Issue 2014103002: Remove deprecated ListValue::Append(Value*) overload on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ADL fail Created 4 years, 3 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 | « base/values.h ('k') | chrome/browser/bookmarks/managed_bookmark_service_unittest.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 (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 "base/values.h" 5 #include "base/values.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 BinaryValue::~BinaryValue() { 314 BinaryValue::~BinaryValue() {
315 } 315 }
316 316
317 // static 317 // static
318 std::unique_ptr<BinaryValue> BinaryValue::CreateWithCopiedBuffer( 318 std::unique_ptr<BinaryValue> BinaryValue::CreateWithCopiedBuffer(
319 const char* buffer, 319 const char* buffer,
320 size_t size) { 320 size_t size) {
321 std::unique_ptr<char[]> buffer_copy(new char[size]); 321 std::unique_ptr<char[]> buffer_copy(new char[size]);
322 memcpy(buffer_copy.get(), buffer, size); 322 memcpy(buffer_copy.get(), buffer, size);
323 return base::MakeUnique<BinaryValue>(std::move(buffer_copy), size); 323 return MakeUnique<BinaryValue>(std::move(buffer_copy), size);
324 } 324 }
325 325
326 bool BinaryValue::GetAsBinary(const BinaryValue** out_value) const { 326 bool BinaryValue::GetAsBinary(const BinaryValue** out_value) const {
327 if (out_value) 327 if (out_value)
328 *out_value = this; 328 *out_value = this;
329 return true; 329 return true;
330 } 330 }
331 331
332 BinaryValue* BinaryValue::DeepCopy() const { 332 BinaryValue* BinaryValue::DeepCopy() const {
333 return CreateWithCopiedBuffer(buffer_.get(), size_).release(); 333 return CreateWithCopiedBuffer(buffer_.get(), size_).release();
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 if (out_value) 1035 if (out_value)
1036 *out_value = std::move(*Storage::iterator(iter)); 1036 *out_value = std::move(*Storage::iterator(iter));
1037 1037
1038 return list_.erase(iter); 1038 return list_.erase(iter);
1039 } 1039 }
1040 1040
1041 void ListValue::Append(std::unique_ptr<Value> in_value) { 1041 void ListValue::Append(std::unique_ptr<Value> in_value) {
1042 list_.push_back(std::move(in_value)); 1042 list_.push_back(std::move(in_value));
1043 } 1043 }
1044 1044
1045 #if !defined(OS_LINUX) || defined(OS_CHROMEOS)
1045 void ListValue::Append(Value* in_value) { 1046 void ListValue::Append(Value* in_value) {
1046 DCHECK(in_value); 1047 DCHECK(in_value);
1047 Append(WrapUnique(in_value)); 1048 Append(WrapUnique(in_value));
1048 } 1049 }
1050 #endif
1049 1051
1050 void ListValue::AppendBoolean(bool in_value) { 1052 void ListValue::AppendBoolean(bool in_value) {
1051 Append(new FundamentalValue(in_value)); 1053 Append(MakeUnique<FundamentalValue>(in_value));
1052 } 1054 }
1053 1055
1054 void ListValue::AppendInteger(int in_value) { 1056 void ListValue::AppendInteger(int in_value) {
1055 Append(new FundamentalValue(in_value)); 1057 Append(MakeUnique<FundamentalValue>(in_value));
1056 } 1058 }
1057 1059
1058 void ListValue::AppendDouble(double in_value) { 1060 void ListValue::AppendDouble(double in_value) {
1059 Append(new FundamentalValue(in_value)); 1061 Append(MakeUnique<FundamentalValue>(in_value));
1060 } 1062 }
1061 1063
1062 void ListValue::AppendString(StringPiece in_value) { 1064 void ListValue::AppendString(StringPiece in_value) {
1063 Append(new StringValue(in_value.as_string())); 1065 Append(MakeUnique<StringValue>(in_value.as_string()));
1064 } 1066 }
1065 1067
1066 void ListValue::AppendString(const string16& in_value) { 1068 void ListValue::AppendString(const string16& in_value) {
1067 Append(new StringValue(in_value)); 1069 Append(MakeUnique<StringValue>(in_value));
1068 } 1070 }
1069 1071
1070 void ListValue::AppendStrings(const std::vector<std::string>& in_values) { 1072 void ListValue::AppendStrings(const std::vector<std::string>& in_values) {
1071 for (std::vector<std::string>::const_iterator it = in_values.begin(); 1073 for (std::vector<std::string>::const_iterator it = in_values.begin();
1072 it != in_values.end(); ++it) { 1074 it != in_values.end(); ++it) {
1073 AppendString(*it); 1075 AppendString(*it);
1074 } 1076 }
1075 } 1077 }
1076 1078
1077 void ListValue::AppendStrings(const std::vector<string16>& in_values) { 1079 void ListValue::AppendStrings(const std::vector<string16>& in_values) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 ValueDeserializer::~ValueDeserializer() { 1164 ValueDeserializer::~ValueDeserializer() {
1163 } 1165 }
1164 1166
1165 std::ostream& operator<<(std::ostream& out, const Value& value) { 1167 std::ostream& operator<<(std::ostream& out, const Value& value) {
1166 std::string json; 1168 std::string json;
1167 JSONWriter::WriteWithOptions(value, JSONWriter::OPTIONS_PRETTY_PRINT, &json); 1169 JSONWriter::WriteWithOptions(value, JSONWriter::OPTIONS_PRETTY_PRINT, &json);
1168 return out << json; 1170 return out << json;
1169 } 1171 }
1170 1172
1171 } // namespace base 1173 } // namespace base
OLDNEW
« no previous file with comments | « base/values.h ('k') | chrome/browser/bookmarks/managed_bookmark_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698