tree: 030d6855cda577b84368567cd49aea237ebd94ba
  1. app_list_specifics.proto
  2. app_notification_specifics.proto
  3. app_setting_specifics.proto
  4. app_specifics.proto
  5. arc_package_specifics.proto
  6. autofill_offer_specifics.proto
  7. autofill_specifics.proto
  8. bookmark_model_metadata.proto
  9. bookmark_specifics.proto
  10. BUILD.gn
  11. client_commands.proto
  12. client_debug_info.proto
  13. data_type_progress_marker.proto
  14. DEPS
  15. device_info_specifics.proto
  16. dictionary_specifics.proto
  17. encryption.proto
  18. entity_data.cc
  19. entity_data.h
  20. entity_data_unittest.cc
  21. entity_metadata.proto
  22. entity_specifics.proto
  23. experiment_status.proto
  24. experiments_specifics.proto
  25. extension_setting_specifics.proto
  26. extension_specifics.proto
  27. favicon_image_specifics.proto
  28. favicon_tracking_specifics.proto
  29. gaia_password_reuse.proto
  30. get_updates_caller_info.proto
  31. history_delete_directive_specifics.proto
  32. history_status.proto
  33. list_passwords_result.proto
  34. local_trusted_vault.proto
  35. loopback_server.proto
  36. managed_user_setting_specifics.proto
  37. managed_user_shared_setting_specifics.proto
  38. managed_user_specifics.proto
  39. model_type_state.proto
  40. model_type_store_schema_descriptor.proto
  41. nigori_local_data.proto
  42. nigori_specifics.proto
  43. os_preference_specifics.proto
  44. os_priority_preference_specifics.proto
  45. OWNERS
  46. password_specifics.proto
  47. password_with_local_data.proto
  48. persisted_entity_data.proto
  49. preference_specifics.proto
  50. printer_specifics.proto
  51. priority_preference_specifics.proto
  52. proto_enum_conversions.cc
  53. proto_enum_conversions.h
  54. proto_enum_conversions_unittest.cc
  55. proto_memory_estimations.cc
  56. proto_memory_estimations.h
  57. proto_value_conversions.cc
  58. proto_value_conversions.h
  59. proto_value_conversions_unittest.cc
  60. proto_visitors.h
  61. protocol_sources.gni
  62. reading_list_specifics.proto
  63. README.md
  64. search_engine_specifics.proto
  65. security_event_specifics.proto
  66. send_tab_to_self_specifics.proto
  67. session_specifics.proto
  68. sharing_message_specifics.proto
  69. sync.proto
  70. sync_entity.proto
  71. sync_enums.proto
  72. sync_invalidations_payload.proto
  73. sync_protocol_error.cc
  74. sync_protocol_error.h
  75. synced_notification_app_info_specifics.proto
  76. synced_notification_specifics.proto
  77. test.proto
  78. theme_specifics.proto
  79. typed_url_specifics.proto
  80. unique_position.proto
  81. user_consent_specifics.proto
  82. user_consent_types.proto
  83. user_event_specifics.proto
  84. vault.proto
  85. web_app_specifics.proto
  86. webauthn_credential_specifics.proto
  87. wifi_configuration_specifics.proto
  88. workspace_desk_specifics.proto
components/sync/protocol/README.md

Sync Protocol Style

General guidelines:

  • Follow the Protocol Buffers Style Guide
  • Follow the Proto Do‘s and Don’ts (sorry, Googlers only).
  • Maintain local consistency.
  • Use proto2 syntax.
  • Always get a review from someone in the OWNERS file in this folder. Don't use owners from higher-level folders, and never TBR changes!

Some specific guidelines on top of the general ones above, or just things that often come up:

  • Enum entries should be in ALL_CAPS (different from C++!), and for new code, the first entry should be a FOO_UNSPECIFIED = 0 one.
  • Timestamp fields must specify their epoch and unit in a suffix, in this format: _[unix|windows]_epoch_[seconds|millis|micros|nanos], e.g creation_time_unix_epoch_millis.
    • Many existing fields do not follow this format, and specify epoch/unit in a comment instead. Follow the format for all new fields, though!
  • Similarly, duration fields must specify their unit as _[minutes|seconds|millis|...].
  • Proto changes also require corresponding changes in proto_visitors.h and (where appropriate) in proto_enum_conversions.h/cc.
  • Backwards compatibility: In general, all changes must be fully backwards-compatible - consider that a single user might be running different versions of the browser simultaneously! Also note that Sync supports clients up to a few years old, so deprecating/removing an existing field is typically a multi-year process.
    • As one special case, renaming a field within a specifics message is generally safe (unless there are special server-side integrations that depend on the name). However, never rename fields anywhere outside of specifics.
  • Deprecating fields:
    • If the field is still accessed: Mark it as [deprecated = true]. This is the common case, since the browser typically needs to continue supporting the old field for backwards compatibility reasons.
    • If the field is not accessed anymore (i.e. no non-ancient clients depend on the field being populated anymore, all migration code has been retired, etc): Remove the field, and add reserved entries for both its name and its tag number.
  • Deprecating enum values: This is particularly tricky, especially if the default value is not a FOO_UNSPECIFIED one (see above). A common pattern is prepending DEPRECATED_ to the entry name.