Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/sync/engine/traffic_logger.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/json/json_writer.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "chrome/browser/sync/protocol/proto_value_conversions.h" | |
| 13 #include "chrome/browser/sync/protocol/sync.pb.h" | |
| 14 | |
| 15 namespace browser_sync { | |
| 16 | |
| 17 namespace { | |
| 18 template<class T> | |
|
akalin
2012/03/13 00:20:43
space before <
lipalani1
2012/03/13 21:32:40
Done.
| |
| 19 void LogData(const T& data, | |
| 20 DictionaryValue*(to_dictionary_value)(const T&, bool), | |
|
akalin
2012/03/13 00:20:43
the right syntax is:
DictionaryValue* (*to_dictio
lipalani1
2012/03/13 21:32:40
Yeah that is correct. I have seen this convention
| |
| 21 const std::string& description) { | |
| 22 if (VLOG_IS_ON(1)) { | |
| 23 scoped_ptr<DictionaryValue> value(to_dictionary_value(data, true)); | |
|
akalin
2012/03/13 00:20:43
(*to_dictionary_value)(data, true)
akalin
2012/03/13 00:20:43
comment what "true" means, like
(data, true /* pa
lipalani1
2012/03/13 21:32:40
Done.
| |
| 24 std::string message; | |
| 25 base::JSONWriter::Write(value.get(), true, &message); | |
|
akalin
2012/03/13 00:20:43
here too
lipalani1
2012/03/13 21:32:40
Done.
| |
| 26 VLOG(1) << "\n" << description; | |
| 27 VLOG(1) << "\n" << message; | |
| 28 } | |
| 29 } | |
| 30 } // namespace | |
| 31 | |
| 32 void LogClientToServerMessage(const ClientToServerMessage& msg) { | |
| 33 LogData((sync_pb::ClientToServerMessage)msg, ClientToServerMessageToValue, | |
|
akalin
2012/03/13 00:20:43
this is rendered moot by the comment in the header
akalin
2012/03/13 00:20:43
&ClientToServerMessageToValue
lipalani1
2012/03/13 21:32:40
Done.
lipalani1
2012/03/13 21:32:40
The necessity for the cast was to have the templat
lipalani1
2012/03/13 21:32:40
Done.
| |
| 34 "******Client To Server Message******"); | |
| 35 // TODO(lipalani) : Store the data(minus specifics) | |
| 36 // in a circular buffer in memory. | |
| 37 } | |
| 38 | |
| 39 void LogClientToServerResponse( | |
| 40 const sync_pb::ClientToServerResponse& response) { | |
| 41 LogData(response, ClientToServerResponseToValue, | |
|
akalin
2012/03/13 00:20:43
&ClientToServerResponseToValue
lipalani1
2012/03/13 21:32:40
Done.
| |
| 42 "******Server Response******"); | |
| 43 // TODO(lipalani) : Store the data(minus specifics) | |
| 44 // in a circular buffer in memory. | |
| 45 } | |
| 46 | |
| 47 } // namespace browser_sync | |
| OLD | NEW |