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

Side by Side Diff: jingle/glue/utils.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 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 | « ipc/ipc_message_utils.cc ('k') | media/base/media_log.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 "jingle/glue/utils.h" 5 #include "jingle/glue/utils.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 28 matching lines...) Expand all
39 value.SetString("ip", candidate.address().ipaddr().ToString()); 39 value.SetString("ip", candidate.address().ipaddr().ToString());
40 value.SetInteger("port", candidate.address().port()); 40 value.SetInteger("port", candidate.address().port());
41 value.SetString("type", candidate.type()); 41 value.SetString("type", candidate.type());
42 value.SetString("protocol", candidate.protocol()); 42 value.SetString("protocol", candidate.protocol());
43 value.SetString("username", candidate.username()); 43 value.SetString("username", candidate.username());
44 value.SetString("password", candidate.password()); 44 value.SetString("password", candidate.password());
45 value.SetDouble("preference", candidate.preference()); 45 value.SetDouble("preference", candidate.preference());
46 value.SetInteger("generation", candidate.generation()); 46 value.SetInteger("generation", candidate.generation());
47 47
48 std::string result; 48 std::string result;
49 base::JSONWriter::Write(&value, &result); 49 base::JSONWriter::Write(value, &result);
50 return result; 50 return result;
51 } 51 }
52 52
53 bool DeserializeP2PCandidate(const std::string& candidate_str, 53 bool DeserializeP2PCandidate(const std::string& candidate_str,
54 cricket::Candidate* candidate) { 54 cricket::Candidate* candidate) {
55 scoped_ptr<base::Value> value( 55 scoped_ptr<base::Value> value(
56 base::JSONReader::Read(candidate_str, base::JSON_ALLOW_TRAILING_COMMAS)); 56 base::JSONReader::Read(candidate_str, base::JSON_ALLOW_TRAILING_COMMAS));
57 if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) { 57 if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) {
58 return false; 58 return false;
59 } 59 }
(...skipping 26 matching lines...) Expand all
86 candidate->set_protocol(protocol); 86 candidate->set_protocol(protocol);
87 candidate->set_username(username); 87 candidate->set_username(username);
88 candidate->set_password(password); 88 candidate->set_password(password);
89 candidate->set_preference(static_cast<float>(preference)); 89 candidate->set_preference(static_cast<float>(preference));
90 candidate->set_generation(generation); 90 candidate->set_generation(generation);
91 91
92 return true; 92 return true;
93 } 93 }
94 94
95 } // namespace jingle_glue 95 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | media/base/media_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698