Bug 1703118 - Remove unneeded caching / parent-process checks in android lookandfeel. r=agi,geckoview-reviewers

After bug 1697607 and the subsequent pref removal this code only runs in
the parent process.

After bug 1699088 the caller takes care of caching. So there should be
no need to cache stuff ourselves.

Differential Revision: https://phabricator.services.mozilla.com/D110871
This commit is contained in:
Emilio Cobos Álvarez 2021-04-06 10:29:43 +00:00
Родитель 7a2c22ce65
Коммит 606ab54d5c
2 изменённых файлов: 3 добавлений и 27 удалений

Просмотреть файл

@ -77,8 +77,6 @@ void nsLookAndFeel::RefreshImpl() {
mInitializedSystemColors = false;
mInitializedShowPassword = false;
mPrefersReducedMotionCached = false;
mSystemUsesDarkThemeCached = false;
}
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
@ -380,12 +378,7 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
break;
case IntID::PrefersReducedMotion:
if (!mPrefersReducedMotionCached && XRE_IsParentProcess()) {
mPrefersReducedMotion =
java::GeckoSystemStateListener::PrefersReducedMotion();
mPrefersReducedMotionCached = true;
}
aResult = mPrefersReducedMotion;
aResult = java::GeckoSystemStateListener::PrefersReducedMotion();
break;
case IntID::PrimaryPointerCapabilities:
@ -396,19 +389,8 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
break;
case IntID::SystemUsesDarkTheme: {
if (!mSystemUsesDarkThemeCached && XRE_IsParentProcess()) {
// Bail out if AndroidBridge hasn't initialized.
if (!jni::IsAvailable()) {
return NS_ERROR_FAILURE;
}
java::GeckoRuntime::LocalRef runtime =
java::GeckoRuntime::GetInstance();
mSystemUsesDarkTheme = runtime && runtime->UsesDarkTheme();
mSystemUsesDarkThemeCached = true;
}
aResult = mSystemUsesDarkTheme;
java::GeckoRuntime::LocalRef runtime = java::GeckoRuntime::GetInstance();
aResult = runtime && runtime->UsesDarkTheme();
break;
}

Просмотреть файл

@ -30,12 +30,6 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
bool mInitializedShowPassword = false;
bool mShowPassword = false;
bool mSystemUsesDarkTheme = false;
bool mSystemUsesDarkThemeCached = false;
bool mPrefersReducedMotion = false;
bool mPrefersReducedMotionCached = false;
nsresult GetSystemColors();
void EnsureInitSystemColors();