| Index: chrome/browser/sync/internal_api/sync_manager.cc
|
| diff --git a/chrome/browser/sync/internal_api/sync_manager.cc b/chrome/browser/sync/internal_api/sync_manager.cc
|
| index de15872312877022e63ce02b4b3e40b08b531280..38d744055fb9f9f81d931f6521efa0f0fc3ae799 100644
|
| --- a/chrome/browser/sync/internal_api/sync_manager.cc
|
| +++ b/chrome/browser/sync/internal_api/sync_manager.cc
|
| @@ -122,6 +122,10 @@ namespace sync_api {
|
| const int SyncManager::kDefaultNudgeDelayMilliseconds = 200;
|
| const int SyncManager::kPreferencesNudgeDelayMilliseconds = 2000;
|
|
|
| +// Maximum count and size for traffic recorder.
|
| +const unsigned int kMaxMessagesToRecord = 10;
|
| +const unsigned int kMaxMessageSizeToRecord = 5 * 1024;
|
| +
|
| //////////////////////////////////////////////////////////////////////////
|
| // SyncManager's implementation: SyncManager::SyncInternal
|
| class SyncManager::SyncInternal
|
| @@ -142,6 +146,7 @@ class SyncManager::SyncInternal
|
| initialized_(false),
|
| testing_mode_(NON_TEST),
|
| observing_ip_address_changes_(false),
|
| + traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord),
|
| encryptor_(NULL),
|
| unrecoverable_error_handler_(NULL),
|
| report_unrecoverable_error_function_(NULL),
|
| @@ -176,6 +181,9 @@ class SyncManager::SyncInternal
|
| BindJsMessageHandler(
|
| "findNodesContainingString",
|
| &SyncManager::SyncInternal::FindNodesContainingString);
|
| + BindJsMessageHandler(
|
| + "getClientServerTraffic",
|
| + &SyncManager::SyncInternal::GetClientServerTraffic);
|
| }
|
|
|
| virtual ~SyncInternal() {
|
| @@ -522,6 +530,7 @@ class SyncManager::SyncInternal
|
| JsArgList GetNodeDetailsById(const JsArgList& args);
|
| JsArgList GetChildNodeIds(const JsArgList& args);
|
| JsArgList FindNodesContainingString(const JsArgList& args);
|
| + JsArgList GetClientServerTraffic(const JsArgList& args);
|
|
|
| FilePath database_path_;
|
|
|
| @@ -611,6 +620,8 @@ class SyncManager::SyncInternal
|
| // This is for keeping track of client events to send to the server.
|
| DebugInfoEventListener debug_info_event_listener_;
|
|
|
| + browser_sync::TrafficRecorder traffic_recorder_;
|
| +
|
| Encryptor* encryptor_;
|
| UnrecoverableErrorHandler* unrecoverable_error_handler_;
|
| ReportUnrecoverableErrorFunction report_unrecoverable_error_function_;
|
| @@ -963,7 +974,8 @@ bool SyncManager::SyncInternal::Init(
|
| model_safe_worker_registrar,
|
| extensions_activity_monitor,
|
| listeners,
|
| - &debug_info_event_listener_);
|
| + &debug_info_event_listener_,
|
| + &traffic_recorder_);
|
| context->set_account_name(credentials.email);
|
| // The SyncScheduler takes ownership of |context|.
|
| scheduler_.reset(new SyncScheduler(name_, context, new Syncer()));
|
| @@ -2217,6 +2229,15 @@ JsArgList SyncManager::SyncInternal::GetRootNodeDetails(
|
| return JsArgList(&return_args);
|
| }
|
|
|
| +JsArgList SyncManager::SyncInternal::GetClientServerTraffic(
|
| + const JsArgList& args) {
|
| + ListValue return_args;
|
| + ListValue* value = traffic_recorder_.ToValue();
|
| + if (value != NULL)
|
| + return_args.Append(value);
|
| + return JsArgList(&return_args);
|
| +}
|
| +
|
| namespace {
|
|
|
| int64 GetId(const ListValue& ids, int i) {
|
|
|