• Home
Name Date Size #Lines LOC

..--

DEPSD03-May-202488 65

README.jsD03-May-20241.9 KiB4936

js_arg_list.ccD03-May-2024592 2815

js_arg_list.hD03-May-20241 KiB4521

js_arg_list_unittest.ccD03-May-20241.1 KiB4126

js_backend.hD03-May-20241.1 KiB4321

js_controller.hD03-May-20241.6 KiB5221

js_event_details.ccD03-May-2024665 2916

js_event_details.hD03-May-20241.1 KiB4722

js_event_details_unittest.ccD03-May-2024945 3722

js_event_handler.hD03-May-2024705 3215

js_reply_handler.hD03-May-2024657 3014

js_test_util.ccD03-May-20243.7 KiB13892

js_test_util.hD03-May-20243.1 KiB10970

sync_js_controller.ccD03-May-20242.7 KiB8461

sync_js_controller.hD03-May-20242.5 KiB8247

sync_js_controller_unittest.ccD03-May-20244.9 KiB148107

README.js

1Overview of chrome://sync-internals
2-----------------------------------
3
4This note explains how chrome://sync-internals (also known as
5about:sync) interacts with the sync service/backend.
6
7Basically, chrome://sync-internals sends messages to the sync backend
8and the sync backend sends the reply asynchronously.  The sync backend
9also asynchronously raises events which chrome://sync-internals listen
10to.
11
12A message and its reply has a name and a list of arguments, which is
13basically a wrapper around an immutable ListValue.
14
15An event has a name and a details object, which is represented by a
16JsEventDetails (js_event_details.h) object, which is basically a
17wrapper around an immutable DictionaryValue.
18
19Message/event flow
20------------------
21
22chrome://sync-internals is represented by SyncInternalsUI
23(chrome/browser/ui/webui/sync_internals_ui.h).  SyncInternalsUI
24interacts with the sync service via a JsController (js_controller.h)
25object, which has a ProcessJsMessage() method that just delegates to
26an underlying JsBackend instance (js_backend.h).  The SyncInternalsUI
27object also registers itself (as a JsEventHandler
28[js_event_handler.h]) to the JsController object, and any events
29raised by the JsBackend are propagated to the JsController and then to
30the registered JsEventHandlers.
31
32The ProcessJsMessage() takes a WeakHandle (weak_handle.h) to a
33JsReplyHandler (js_reply_handler.h), which the backend uses to send
34replies safely across threads.  SyncInternalsUI implements
35JsReplyHandler, so it simply passes itself as the reply handler when
36it calls ProcessJsMessage() on the JsController.
37
38The following objects live on the UI thread:
39
40- SyncInternalsUI (implements JsEventHandler, JsReplyHandler)
41- SyncJsController (implements JsController, JsEventHandler)
42
43The following objects live on the sync thread:
44
45- SyncManager::SyncInternal (implements JsBackend)
46
47Of course, none of these objects need to know where the other objects
48live, since they interact via WeakHandles.
49