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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « ipc/ipc_message_unittest.cc ('k') | ipc/ipc_message_utils_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 "ipc/ipc_message_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 case base::Value::Type::BOOLEAN: 89 case base::Value::Type::BOOLEAN:
90 sizer->AddBool(); 90 sizer->AddBool();
91 break; 91 break;
92 case base::Value::Type::INTEGER: 92 case base::Value::Type::INTEGER:
93 sizer->AddInt(); 93 sizer->AddInt();
94 break; 94 break;
95 case base::Value::Type::DOUBLE: 95 case base::Value::Type::DOUBLE:
96 sizer->AddDouble(); 96 sizer->AddDouble();
97 break; 97 break;
98 case base::Value::Type::STRING: { 98 case base::Value::Type::STRING: {
99 const base::StringValue* result; 99 const base::Value* result;
100 value->GetAsString(&result); 100 value->GetAsString(&result);
101 if (value->GetAsString(&result)) { 101 if (value->GetAsString(&result)) {
102 DCHECK(result); 102 DCHECK(result);
103 GetParamSize(sizer, result->GetString()); 103 GetParamSize(sizer, result->GetString());
104 } else { 104 } else {
105 std::string str; 105 std::string str;
106 bool as_string_result = value->GetAsString(&str); 106 bool as_string_result = value->GetAsString(&str);
107 DCHECK(as_string_result); 107 DCHECK(as_string_result);
108 GetParamSize(sizer, str); 108 GetParamSize(sizer, str);
109 } 109 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 double val; 282 double val;
283 if (!ReadParam(m, iter, &val)) 283 if (!ReadParam(m, iter, &val))
284 return false; 284 return false;
285 *value = new base::Value(val); 285 *value = new base::Value(val);
286 break; 286 break;
287 } 287 }
288 case base::Value::Type::STRING: { 288 case base::Value::Type::STRING: {
289 std::string val; 289 std::string val;
290 if (!ReadParam(m, iter, &val)) 290 if (!ReadParam(m, iter, &val))
291 return false; 291 return false;
292 *value = new base::StringValue(val); 292 *value = new base::Value(val);
293 break; 293 break;
294 } 294 }
295 case base::Value::Type::BINARY: { 295 case base::Value::Type::BINARY: {
296 const char* data; 296 const char* data;
297 int length; 297 int length;
298 if (!iter->ReadData(&data, &length)) 298 if (!iter->ReadData(&data, &length))
299 return false; 299 return false;
300 std::unique_ptr<base::BinaryValue> val = 300 std::unique_ptr<base::BinaryValue> val =
301 base::BinaryValue::CreateWithCopiedBuffer(data, length); 301 base::BinaryValue::CreateWithCopiedBuffer(data, length);
302 *value = val.release(); 302 *value = val.release();
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 return result; 1229 return result;
1230 } 1230 }
1231 1231
1232 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1232 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1233 l->append("<MSG>"); 1233 l->append("<MSG>");
1234 } 1234 }
1235 1235
1236 #endif // OS_WIN 1236 #endif // OS_WIN
1237 1237
1238 } // namespace IPC 1238 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_unittest.cc ('k') | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698