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

Side by Side Diff: sync/engine/traffic_logger.cc

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « sync/api/sync_data.cc ('k') | sync/engine/traffic_recorder.h » ('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 "sync/engine/traffic_logger.h" 5 #include "sync/engine/traffic_logger.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "sync/protocol/proto_value_conversions.h" 13 #include "sync/protocol/proto_value_conversions.h"
14 #include "sync/protocol/sync.pb.h" 14 #include "sync/protocol/sync.pb.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 namespace { 18 namespace {
19 template <class T> 19 template <class T>
20 void LogData(const T& data, 20 void LogData(const T& data,
21 DictionaryValue* (*to_dictionary_value)(const T&, bool), 21 base::DictionaryValue* (*to_dictionary_value)(const T&, bool),
22 const std::string& description) { 22 const std::string& description) {
23 if (::logging::DEBUG_MODE && VLOG_IS_ON(1)) { 23 if (::logging::DEBUG_MODE && VLOG_IS_ON(1)) {
24 scoped_ptr<DictionaryValue> value( 24 scoped_ptr<base::DictionaryValue> value(
25 (*to_dictionary_value)(data, true /* include_specifics */)); 25 (*to_dictionary_value)(data, true /* include_specifics */));
26 std::string message; 26 std::string message;
27 base::JSONWriter::WriteWithOptions(value.get(), 27 base::JSONWriter::WriteWithOptions(value.get(),
28 base::JSONWriter::OPTIONS_PRETTY_PRINT, 28 base::JSONWriter::OPTIONS_PRETTY_PRINT,
29 &message); 29 &message);
30 DVLOG(1) << "\n" << description << "\n" << message << "\n"; 30 DVLOG(1) << "\n" << description << "\n" << message << "\n";
31 } 31 }
32 } 32 }
33 } // namespace 33 } // namespace
34 34
35 void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg) { 35 void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg) {
36 LogData(msg, &ClientToServerMessageToValue, 36 LogData(msg, &ClientToServerMessageToValue,
37 "******Client To Server Message******"); 37 "******Client To Server Message******");
38 } 38 }
39 39
40 void LogClientToServerResponse( 40 void LogClientToServerResponse(
41 const sync_pb::ClientToServerResponse& response) { 41 const sync_pb::ClientToServerResponse& response) {
42 LogData(response, &ClientToServerResponseToValue, 42 LogData(response, &ClientToServerResponseToValue,
43 "******Server Response******"); 43 "******Server Response******");
44 } 44 }
45 45
46 } // namespace syncer 46 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/sync_data.cc ('k') | sync/engine/traffic_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698