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

Side by Side Diff: sync/engine/traffic_recorder.h

Issue 9826035: [Sync] Display the client server traffic log in about:sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For submitting. Created 8 years, 8 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/engine/syncer_unittest.cc ('k') | sync/engine/traffic_recorder.cc » ('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 #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 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/values.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 browser_sync { 22 namespace browser_sync {
22 23
23 class TrafficRecorder { 24 class TrafficRecorder {
(...skipping 11 matching lines...) Expand all
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,
42 bool truncated); 43 bool truncated);
43 TrafficRecord(); 44 TrafficRecord();
44 ~TrafficRecord(); 45 ~TrafficRecord();
46 DictionaryValue* ToValue() const;
45 }; 47 };
46 48
47 TrafficRecorder(unsigned int max_messages, unsigned int max_message_size); 49 TrafficRecorder(unsigned int max_messages, unsigned int max_message_size);
48 ~TrafficRecorder(); 50 ~TrafficRecorder();
49 51
50 void RecordClientToServerMessage(const sync_pb::ClientToServerMessage& msg); 52 void RecordClientToServerMessage(const sync_pb::ClientToServerMessage& msg);
51 void RecordClientToServerResponse( 53 void RecordClientToServerResponse(
52 const sync_pb::ClientToServerResponse& response); 54 const sync_pb::ClientToServerResponse& response);
55 ListValue* ToValue() const;
53 56
54 const std::deque<TrafficRecord>& records() { 57 const std::deque<TrafficRecord>& records() {
55 return records_; 58 return records_;
56 } 59 }
57 60
58 private: 61 private:
59 void AddTrafficToQueue(TrafficRecord* record); 62 void AddTrafficToQueue(TrafficRecord* record);
60 void StoreProtoInQueue(const ::google::protobuf::MessageLite& msg, 63 void StoreProtoInQueue(const ::google::protobuf::MessageLite& msg,
61 TrafficMessageType type); 64 TrafficMessageType type);
62 65
63 // Maximum number of messages stored in the queue. 66 // Maximum number of messages stored in the queue.
64 unsigned int max_messages_; 67 unsigned int max_messages_;
65 68
66 // Maximum size of each message. 69 // Maximum size of each message.
67 unsigned int max_message_size_; 70 unsigned int max_message_size_;
68 std::deque<TrafficRecord> records_; 71 std::deque<TrafficRecord> records_;
69 DISALLOW_COPY_AND_ASSIGN(TrafficRecorder); 72 DISALLOW_COPY_AND_ASSIGN(TrafficRecorder);
70 }; 73 };
71 74
72 } // namespace browser_sync 75 } // namespace browser_sync
73 76
74 #endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_ 77 #endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_RECORDER_H_
75 78
OLDNEW
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/engine/traffic_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698