[android] Move most ChromeBackupAgent pref work from C++ to Java
There should be no behavior change. Before this CL, ChromeBackupAgentImpl read/set/observed PrefService data in C++ [1][2]. This CL moves most of the logic to Java, for 2 reasons: a) Less indirection: PrefService has good Java bindings, which can be used directly, making the code simpler. b) The JNI abstractions weren't great: getAccountSettingsBackupName() was very sync-specific, whereas getBoolBackupNames() was very generic (...but then would have to be used in sync-specific ways in crrev.com/c/5412214). Unfortunately, some of it needs to stay in C++, due to lack of Java bindings. The CL keeps thin JNI wrappers around PrefService for the following: * Reading/writing dictionary prefs. According to [3] there's a chance this will be implemented in the future. At that point the dictionary serialization/deserialization could be done by in Java too (% maybe migrating data serialized in the "old way"). * Flushing pref writes, i.e. CommitPendingWrite(). This would be easy to expose, but it's also a very niche use case, so maybe not worth it. [1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/android/java/src/org/chromium/chrome/browser/ChromeBackupAgentImpl.java;l=732-746;drc=4a4b6563f247290b03973958bda6ba99f421a00d [2] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/android/chrome_backup_watcher.cc;l=15;drc=c6025b06e27049e0b62257398027c5a1e28822cb [3] https://groups.google.com/a/google.com/g/chrome-sync-dev/c/sd4tItY9J5k Bug: None Change-Id: If87f8e3f154e1945e3bdd2540c622154f61d80e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5419139 Reviewed-by:Menghan Yang <myuu@google.com> Auto-Submit: Victor Vianna <victorvianna@google.com> Commit-Queue: Victor Vianna <victorvianna@google.com> Reviewed-by:
Boris Sazonov <bsazonov@chromium.org> Commit-Queue: Boris Sazonov <bsazonov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1283142}
Loading
Please register or sign in to comment