[signin] Re-add missing call to ProfileMetrics::LogNumberOfProfiles

The logic to execute a task on a timer, persisted across Chrome
restarts, already existed in account_fetcher_service.
This CL extracts it in a new class, and reuses it in ProfileInfoCache.

The metric is not loaded exactly at the same time it was before:
it used to be logged for each profile, but now it's logged per Chrome
run. This makes more sense given the nature of the metric.

Fixed: 1060096
Change-Id: I5b8c709f088709934b8ad54fa9a46fac091923cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096743
Commit-Queue: David Roger <[email protected]>
Reviewed-by: Monica Basta <[email protected]>
Cr-Commit-Position: refs/heads/master@{#749621}
diff --git a/chrome/browser/profiles/profile_attributes_storage.h b/chrome/browser/profiles/profile_attributes_storage.h
index 8c6f70e..ddbe82a 100644
--- a/chrome/browser/profiles/profile_attributes_storage.h
+++ b/chrome/browser/profiles/profile_attributes_storage.h
@@ -127,6 +127,10 @@
   // ProfileAttributesEntry.
   void NotifyOnProfileAvatarChanged(const base::FilePath& profile_path) const;
 
+  // Disables the periodic reporting of profile metrics, as this is causing
+  // tests to time out.
+  virtual void DisableProfileMetricsForTesting() {}
+
  protected:
   FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, EntriesInAttributesStorage);
   FRIEND_TEST_ALL_PREFIXES(ProfileAttributesStorageTest,