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

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..34f76b4ac33c8b1189ca61a8010148f6e9f39f8b 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,37 @@ 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,
+ UNKNOWN_MESSAGE_TYPE
+};
+
+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;
+
+ TrafficRecord(const std::string& message,
+ TrafficMessageType message_type,
+ bool truncated);
+ TrafficRecord();
+ ~TrafficRecord();
+};
+
+void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg,
+ 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