Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // This file has the functions to log all the sync related HTTP communication. | 5 // This file has the functions to log all the sync related HTTP communication. |
| 6 // To get the log run a debug build of chrome with the flag | 6 // To get the log run a debug build of chrome with the flag |
| 7 // --vmodule=traffic_logger=1. | 7 // --vmodule=traffic_logger=1. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ | 9 #ifndef CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ |
| 10 #define CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ | 10 #define CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ |
| 11 #pragma once | 11 #pragma once |
| 12 | 12 |
| 13 #include <string> | |
| 14 | |
| 13 namespace sync_pb { | 15 namespace sync_pb { |
| 14 class ClientToServerResponse; | 16 class ClientToServerResponse; |
| 15 class ClientToServerMessage; | 17 class ClientToServerMessage; |
| 16 } // namespace sync_pb | 18 } // namespace sync_pb |
| 17 | 19 |
| 18 namespace browser_sync { | 20 namespace browser_sync { |
| 19 | 21 |
| 20 void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg); | 22 namespace sessions { |
| 23 class SyncSession; | |
| 24 } // namespace sessions | |
| 25 | |
| 26 enum TrafficMessageType { | |
| 27 CLIENT_TO_SERVER_MESSAGE, | |
| 28 CLIENT_TO_SERVER_RESPONSE | |
| 29 }; | |
| 30 | |
| 31 struct TrafficRecord { | |
| 32 // The serialized message. | |
| 33 std::string message; | |
| 34 TrafficMessageType message_type; | |
| 35 // If the message is too big to be kept in memory then it would be trucated. | |
| 36 // For now the entire message would be truncated if it is big. | |
| 37 // TODO(lipalani): Truncate the specifics to fit with in size. | |
| 38 bool truncated; | |
| 39 public: | |
|
akalin
2012/03/22 20:27:28
no 'public'; everything in a struct is public by d
lipalani1
2012/03/23 00:03:11
Done.
| |
| 40 TrafficRecord(const std::string& message, | |
| 41 TrafficMessageType message_type, | |
| 42 bool truncated); | |
|
akalin
2012/03/22 20:27:28
you should also define the default constructor (an
lipalani1
2012/03/23 00:03:11
Done.
| |
| 43 ~TrafficRecord(); | |
| 44 }; | |
| 45 | |
| 46 void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg, | |
|
akalin
2012/03/22 20:27:28
hmm I don't think the storing logic belongs in thi
lipalani1
2012/03/23 00:03:11
The context object for the most part has only gett
akalin
2012/03/23 00:58:50
I think the problem is that you take 'log' to mean
lipalani1
2012/03/26 21:25:21
Done.
akalin
2012/03/27 18:18:45
I meant a separate class for *just* storing/record
| |
| 47 sessions::SyncSession* session); | |
| 21 void LogClientToServerResponse( | 48 void LogClientToServerResponse( |
| 22 const sync_pb::ClientToServerResponse& response); | 49 const sync_pb::ClientToServerResponse& response, |
| 50 sessions::SyncSession* session); | |
| 23 | 51 |
| 24 } // namespace browser_sync | 52 } // namespace browser_sync |
| 25 | 53 |
| 26 #endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ | 54 #endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ |
| OLD | NEW |