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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 2065793002: Return a unique_ptr from BinaryValue::CreateWithCopiedBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android and CrOS Created 4 years, 6 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
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (!ReadParam(m, iter, &val)) 291 if (!ReadParam(m, iter, &val))
292 return false; 292 return false;
293 *value = new base::StringValue(val); 293 *value = new base::StringValue(val);
294 break; 294 break;
295 } 295 }
296 case base::Value::TYPE_BINARY: { 296 case base::Value::TYPE_BINARY: {
297 const char* data; 297 const char* data;
298 int length; 298 int length;
299 if (!iter->ReadData(&data, &length)) 299 if (!iter->ReadData(&data, &length))
300 return false; 300 return false;
301 *value = base::BinaryValue::CreateWithCopiedBuffer(data, length); 301 std::unique_ptr<base::BinaryValue> val =
302 base::BinaryValue::CreateWithCopiedBuffer(data, length);
303 *value = val.release();
302 break; 304 break;
303 } 305 }
304 case base::Value::TYPE_DICTIONARY: { 306 case base::Value::TYPE_DICTIONARY: {
305 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue()); 307 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue());
306 if (!ReadDictionaryValue(m, iter, val.get(), recursion)) 308 if (!ReadDictionaryValue(m, iter, val.get(), recursion))
307 return false; 309 return false;
308 *value = val.release(); 310 *value = val.release();
309 break; 311 break;
310 } 312 }
311 case base::Value::TYPE_LIST: { 313 case base::Value::TYPE_LIST: {
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 return result; 1205 return result;
1204 } 1206 }
1205 1207
1206 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1208 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1207 l->append("<MSG>"); 1209 l->append("<MSG>");
1208 } 1210 }
1209 1211
1210 #endif // OS_WIN 1212 #endif // OS_WIN
1211 1213
1212 } // namespace IPC 1214 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698