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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « gpu/tools/compositor_model_bench/render_tree.cc ('k') | jingle/glue/utils.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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/nullable_string16.h" 10 #include "base/nullable_string16.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 const Message* m, PickleIterator* iter, param_type* r) { 314 const Message* m, PickleIterator* iter, param_type* r) {
315 int type; 315 int type;
316 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) 316 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY)
317 return false; 317 return false;
318 318
319 return ReadDictionaryValue(m, iter, r, 0); 319 return ReadDictionaryValue(m, iter, r, 0);
320 } 320 }
321 321
322 void ParamTraits<DictionaryValue>::Log(const param_type& p, std::string* l) { 322 void ParamTraits<DictionaryValue>::Log(const param_type& p, std::string* l) {
323 std::string json; 323 std::string json;
324 base::JSONWriter::Write(&p, false, &json); 324 base::JSONWriter::Write(&p, &json);
325 l->append(json); 325 l->append(json);
326 } 326 }
327 327
328 void ParamTraits<ListValue>::Write(Message* m, const param_type& p) { 328 void ParamTraits<ListValue>::Write(Message* m, const param_type& p) {
329 WriteValue(m, &p, 0); 329 WriteValue(m, &p, 0);
330 } 330 }
331 331
332 bool ParamTraits<ListValue>::Read( 332 bool ParamTraits<ListValue>::Read(
333 const Message* m, PickleIterator* iter, param_type* r) { 333 const Message* m, PickleIterator* iter, param_type* r) {
334 int type; 334 int type;
335 if (!ReadParam(m, iter, &type) || type != Value::TYPE_LIST) 335 if (!ReadParam(m, iter, &type) || type != Value::TYPE_LIST)
336 return false; 336 return false;
337 337
338 return ReadListValue(m, iter, r, 0); 338 return ReadListValue(m, iter, r, 0);
339 } 339 }
340 340
341 void ParamTraits<ListValue>::Log(const param_type& p, std::string* l) { 341 void ParamTraits<ListValue>::Log(const param_type& p, std::string* l) {
342 std::string json; 342 std::string json;
343 base::JSONWriter::Write(&p, false, &json); 343 base::JSONWriter::Write(&p, &json);
344 l->append(json); 344 l->append(json);
345 } 345 }
346 346
347 void ParamTraits<std::wstring>::Log(const param_type& p, std::string* l) { 347 void ParamTraits<std::wstring>::Log(const param_type& p, std::string* l) {
348 l->append(WideToUTF8(p)); 348 l->append(WideToUTF8(p));
349 } 349 }
350 350
351 void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) { 351 void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) {
352 WriteParam(m, p.string()); 352 WriteParam(m, p.string());
353 WriteParam(m, p.is_null()); 353 WriteParam(m, p.is_null());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 ReadParam(m, iter, &r->routing_id) && 496 ReadParam(m, iter, &r->routing_id) &&
497 ReadParam(m, iter, &r->type) && 497 ReadParam(m, iter, &r->type) &&
498 ReadParam(m, iter, &r->flags) && 498 ReadParam(m, iter, &r->flags) &&
499 ReadParam(m, iter, &r->sent) && 499 ReadParam(m, iter, &r->sent) &&
500 ReadParam(m, iter, &r->receive) && 500 ReadParam(m, iter, &r->receive) &&
501 ReadParam(m, iter, &r->dispatch) && 501 ReadParam(m, iter, &r->dispatch) &&
502 ReadParam(m, iter, &r->params); 502 ReadParam(m, iter, &r->params);
503 } 503 }
504 504
505 } // namespace IPC 505 } // namespace IPC
OLDNEW
« no previous file with comments | « gpu/tools/compositor_model_bench/render_tree.cc ('k') | jingle/glue/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698