Add ModelTypeStore::ReadAllDataAndMetadata()

Several ModelTypeStore usages call ReadAllData() immediately followed
by ReadAllMetadata() during their initialisation. This CL introduces a
new ReadAllDataAndMetadata() function, which does both and simplifies
these usages as a result.

Besides the usages rewritten in this CL, others exist which contain some
logic in the ReadAllData() callback. These could potentially be migrated
as well, but are untouched by this CL. Examples include
ProfileAuthServersSyncBridge, PrintersSyncBridge,
WifiConfigurationBridge, CollaborationGroupSyncBridge,
ReadingListModelStorageImpl.

The implementation works by calling ReadAllData() and ReadAllMetadata()
in sequence. Posting the tasks "in parallel" wouldn't make a difference,
since both reads are processed on the same background sequence anyways.

Bug: None
Change-Id: Ie3efb9938eefdbecf7ca7c646ff2080e30000f6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5591674
Reviewed-by: Colin Blundell <[email protected]>
Commit-Queue: Florian Leimgruber <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: Rushan Suleymanov <[email protected]>
Code-Coverage: [email protected] <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1311123}
diff --git a/chrome/browser/web_applications/web_app_database.h b/chrome/browser/web_applications/web_app_database.h
index e097e8b..3df4435 100644
--- a/chrome/browser/web_applications/web_app_database.h
+++ b/chrome/browser/web_applications/web_app_database.h
@@ -70,14 +70,10 @@
                         const std::optional<syncer::ModelError>& error,
                         std::unique_ptr<syncer::ModelTypeStore> store);
 
-  void OnAllDataRead(
+  void OnAllDataAndMetadataRead(
       RegistryOpenedCallback callback,
       const std::optional<syncer::ModelError>& error,
-      std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records);
-  void OnAllMetadataRead(
       std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records,
-      RegistryOpenedCallback callback,
-      const std::optional<syncer::ModelError>& error,
       std::unique_ptr<syncer::MetadataBatch> metadata_batch);
 
   void OnDataWritten(CompletionCallback callback,