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

Unified Diff: sync/engine/traffic_logger.h

Issue 9732008: [Sync] Store the past 10 traffic records in memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/traffic_logger.h
diff --git a/sync/engine/traffic_logger.h b/sync/engine/traffic_logger.h
index 5cb8ffa81b4a3abec1d301d1522ab4bbd921e315..6e98d28411b3c04576e2c56613b92bd17984a1ed 100644
--- a/sync/engine/traffic_logger.h
+++ b/sync/engine/traffic_logger.h
@@ -10,6 +10,8 @@
#define CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_
#pragma once
+#include <string>
+
namespace sync_pb {
class ClientToServerResponse;
class ClientToServerMessage;
@@ -17,9 +19,35 @@ class ClientToServerMessage;
namespace browser_sync {
-void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg);
+namespace sessions {
+class SyncSession;
+} // namespace sessions
+
+enum TrafficMessageType {
+ CLIENT_TO_SERVER_MESSAGE,
+ CLIENT_TO_SERVER_RESPONSE
+};
+
+struct TrafficRecord {
+ // The serialized message.
+ std::string message;
+ TrafficMessageType message_type;
+ // If the message is too big to be kept in memory then it would be trucated.
+ // For now the entire message would be truncated if it is big.
+ // TODO(lipalani): Truncate the specifics to fit with in size.
+ bool truncated;
+ 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.
+ TrafficRecord(const std::string& message,
+ TrafficMessageType message_type,
+ 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.
+ ~TrafficRecord();
+};
+
+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
+ sessions::SyncSession* session);
void LogClientToServerResponse(
- const sync_pb::ClientToServerResponse& response);
+ const sync_pb::ClientToServerResponse& response,
+ sessions::SyncSession* session);
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698