Document that pref migration in browser_prefs.cc does not handle iOS.

See bug for more details. This should hopefully reduce the likelihood of
more bugs caused due to forgetting to migrate obsolete prefs on iOS.

Bug: 1295881
Change-Id: Ib195f3763bd48ea671a5ba7a69417f45a75749d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3447833
Reviewed-by: Dominic Battré <[email protected]>
Commit-Queue: Scott Little <[email protected]>
Auto-Submit: Scott Little <[email protected]>
Cr-Commit-Position: refs/heads/main@{#971337}
diff --git a/chrome/browser/prefs/README.md b/chrome/browser/prefs/README.md
index 33bfd4e..43034e3 100644
--- a/chrome/browser/prefs/README.md
+++ b/chrome/browser/prefs/README.md
@@ -87,6 +87,13 @@
 therefore assume the migration has taken place if it's accessing the
 `PrefService` via an initialized `BrowserProcess` or `Profile`.
 
+Note that this code in browser_prefs.cc does *not* run on iOS, so if you're
+migrating a pref that also is used on iOS, then the pref may also need to be
+migrated or cleared specifically for iOS as well. This could be by doing the
+migration in feature code that's called by all platforms instead of here, or by
+calling migration code in the appropriate place for iOS specifically, e.g.
+[ios/chrome/browser/prefs/browser_prefs.mm](https://source.chromium.org/chromium/chromium/src/+/main:ios/chrome/browser/prefs/browser_prefs.mm).
+
 As per [deleting an old pref](#deleting-an-old-pref), if the old pref is also a
 policy, you will need to mark it deprecated for a few milestones first as
 described in
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index d1d6494..41136277 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1521,6 +1521,13 @@
 // This method should be periodically pruned of year+ old migrations.
 // See chrome/browser/prefs/README.md for details.
 void MigrateObsoleteLocalStatePrefs(PrefService* local_state) {
+  // IMPORTANT NOTE: This code is *not* run on iOS Chrome. If a pref is migrated
+  // or cleared here, and that pref is also used in iOS Chrome, it may also need
+  // to be migrated or cleared specifically for iOS as well. This could be by
+  // doing the migration in feature code that's called by all platforms instead
+  // of here, or by calling migration code in the appropriate place for iOS
+  // specifically, e.g. ios/chrome/browser/prefs/browser_prefs.mm.
+
   // BEGIN_MIGRATE_OBSOLETE_LOCAL_STATE_PREFS
   // Please don't delete the preceding line. It is used by PRESUBMIT.py.
 
@@ -1563,11 +1570,25 @@
 
   // Please don't delete the following line. It is used by PRESUBMIT.py.
   // END_MIGRATE_OBSOLETE_LOCAL_STATE_PREFS
+
+  // IMPORTANT NOTE: This code is *not* run on iOS Chrome. If a pref is migrated
+  // or cleared here, and that pref is also used in iOS Chrome, it may also need
+  // to be migrated or cleared specifically for iOS as well. This could be by
+  // doing the migration in feature code that's called by all platforms instead
+  // of here, or by calling migration code in the appropriate place for iOS
+  // specifically, e.g. ios/chrome/browser/prefs/browser_prefs.mm.
 }
 
 // This method should be periodically pruned of year+ old migrations.
 // See chrome/browser/prefs/README.md for details.
 void MigrateObsoleteProfilePrefs(Profile* profile) {
+  // IMPORTANT NOTE: This code is *not* run on iOS Chrome. If a pref is migrated
+  // or cleared here, and that pref is also used in iOS Chrome, it may also need
+  // to be migrated or cleared specifically for iOS as well. This could be by
+  // doing the migration in feature code that's called by all platforms instead
+  // of here, or by calling migration code in the appropriate place for iOS
+  // specifically, e.g. ios/chrome/browser/prefs/browser_prefs.mm.
+
   // BEGIN_MIGRATE_OBSOLETE_PROFILE_PREFS
   // Please don't delete the preceding line. It is used by PRESUBMIT.py.
 
@@ -1832,4 +1853,11 @@
 
   // Please don't delete the following line. It is used by PRESUBMIT.py.
   // END_MIGRATE_OBSOLETE_PROFILE_PREFS
+
+  // IMPORTANT NOTE: This code is *not* run on iOS Chrome. If a pref is migrated
+  // or cleared here, and that pref is also used in iOS Chrome, it may also need
+  // to be migrated or cleared specifically for iOS as well. This could be by
+  // doing the migration in feature code that's called by all platforms instead
+  // of here, or by calling migration code in the appropriate place for iOS
+  // specifically, e.g. ios/chrome/browser/prefs/browser_prefs.mm.
 }