| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ |
| 6 #define CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "sync/base/sync_export.h" |
| 14 #include "sync/protocol/sync.pb.h" | 15 #include "sync/protocol/sync.pb.h" |
| 15 | 16 |
| 16 namespace sync_pb { | 17 namespace sync_pb { |
| 17 class ClientToServerResponse; | 18 class ClientToServerResponse; |
| 18 class ClientToServerMessage; | 19 class ClientToServerMessage; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace syncer { | 22 namespace syncer { |
| 22 | 23 |
| 23 class TrafficRecorder { | 24 class SYNC_EXPORT_PRIVATE TrafficRecorder { |
| 24 public: | 25 public: |
| 25 enum TrafficMessageType { | 26 enum TrafficMessageType { |
| 26 CLIENT_TO_SERVER_MESSAGE, | 27 CLIENT_TO_SERVER_MESSAGE, |
| 27 CLIENT_TO_SERVER_RESPONSE, | 28 CLIENT_TO_SERVER_RESPONSE, |
| 28 UNKNOWN_MESSAGE_TYPE | 29 UNKNOWN_MESSAGE_TYPE |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 struct TrafficRecord { | 32 struct SYNC_EXPORT_PRIVATE TrafficRecord { |
| 32 // The serialized message. | 33 // The serialized message. |
| 33 std::string message; | 34 std::string message; |
| 34 TrafficMessageType message_type; | 35 TrafficMessageType message_type; |
| 35 // If the message is too big to be kept in memory then it should be | 36 // If the message is too big to be kept in memory then it should be |
| 36 // truncated. For now the entire message is omitted if it is too big. | 37 // truncated. For now the entire message is omitted if it is too big. |
| 37 // TODO(lipalani): Truncate the specifics to fit within size. | 38 // TODO(lipalani): Truncate the specifics to fit within size. |
| 38 bool truncated; | 39 bool truncated; |
| 39 | 40 |
| 40 TrafficRecord(const std::string& message, | 41 TrafficRecord(const std::string& message, |
| 41 TrafficMessageType message_type, | 42 TrafficMessageType message_type, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 68 // Maximum size of each message. | 69 // Maximum size of each message. |
| 69 unsigned int max_message_size_; | 70 unsigned int max_message_size_; |
| 70 std::deque<TrafficRecord> records_; | 71 std::deque<TrafficRecord> records_; |
| 71 DISALLOW_COPY_AND_ASSIGN(TrafficRecorder); | 72 DISALLOW_COPY_AND_ASSIGN(TrafficRecorder); |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 } // namespace syncer | 75 } // namespace syncer |
| 75 | 76 |
| 76 #endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ | 77 #endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ |
| 77 | 78 |
| OLD | NEW |