Preference not found in pref service

131 views
Skip to first unread message

Phoebe Gong

unread,
Jun 26, 2025, 7:32:12 AM6/26/25
to Chromium-dev, Suki. Yang
Hi there,

In components/prefs/pref_notifier_impl.cc, we check if a given preference's `path` exists in `pref_service_` (code) before triggering any observer changes.

We registered preference A as a LocalStatePref, and then initialized a PrefChangeRegistrar P1 where PrefService* points to `Shell::Get()->local_state()`. We then added preference A to the PrefChangeRegistrar P1.

Meanwhile, we initialized a separate PrefChangeRegistrar P2 where PrefService* points to user pref. Specifically, we used the `pref_service` value from the parameter in function `void WallpaperControllerImpl::OnActiveUserPrefServiceChanged(PrefService* pref_service)` (code). We did *not* add preference A to PrefChangeRegistrar P2.

We then noticed that PrefNotifierImpl::FireObservers was triggered on preference A with `pref_service_` pointing to user pref. Then it returns early because `pref_service_->FindPreference(path)` is `false`.

Question: Why is the pref notifier associated with user pref triggered on the preference change of A?

In addition, we notice that the pref notifier associated with local state triggered on a number of preferences native to Chromium (i.e. we did not add or modify them) and also returns early because the preference is not found in the corresponding `pref_service_`. However, we are under the impression that all prefs can be found in `local_state`.

Question: Why are those prefs native to Chromium not found in the `local_state`?

We would really appreciate any pointers or help regarding our questions above.

Thanks in advance!

Phoebe

Phoebe Gong

unread,
Jul 6, 2025, 11:31:25 PM7/6/25
to pho...@vibe.us, Chromium-dev
Bump - again, would really appreciate any pointers or help!

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/abba87f8-ccb7-4b56-9667-f0e74cf158d4n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages