summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 19:57:06 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 19:57:06 +0000
commitdd2e6f62e070928f7ce62aae7726c0527f5f9e91 (patch)
treedf50056ea966f50610a047b104affd2801cfa99c /sync
parentb4ff26201d6c0b37565556b4566407c50439d521 (diff)
downloadchromium_src-dd2e6f62e070928f7ce62aae7726c0527f5f9e91.zip
chromium_src-dd2e6f62e070928f7ce62aae7726c0527f5f9e91.tar.gz
chromium_src-dd2e6f62e070928f7ce62aae7726c0527f5f9e91.tar.bz2
[Sync] Add debug info proto conversion
This allows us to see the debug info we send up to the server as part of the traffic recorder's events. BUG=158576 Review URL: https://chromiumcodereview.appspot.com/11348144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/protocol/client_debug_info.proto8
-rw-r--r--sync/protocol/proto_enum_conversions.cc23
-rw-r--r--sync/protocol/proto_enum_conversions.h4
-rw-r--r--sync/protocol/proto_value_conversions.cc52
-rw-r--r--sync/protocol/proto_value_conversions.h15
5 files changed, 99 insertions, 3 deletions
diff --git a/sync/protocol/client_debug_info.proto b/sync/protocol/client_debug_info.proto
index 7be62d5..7e4e1a5 100644
--- a/sync/protocol/client_debug_info.proto
+++ b/sync/protocol/client_debug_info.proto
@@ -82,11 +82,11 @@ message DebugEventInfo {
// the absence of bugs.
STOP_SYNCING_PERMANENTLY = 6; // Server sent stop syncing permanently.
- ENCRYPTED_TYPES_CHANGED = 9; // Set of encrypted types has changed.
ENCRYPTION_COMPLETE = 7; // Client has finished encrypting all data.
ACTIONABLE_ERROR = 8; // Client received an actionable error.
- BOOTSTRAP_TOKEN_UPDATED = 9; // A new cryptographer bootstrap token was
- // generated.
+ ENCRYPTED_TYPES_CHANGED = 9; // Set of encrypted types has changed.
+ // NOTE: until m25 bootstrap token updated also
+ // shared this field (erroneously).
PASSPHRASE_TYPE_CHANGED = 10; // The encryption passphrase state changed.
KEYSTORE_TOKEN_UPDATED = 11; // A new keystore encryption token was
// persisted.
@@ -94,6 +94,8 @@ message DebugEventInfo {
// at least partially successful
// configuration and is once again syncing
// with the server.
+ BOOTSTRAP_TOKEN_UPDATED = 13; // A new cryptographer bootstrap token was
+ // generated.
}
// Each of the following fields correspond to different kinds of events. as
diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc
index 6db81c7..ef1d812 100644
--- a/sync/protocol/proto_enum_conversions.cc
+++ b/sync/protocol/proto_enum_conversions.cc
@@ -179,6 +179,29 @@ const char* PassphraseTypeString(
return "";
}
+const char* SingletonEventTypeString(
+ sync_pb::DebugEventInfo::SingletonEventType type) {
+ ASSERT_ENUM_BOUNDS(sync_pb::DebugEventInfo, SingletonEventType,
+ CONNECTION_STATUS_CHANGE, BOOTSTRAP_TOKEN_UPDATED);
+ switch (type) {
+ ENUM_CASE(sync_pb::DebugEventInfo, CONNECTION_STATUS_CHANGE);
+ ENUM_CASE(sync_pb::DebugEventInfo, UPDATED_TOKEN);
+ ENUM_CASE(sync_pb::DebugEventInfo, PASSPHRASE_REQUIRED);
+ ENUM_CASE(sync_pb::DebugEventInfo, PASSPHRASE_ACCEPTED);
+ ENUM_CASE(sync_pb::DebugEventInfo, INITIALIZATION_COMPLETE);
+ ENUM_CASE(sync_pb::DebugEventInfo, STOP_SYNCING_PERMANENTLY);
+ ENUM_CASE(sync_pb::DebugEventInfo, ENCRYPTION_COMPLETE);
+ ENUM_CASE(sync_pb::DebugEventInfo, ACTIONABLE_ERROR);
+ ENUM_CASE(sync_pb::DebugEventInfo, ENCRYPTED_TYPES_CHANGED);
+ ENUM_CASE(sync_pb::DebugEventInfo, PASSPHRASE_TYPE_CHANGED);
+ ENUM_CASE(sync_pb::DebugEventInfo, KEYSTORE_TOKEN_UPDATED);
+ ENUM_CASE(sync_pb::DebugEventInfo, CONFIGURE_COMPLETE);
+ ENUM_CASE(sync_pb::DebugEventInfo, BOOTSTRAP_TOKEN_UPDATED);
+ }
+ NOTREACHED();
+ return "";
+}
+
#undef ASSERT_ENUM_BOUNDS
#undef ENUM_CASE
diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h
index ef34b05..e3f9315 100644
--- a/sync/protocol/proto_enum_conversions.h
+++ b/sync/protocol/proto_enum_conversions.h
@@ -7,6 +7,7 @@
// Keep this file in sync with the .proto files in this directory.
+#include "sync/protocol/client_debug_info.pb.h"
#include "sync/protocol/session_specifics.pb.h"
#include "sync/protocol/sync.pb.h"
@@ -47,6 +48,9 @@ const char* GetFaviconTypeString(
const char* PassphraseTypeString(
sync_pb::NigoriSpecifics::PassphraseType type);
+const char* SingletonEventTypeString(
+ sync_pb::DebugEventInfo::SingletonEventType type);
+
} // namespace syncer
#endif // SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index 70b2fcd..df151f7 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -640,10 +640,62 @@ DictionaryValue* ClientToServerMessageToValue(
SET(get_updates, GetUpdatesMessageToValue);
SET_STR(store_birthday);
SET_BOOL(sync_problem_detected);
+ SET(debug_info, DebugInfoToValue);
SET(client_status, ClientStatusToValue);
return value;
}
+DictionaryValue* DatatypeAssociationStatsToValue(
+ const sync_pb::DatatypeAssociationStats& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_INT32(data_type_id);
+ SET_INT32(num_local_items_before_association);
+ SET_INT32(num_sync_items_before_association);
+ SET_INT32(num_local_items_after_association);
+ SET_INT32(num_sync_items_after_association);
+ SET_INT32(num_local_items_added);
+ SET_INT32(num_local_items_deleted);
+ SET_INT32(num_local_items_modified);
+ SET_INT32(num_sync_items_added);
+ SET_INT32(num_sync_items_deleted);
+ SET_INT32(num_sync_items_modified);
+ SET_BOOL(had_error);
+ return value;
+}
+
+DictionaryValue* DebugEventInfoToValue(
+ const sync_pb::DebugEventInfo& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_ENUM(singleton_event, SingletonEventTypeString);
+ SET(sync_cycle_completed_event_info, SyncCycleCompletedEventInfoToValue);
+ SET_INT32(nudging_datatype);
+ SET_INT32_REP(datatypes_notified_from_server);
+ SET(datatype_association_stats, DatatypeAssociationStatsToValue);
+ return value;
+}
+
+DictionaryValue* DebugInfoToValue(
+ const sync_pb::DebugInfo& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_REP(events, DebugEventInfoToValue);
+ SET_BOOL(cryptographer_ready);
+ SET_BOOL(cryptographer_has_pending_keys);
+ SET_BOOL(events_dropped);
+ return value;
+}
+
+base::DictionaryValue* SyncCycleCompletedEventInfoToValue(
+ const sync_pb::SyncCycleCompletedEventInfo& proto) {
+ DictionaryValue* value = new DictionaryValue();
+ SET_INT32(num_encryption_conflicts);
+ SET_INT32(num_hierarchy_conflicts);
+ SET_INT32(num_server_conflicts);
+ SET_INT32(num_updates_downloaded);
+ SET_INT32(num_reflected_updates_downloaded);
+ SET(caller_info, GetUpdatesCallerInfoToValue);
+ return value;
+}
+
#undef SET
#undef SET_REP
diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h
index 1e3f7a3..4dded17 100644
--- a/sync/protocol/proto_value_conversions.h
+++ b/sync/protocol/proto_value_conversions.h
@@ -21,6 +21,9 @@ class AutofillSpecifics;
class BookmarkSpecifics;
class ClientToServerMessage;
class ClientToServerResponse;
+class DatatypeAssociationStats;
+class DebugEventInfo;
+class DebugInfo;
class DeviceInfoSpecifics;
class DeviceInformation;
class EncryptedData;
@@ -43,6 +46,7 @@ class SessionHeader;
class SessionSpecifics;
class SessionTab;
class SessionWindow;
+class SyncCycleCompletedEventInfo;
class TabNavigation;
class ThemeSpecifics;
class TimeRangeDirective;
@@ -178,6 +182,17 @@ base::DictionaryValue* ClientToServerResponseToValue(
const sync_pb::ClientToServerResponse& proto,
bool include_specifics);
+base::DictionaryValue* DatatypeAssociationStatsToValue(
+ const sync_pb::DatatypeAssociationStats& proto);
+
+base::DictionaryValue* DebugEventInfoToValue(
+ const sync_pb::DebugEventInfo& proto);
+
+base::DictionaryValue* DebugInfoToValue(
+ const sync_pb::DebugInfo& proto);
+
+base::DictionaryValue* SyncCycleCompletedEventInfoToValue(
+ const sync_pb::SyncCycleCompletedEventInfo& proto);
} // namespace syncer