Bug 1573268 - Convert two layers.offmainthreadcomposition.* prefs to static prefs. r=njn

Converts layers.offmainthreadcomposition.async-animations and layers.offmainthreadcomposition.log-animations to their respective static prefs. Since all IsAnimationLoggingEnabled() did was create a pref and return the variable sShouldLog, this function is removed and replaced with the static pref.

Differential Revision: https://phabricator.services.mozilla.com/D41651

--HG--
extra : moz-landing-system : lando
This commit is contained in:
kriswright 2019-08-13 00:02:12 +00:00
Родитель 60b07d7f71
Коммит 8c68307d03
6 изменённых файлов: 17 добавлений и 37 удалений

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

@ -25,6 +25,7 @@
#include "mozilla/RestyleManager.h"
#include "mozilla/ServoBindings.h" // Servo_GetProperties_Overriding_Animation
#include "mozilla/ServoStyleSet.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/TypeTraits.h" // For std::forward<>
#include "nsContentUtils.h"
@ -73,7 +74,7 @@ bool EffectCompositor::AllowCompositorAnimationsOnFrame(
}
if (!nsLayoutUtils::AreAsyncAnimationsEnabled()) {
if (nsLayoutUtils::IsAnimationLoggingEnabled()) {
if (StaticPrefs::layers_offmainthreadcomposition_log_animations()) {
nsCString message;
message.AppendLiteral(
"Performance warning: Async animations are "

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

@ -25,6 +25,7 @@
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/TypeTraits.h"
#include "Layers.h" // For Layer
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetComputedStyle
@ -49,7 +50,7 @@ void AnimationProperty::SetPerformanceWarning(
mPerformanceWarning = Some(aWarning);
nsAutoString localizedString;
if (nsLayoutUtils::IsAnimationLoggingEnabled() &&
if (StaticPrefs::layers_offmainthreadcomposition_log_animations() &&
mPerformanceWarning->ToLocalizedString(localizedString)) {
nsAutoCString logMessage = NS_ConvertUTF16toUTF8(localizedString);
AnimationUtils::LogAsyncAnimationFailure(logMessage, aElement);

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

@ -517,33 +517,10 @@ Size nsLayoutUtils::ComputeSuitableScaleForAnimation(
}
bool nsLayoutUtils::AreAsyncAnimationsEnabled() {
static bool sAreAsyncAnimationsEnabled;
static bool sAsyncPrefCached = false;
if (!sAsyncPrefCached) {
sAsyncPrefCached = true;
Preferences::AddBoolVarCache(
&sAreAsyncAnimationsEnabled,
"layers.offmainthreadcomposition.async-animations");
}
return sAreAsyncAnimationsEnabled &&
return StaticPrefs::layers_offmainthreadcomposition_async_animations() &&
gfxPlatform::OffMainThreadCompositingEnabled();
}
bool nsLayoutUtils::IsAnimationLoggingEnabled() {
static bool sShouldLog;
static bool sShouldLogPrefCached;
if (!sShouldLogPrefCached) {
sShouldLogPrefCached = true;
Preferences::AddBoolVarCache(
&sShouldLog, "layers.offmainthreadcomposition.log-animations");
}
return sShouldLog;
}
bool nsLayoutUtils::AreRetainedDisplayListsEnabled() {
#ifdef MOZ_WIDGET_ANDROID
return StaticPrefs::layout_display_list_retain();

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

@ -2370,11 +2370,6 @@ class nsLayoutUtils {
*/
static bool AreAsyncAnimationsEnabled();
/**
* Checks if we should warn about animations that can't be async
*/
static bool IsAnimationLoggingEnabled();
/**
* Checks if retained display lists are enabled.
*/

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

@ -3780,6 +3780,18 @@
#endif
mirror: once
# Whether to animate simple opacity and transforms on the compositor.
- name: layers.offmainthreadcomposition.async-animations
type: bool
value: true
mirror: always
# Whether to log information about off main thread animations to stderr.
- name: layers.offmainthreadcomposition.log-animations
type: bool
value: false
mirror: always
- name: layers.offmainthreadcomposition.force-disabled
type: bool
value: false

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

@ -4785,12 +4785,6 @@ pref("layers.tiles.edge-padding", true);
pref("layers.tiles.edge-padding", false);
#endif
// Whether to animate simple opacity and transforms on the compositor
pref("layers.offmainthreadcomposition.async-animations", true);
// Whether to log information about off main thread animations to stderr
pref("layers.offmainthreadcomposition.log-animations", false);
pref("layers.draw-mask-debug", false);
pref("gfx.content.always-paint", false);