Bug 1561491 - Make image.* static prefs follow the naming convention. r=KrisWright
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 26 Jun 2019 13:24:21 +1000
changeset 543148 27b98abfc3df64eacc3cdfeb5d0a433572ecba85
parent 543147 0adbbba384efaaa3d747b5a9a986cb318594516a
child 543149 9ee669c657c79b26a6ec0df246cc5bfe2b1d9a9a
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersKrisWright
bugs1561491
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1561491 - Make image.* static prefs follow the naming convention. r=KrisWright Differential Revision: https://phabricator.services.mozilla.com/D35977
dom/base/nsImageLoadingContent.cpp
gfx/layers/ipc/SharedSurfacesChild.cpp
image/AnimationSurfaceProvider.cpp
image/DecodePool.cpp
image/DecodedSurfaceProvider.cpp
image/DecoderFactory.cpp
image/FrameAnimator.cpp
image/FrameAnimator.h
image/ImageFactory.cpp
image/ImageMemoryReporter.cpp
image/RasterImage.cpp
image/SurfaceCache.cpp
image/imgFrame.cpp
image/imgLoader.cpp
image/imgRequest.cpp
image/test/gtest/TestSurfaceCache.cpp
modules/libpref/init/StaticPrefList.h
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -523,17 +523,17 @@ void nsImageLoadingContent::MaybeForceSy
   }
 
   bool forceSync = mSyncDecodingHint;
   if (!forceSync && aPrepareNextRequest) {
     // Detect JavaScript-based animations created by changing the |src|
     // attribute on a timer.
     TimeStamp now = TimeStamp::Now();
     TimeDuration threshold = TimeDuration::FromMilliseconds(
-        StaticPrefs::ImageInferSrcAnimationThresholdMS());
+        StaticPrefs::image_infer_src_animation_threshold_ms());
 
     // If the length of time between request changes is less than the threshold,
     // then force sync decoding to eliminate flicker from the animation.
     forceSync = (now - mMostRecentRequestChange < threshold);
     mMostRecentRequestChange = now;
   }
 
   if (imageFrame) {
--- a/gfx/layers/ipc/SharedSurfacesChild.cpp
+++ b/gfx/layers/ipc/SharedSurfacesChild.cpp
@@ -507,33 +507,33 @@ void SharedSurfacesAnimation::Destroy() 
   }
 
   if (mKeys.IsEmpty()) {
     return;
   }
 
   for (const auto& entry : mKeys) {
     MOZ_ASSERT(!entry.mManager->IsDestroyed());
-    if (StaticPrefs::ImageAnimatedDecodeOnDemandRecycle()) {
+    if (StaticPrefs::image_animated_decode_on_demand_recycle()) {
       entry.mManager->DeregisterAsyncAnimation(entry.mImageKey);
     }
     entry.mManager->AddImageKeyForDiscard(entry.mImageKey);
   }
 
   mKeys.Clear();
 }
 
 void SharedSurfacesAnimation::HoldSurfaceForRecycling(
     AnimationImageKeyData& aEntry, SourceSurface* aParentSurface,
     SourceSurfaceSharedData* aSurface) {
   if (aParentSurface == static_cast<SourceSurface*>(aSurface)) {
     return;
   }
 
-  MOZ_ASSERT(StaticPrefs::ImageAnimatedDecodeOnDemandRecycle());
+  MOZ_ASSERT(StaticPrefs::image_animated_decode_on_demand_recycle());
   aEntry.mPendingRelease.AppendElement(aParentSurface);
 }
 
 nsresult SharedSurfacesAnimation::SetCurrentFrame(
     SourceSurface* aParentSurface, SourceSurfaceSharedData* aSurface,
     const gfx::IntRect& aDirtyRect) {
   MOZ_ASSERT(aSurface);
 
@@ -612,17 +612,17 @@ nsresult SharedSurfacesAnimation::Update
       aKey = entry.mImageKey;
       found = true;
       break;
     }
   }
 
   if (!found) {
     aKey = aManager->WrBridge()->GetNextImageKey();
-    if (StaticPrefs::ImageAnimatedDecodeOnDemandRecycle()) {
+    if (StaticPrefs::image_animated_decode_on_demand_recycle()) {
       aManager->RegisterAsyncAnimation(aKey, this);
     }
 
     AnimationImageKeyData data(aManager, aKey);
     HoldSurfaceForRecycling(data, aParentSurface, aSurface);
     mKeys.AppendElement(std::move(data));
     aResources.AddExternalImage(mId, aKey);
   }
--- a/image/AnimationSurfaceProvider.cpp
+++ b/image/AnimationSurfaceProvider.cpp
@@ -30,19 +30,20 @@ AnimationSurfaceProvider::AnimationSurfa
              "Use MetadataDecodingTask for metadata decodes");
   MOZ_ASSERT(!mDecoder->IsFirstFrameDecode(),
              "Use DecodedSurfaceProvider for single-frame image decodes");
 
   // Calculate how many frames we need to decode in this animation before we
   // enter decode-on-demand mode.
   IntSize frameSize = aSurfaceKey.Size();
   size_t threshold =
-      (size_t(StaticPrefs::ImageAnimatedDecodeOnDemandThresholdKB()) * 1024) /
+      (size_t(StaticPrefs::image_animated_decode_on_demand_threshold_kb()) *
+       1024) /
       (sizeof(uint32_t) * frameSize.width * frameSize.height);
-  size_t batch = StaticPrefs::ImageAnimatedDecodeOnDemandBatchSize();
+  size_t batch = StaticPrefs::image_animated_decode_on_demand_batch_size();
 
   mFrames.reset(
       new AnimationFrameRetainedBuffer(threshold, batch, aCurrentFrame));
 }
 
 AnimationSurfaceProvider::~AnimationSurfaceProvider() {
   DropImageReference();
 
@@ -402,17 +403,17 @@ void AnimationSurfaceProvider::RequestFr
     MOZ_ASSERT_UNREACHABLE("Already replaced frame queue!");
     return;
   }
 
   auto oldFrameQueue =
       static_cast<AnimationFrameRetainedBuffer*>(mFrames.get());
 
   MOZ_ASSERT(!mDecoder->GetFrameRecycler());
-  if (StaticPrefs::ImageAnimatedDecodeOnDemandRecycle()) {
+  if (StaticPrefs::image_animated_decode_on_demand_recycle()) {
     mFrames.reset(new AnimationFrameRecyclingQueue(std::move(*oldFrameQueue)));
     mDecoder->SetFrameRecycler(this);
   } else {
     mFrames.reset(new AnimationFrameDiscardingQueue(std::move(*oldFrameQueue)));
   }
 }
 
 void AnimationSurfaceProvider::AnnounceSurfaceAvailable() {
@@ -459,17 +460,18 @@ void AnimationSurfaceProvider::FinishDec
   // discardable, it'd result in a leak!
   DropImageReference();
 }
 
 bool AnimationSurfaceProvider::ShouldPreferSyncRun() const {
   MutexAutoLock lock(mDecodingMutex);
   MOZ_ASSERT(mDecoder);
 
-  return mDecoder->ShouldSyncDecode(StaticPrefs::ImageMemDecodeBytesAtATime());
+  return mDecoder->ShouldSyncDecode(
+      StaticPrefs::image_mem_decode_bytes_at_a_time());
 }
 
 RawAccessFrameRef AnimationSurfaceProvider::RecycleFrame(
     gfx::IntRect& aRecycleRect) {
   MutexAutoLock lock(mFramesMutex);
   MOZ_ASSERT(mFrames->IsRecycling());
   return mFrames->RecycleFrame(aRecycleRect);
 }
--- a/image/DecodePool.cpp
+++ b/image/DecodePool.cpp
@@ -348,17 +348,17 @@ class IOThreadIniter final : public Runn
 
     return NS_OK;
   }
 };
 #endif
 
 DecodePool::DecodePool() : mMutex("image::IOThread") {
   // Determine the number of threads we want.
-  int32_t prefLimit = StaticPrefs::ImageMTDecodingLimit();
+  int32_t prefLimit = StaticPrefs::image_multithreaded_decoding_limit();
   uint32_t limit;
   if (prefLimit <= 0) {
     int32_t numCores = NumberOfCores();
     if (numCores <= 1) {
       limit = 1;
     } else if (numCores == 2) {
       // On an otherwise mostly idle system, having two image decoding threads
       // doubles decoding performance, so it's worth doing on dual-core devices,
@@ -378,17 +378,18 @@ DecodePool::DecodePool() : mMutex("image
   if (limit > 4 && XRE_IsE10sParentProcess()) {
     limit = 4;
   }
 
   // The maximum number of idle threads allowed.
   uint32_t idleLimit;
 
   // The timeout period before shutting down idle threads.
-  int32_t prefIdleTimeout = StaticPrefs::ImageMTDecodingIdleTimeout();
+  int32_t prefIdleTimeout =
+      StaticPrefs::image_multithreaded_decoding_idle_timeout();
   TimeDuration idleTimeout;
   if (prefIdleTimeout <= 0) {
     idleTimeout = TimeDuration::Forever();
     idleLimit = limit;
   } else {
     idleTimeout = TimeDuration::FromMilliseconds(prefIdleTimeout);
     idleLimit = (limit + 1) / 2;
   }
--- a/image/DecodedSurfaceProvider.cpp
+++ b/image/DecodedSurfaceProvider.cpp
@@ -195,13 +195,14 @@ void DecodedSurfaceProvider::FinishDecod
   // finishes. If we don't drop our reference to the image, we'll end up
   // keeping it alive as long as we remain in the surface cache, which could
   // greatly extend the image's lifetime - in fact, if the image isn't
   // discardable, it'd result in a leak!
   DropImageReference();
 }
 
 bool DecodedSurfaceProvider::ShouldPreferSyncRun() const {
-  return mDecoder->ShouldSyncDecode(StaticPrefs::ImageMemDecodeBytesAtATime());
+  return mDecoder->ShouldSyncDecode(
+      StaticPrefs::image_mem_decode_bytes_at_a_time());
 }
 
 }  // namespace image
 }  // namespace mozilla
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -69,17 +69,17 @@ DecoderType DecoderFactory::GetDecoderTy
     type = DecoderType::ICO;
 
     // Icon
   } else if (!strcmp(aMimeType, IMAGE_ICON_MS)) {
     type = DecoderType::ICON;
 
     // WebP
   } else if (!strcmp(aMimeType, IMAGE_WEBP) &&
-             StaticPrefs::ImageWebPEnabled()) {
+             StaticPrefs::image_webp_enabled()) {
     type = DecoderType::WEBP;
   }
 
   return type;
 }
 
 /* static */
 already_AddRefed<Decoder> DecoderFactory::GetDecoder(DecoderType aType,
--- a/image/FrameAnimator.cpp
+++ b/image/FrameAnimator.cpp
@@ -81,17 +81,17 @@ const gfx::IntRect AnimationState::Updat
       if (mCompositedFrameInvalid) {
         // Invalidate if we are marking the composited frame valid.
         ret.SizeTo(aSize);
       }
       mCompositedFrameInvalid = false;
     } else if (aResult.Type() == MatchType::NOT_FOUND ||
                aResult.Type() == MatchType::PENDING) {
       if (mHasRequestedDecode) {
-        MOZ_ASSERT(StaticPrefs::ImageMemAnimatedDiscardable());
+        MOZ_ASSERT(StaticPrefs::image_mem_animated_discardable());
         mCompositedFrameInvalid = true;
       }
     }
     // Otherwise don't change the value of mCompositedFrameInvalid, it will be
     // updated by RequestRefresh.
   }
 
   return ret;
@@ -133,17 +133,17 @@ void AnimationState::InitAnimationFrameT
   }
 }
 
 void AnimationState::SetAnimationFrameTime(const TimeStamp& aTime) {
   mCurrentAnimationFrameTime = aTime;
 }
 
 bool AnimationState::MaybeAdvanceAnimationFrameTime(const TimeStamp& aTime) {
-  if (!StaticPrefs::ImageAnimatedResumeFromLastDisplayed() ||
+  if (!StaticPrefs::image_animated_resume_from_last_displayed() ||
       mCurrentAnimationFrameTime >= aTime) {
     return false;
   }
 
   // We are configured to stop an animation when it is out of view, and restart
   // it from the same point when it comes back into view. The same applies if it
   // was discarded while out of view.
   mCurrentAnimationFrameTime = aTime;
@@ -374,17 +374,17 @@ RefreshResult FrameAnimator::RequestRefr
   }
 
   RefPtr<imgFrame> currentFrame =
       result.Surface().GetFrame(aState.mCurrentAnimationFrameIndex);
 
   // only advance the frame if the current time is greater than or
   // equal to the current frame's end time.
   if (!currentFrame) {
-    MOZ_ASSERT(StaticPrefs::ImageMemAnimatedDiscardable());
+    MOZ_ASSERT(StaticPrefs::image_mem_animated_discardable());
     MOZ_ASSERT(aState.GetHasRequestedDecode() &&
                !aState.GetIsCurrentlyDecoded());
     MOZ_ASSERT(aState.mCompositedFrameInvalid);
     // Nothing we can do but wait for our previous current frame to be decoded
     // again so we can determine what to do next.
     aState.MaybeAdvanceAnimationFrameTime(aTime);
     return ret;
   }
@@ -446,17 +446,17 @@ LookupResult FrameAnimator::GetComposite
   aState.mCompositedFrameRequested = true;
 
   LookupResult result = SurfaceCache::Lookup(
       ImageKey(mImage),
       RasterSurfaceKey(mSize, DefaultSurfaceFlags(), PlaybackType::eAnimated),
       aMarkUsed);
 
   if (aState.mCompositedFrameInvalid) {
-    MOZ_ASSERT(StaticPrefs::ImageMemAnimatedDiscardable());
+    MOZ_ASSERT(StaticPrefs::image_mem_animated_discardable());
     MOZ_ASSERT(aState.GetHasRequestedDecode());
     MOZ_ASSERT(!aState.GetIsCurrentlyDecoded());
     if (result.Type() == MatchType::NOT_FOUND) {
       return result;
     }
     return LookupResult(MatchType::PENDING);
   }
 
--- a/image/FrameAnimator.h
+++ b/image/FrameAnimator.h
@@ -75,17 +75,17 @@ class AnimationState {
    * been created to redecode it.
    */
   bool IsDiscarded() { return mDiscarded; }
 
   /**
    * Sets the composited frame as valid or invalid.
    */
   void SetCompositedFrameInvalid(bool aInvalid) {
-    MOZ_ASSERT(!aInvalid || StaticPrefs::ImageMemAnimatedDiscardable());
+    MOZ_ASSERT(!aInvalid || StaticPrefs::image_mem_animated_discardable());
     mCompositedFrameInvalid = aInvalid;
   }
 
   /**
    * Returns whether the composited frame is valid to draw to the screen.
    */
   bool GetCompositedFrameInvalid() { return mCompositedFrameInvalid; }
 
--- a/image/ImageFactory.cpp
+++ b/image/ImageFactory.cpp
@@ -32,18 +32,18 @@ namespace image {
 /*static*/
 void ImageFactory::Initialize() {}
 
 static uint32_t ComputeImageFlags(nsIURI* uri, const nsCString& aMimeType,
                                   bool isMultiPart) {
   nsresult rv;
 
   // We default to the static globals.
-  bool isDiscardable = StaticPrefs::ImageMemDiscardable();
-  bool doDecodeImmediately = StaticPrefs::ImageDecodeImmediatelyEnabled();
+  bool isDiscardable = StaticPrefs::image_mem_discardable();
+  bool doDecodeImmediately = StaticPrefs::image_decode_immediately_enabled();
 
   // We want UI to be as snappy as possible and not to flicker. Disable
   // discarding for chrome URLS.
   bool isChrome = false;
   rv = uri->SchemeIs("chrome", &isChrome);
   if (NS_SUCCEEDED(rv) && isChrome) {
     isDiscardable = false;
   }
--- a/image/ImageMemoryReporter.cpp
+++ b/image/ImageMemoryReporter.cpp
@@ -92,17 +92,17 @@ void ImageMemoryReporter::ReportSharedSu
   }
 
   if (aIsForCompositor) {
     path.AppendLiteral("pid=");
     path.AppendInt(uint32_t(aEntry.mCreatorPid));
     path.AppendLiteral("/");
   }
 
-  if (StaticPrefs::ImageMemDebugReporting()) {
+  if (StaticPrefs::image_mem_debug_reporting()) {
     path.AppendInt(aExternalId, 16);
     path.AppendLiteral("/");
   }
 
   path.AppendLiteral("image(");
   path.AppendInt(aEntry.mSize.width);
   path.AppendLiteral("x");
   path.AppendInt(aEntry.mSize.height);
@@ -132,17 +132,17 @@ void ImageMemoryReporter::ReportSharedSu
 /* static */
 void ImageMemoryReporter::AppendSharedSurfacePrefix(
     nsACString& aPathPrefix, const SurfaceMemoryCounter& aCounter,
     layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
   uint64_t extId = aCounter.Values().ExternalId();
   if (extId) {
     auto gpuEntry = aSharedSurfaces.mSurfaces.find(extId);
 
-    if (StaticPrefs::ImageMemDebugReporting()) {
+    if (StaticPrefs::image_mem_debug_reporting()) {
       aPathPrefix.AppendLiteral(", external_id:");
       aPathPrefix.AppendInt(extId, 16);
       if (gpuEntry != aSharedSurfaces.mSurfaces.end()) {
         aPathPrefix.AppendLiteral(", compositor_ref:");
         aPathPrefix.AppendInt(gpuEntry->second.mConsumers);
       } else {
         aPathPrefix.AppendLiteral(", compositor_ref:missing");
       }
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -342,17 +342,17 @@ LookupResult RasterImage::LookupFrame(co
   if (result.Type() == MatchType::NOT_FOUND ||
       (result.Type() == MatchType::SUBSTITUTE_BECAUSE_NOT_FOUND &&
        !avoidRedecode) ||
       (syncDecode && !avoidRedecode && !result)) {
     // We don't have a copy of this frame, and there's no decoder working on
     // one. (Or we're sync decoding and the existing decoder hasn't even started
     // yet.) Trigger decoding so it'll be available next time.
     MOZ_ASSERT(aPlaybackType != PlaybackType::eAnimated ||
-                   StaticPrefs::ImageMemAnimatedDiscardable() ||
+                   StaticPrefs::image_mem_animated_discardable() ||
                    !mAnimationState || mAnimationState->KnownFrameCount() < 1,
                "Animated frames should be locked");
 
     // The surface cache may suggest the preferred size we are supposed to
     // decode at. This should only happen if we accept substitutions.
     if (!result.SuggestedSize().IsEmpty()) {
       MOZ_ASSERT(!syncDecode && (aFlags & FLAG_HIGH_QUALITY_SCALING));
       requestedSize = result.SuggestedSize();
@@ -410,17 +410,17 @@ bool RasterImage::IsOpaque() {
 
 NS_IMETHODIMP_(bool)
 RasterImage::WillDrawOpaqueNow() {
   if (!IsOpaque()) {
     return false;
   }
 
   if (mAnimationState) {
-    if (!StaticPrefs::ImageMemAnimatedDiscardable()) {
+    if (!StaticPrefs::image_mem_animated_discardable()) {
       // We never discard frames of animated images.
       return true;
     } else {
       if (mAnimationState->GetCompositedFrameInvalid()) {
         // We're not going to draw anything at all.
         return false;
       }
     }
@@ -466,17 +466,17 @@ void RasterImage::OnSurfaceDiscarded(con
       });
   eventTarget->Dispatch(ev.forget(), NS_DISPATCH_NORMAL);
 }
 
 void RasterImage::OnSurfaceDiscardedInternal(bool aAnimatedFramesDiscarded) {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (aAnimatedFramesDiscarded && mAnimationState) {
-    MOZ_ASSERT(StaticPrefs::ImageMemAnimatedDiscardable());
+    MOZ_ASSERT(StaticPrefs::image_mem_animated_discardable());
     ReleaseImageContainer();
     gfx::IntRect rect =
         mAnimationState->UpdateState(mAnimationFinished, this, mSize);
     NotifyProgress(NoProgress, rect);
   }
 
   if (mProgressTracker) {
     mProgressTracker->OnDiscard();
@@ -711,17 +711,17 @@ bool RasterImage::SetMetadata(const Imag
     mHasSize = true;
   }
 
   if (mHasSize && aMetadata.HasAnimation() && !mAnimationState) {
     // We're becoming animated, so initialize animation stuff.
     mAnimationState.emplace(mAnimationMode);
     mFrameAnimator = MakeUnique<FrameAnimator>(this, mSize);
 
-    if (!StaticPrefs::ImageMemAnimatedDiscardable()) {
+    if (!StaticPrefs::image_mem_animated_discardable()) {
       // We don't support discarding animated images (See bug 414259).
       // Lock the image and throw away the key.
       LockImage();
     }
 
     if (!aFromMetadataDecode) {
       // The metadata decode reported that this image isn't animated, but we
       // discovered that it actually was during the full decode. This is a
@@ -1015,17 +1015,17 @@ RasterImage::GetKeys(nsTArray<nsCString>
     return NS_OK;
   }
   return mProperties->GetKeys(keys);
 }
 
 void RasterImage::Discard() {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(CanDiscard(), "Asked to discard but can't");
-  MOZ_ASSERT(!mAnimationState || StaticPrefs::ImageMemAnimatedDiscardable(),
+  MOZ_ASSERT(!mAnimationState || StaticPrefs::image_mem_animated_discardable(),
              "Asked to discard for animated image");
 
   // Delete all the decoded frames.
   SurfaceCache::RemoveImage(ImageKey(this));
 
   if (mAnimationState) {
     ReleaseImageContainer();
     gfx::IntRect rect =
@@ -1037,17 +1037,17 @@ void RasterImage::Discard() {
   if (mProgressTracker) {
     mProgressTracker->OnDiscard();
   }
 }
 
 bool RasterImage::CanDiscard() {
   return mAllSourceData &&
          // Can discard animated images if the pref is set
-         (!mAnimationState || StaticPrefs::ImageMemAnimatedDiscardable());
+         (!mAnimationState || StaticPrefs::image_mem_animated_discardable());
 }
 
 NS_IMETHODIMP
 RasterImage::StartDecoding(uint32_t aFlags, uint32_t aWhichFrame) {
   if (mError) {
     return NS_ERROR_FAILURE;
   }
 
@@ -1315,17 +1315,17 @@ static bool HaveSkia() {
 }
 
 bool RasterImage::CanDownscaleDuringDecode(const IntSize& aSize,
                                            uint32_t aFlags) {
   // Check basic requirements: downscale-during-decode is enabled, Skia is
   // available, this image isn't transient, we have all the source data and know
   // our size, and the flags allow us to do it.
   if (!mHasSize || mTransient || !HaveSkia() ||
-      !StaticPrefs::ImageDownscaleDuringDecodeEnabled() ||
+      !StaticPrefs::image_downscale_during_decode_enabled() ||
       !(aFlags & imgIContainer::FLAG_HIGH_QUALITY_SCALING)) {
     return false;
   }
 
   // We don't downscale animated images during decode.
   if (mAnimationState) {
     return false;
   }
--- a/image/SurfaceCache.cpp
+++ b/image/SurfaceCache.cpp
@@ -405,17 +405,17 @@ class ImageSurfaceCache {
   }
 
   void MaybeSetFactor2Mode() {
     MOZ_ASSERT(!mFactor2Mode);
 
     // Typically an image cache will not have too many size-varying surfaces, so
     // if we exceed the given threshold, we should consider using a subset.
     int32_t thresholdSurfaces =
-        StaticPrefs::ImageCacheFactor2ThresholdSurfaces();
+        StaticPrefs::image_cache_factor2_threshold_surfaces();
     if (thresholdSurfaces < 0 ||
         mSurfaces.Count() <= static_cast<uint32_t>(thresholdSurfaces)) {
       return;
     }
 
     // Determine how many native surfaces this image has. If it is zero, and it
     // is a vector image, then we should impute a single native size. Otherwise,
     // it may be zero because we don't know yet, or the image has an error, or
@@ -1051,17 +1051,17 @@ class SurfaceCacheImpl final : public ns
     if (!cache || !cache->IsLocked()) {
       return;  // Already unlocked.
     }
 
     // (Note that we *don't* unlock the per-image cache here; that's the
     // difference between this and UnlockImage.)
     DoUnlockSurfaces(
         WrapNotNull(cache),
-        /* aStaticOnly = */ !StaticPrefs::ImageMemAnimatedDiscardable(),
+        /* aStaticOnly = */ !StaticPrefs::image_mem_animated_discardable(),
         aAutoLock);
   }
 
   already_AddRefed<ImageSurfaceCache> RemoveImage(
       const ImageKey aImageKey, const StaticMutexAutoLock& aAutoLock) {
     RefPtr<ImageSurfaceCache> cache = GetImageCache(aImageKey);
     if (!cache) {
       return nullptr;  // No cached surfaces for this image, so nothing to do.
@@ -1373,38 +1373,39 @@ void SurfaceCache::Initialize() {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!sInstance, "Shouldn't initialize more than once");
 
   // See StaticPrefs for the default values of these preferences.
 
   // Length of time before an unused surface is removed from the cache, in
   // milliseconds.
   uint32_t surfaceCacheExpirationTimeMS =
-      StaticPrefs::ImageMemSurfaceCacheMinExpirationMS();
+      StaticPrefs::image_mem_surfacecache_min_expiration_ms();
 
   // What fraction of the memory used by the surface cache we should discard
   // when we get a memory pressure notification. This value is interpreted as
   // 1/N, so 1 means to discard everything, 2 means to discard about half of the
   // memory we're using, and so forth. We clamp it to avoid division by zero.
   uint32_t surfaceCacheDiscardFactor =
-      max(StaticPrefs::ImageMemSurfaceCacheDiscardFactor(), 1u);
+      max(StaticPrefs::image_mem_surfacecache_discard_factor(), 1u);
 
   // Maximum size of the surface cache, in kilobytes.
-  uint64_t surfaceCacheMaxSizeKB = StaticPrefs::ImageMemSurfaceCacheMaxSizeKB();
+  uint64_t surfaceCacheMaxSizeKB =
+      StaticPrefs::image_mem_surfacecache_max_size_kb();
 
   // A knob determining the actual size of the surface cache. Currently the
   // cache is (size of main memory) / (surface cache size factor) KB
   // or (surface cache max size) KB, whichever is smaller. The formula
   // may change in the future, though.
   // For example, a value of 4 would yield a 256MB cache on a 1GB machine.
   // The smallest machines we are likely to run this code on have 256MB
   // of memory, which would yield a 64MB cache on this setting.
   // We clamp this value to avoid division by zero.
   uint32_t surfaceCacheSizeFactor =
-      max(StaticPrefs::ImageMemSurfaceCacheSizeFactor(), 1u);
+      max(StaticPrefs::image_mem_surfacecache_size_factor(), 1u);
 
   // Compute the size of the surface cache.
   uint64_t memorySize = PR_GetPhysicalMemorySize();
   if (memorySize == 0) {
     MOZ_ASSERT_UNREACHABLE("PR_GetPhysicalMemorySize not implemented here");
     memorySize = 256 * 1024 * 1024;  // Fall back to 256MB.
   }
   uint64_t proposedSize = memorySize / surfaceCacheSizeFactor;
@@ -1632,17 +1633,18 @@ bool SurfaceCache::IsLegalSize(const Int
   return true;
 }
 
 IntSize SurfaceCache::ClampVectorSize(const IntSize& aSize) {
   // If we exceed the maximum, we need to scale the size downwards to fit.
   // It shouldn't get here if it is significantly larger because
   // VectorImage::UseSurfaceCacheForSize should prevent us from requesting
   // a rasterized version of a surface greater than 4x the maximum.
-  int32_t maxSizeKB = StaticPrefs::ImageCacheMaxRasterizedSVGThresholdKB();
+  int32_t maxSizeKB =
+      StaticPrefs::image_cache_max_rasterized_svg_threshold_kb();
   if (maxSizeKB <= 0) {
     return aSize;
   }
 
   int32_t proposedKB = int32_t(int64_t(aSize.width) * aSize.height / 256);
   if (maxSizeKB >= proposedKB) {
     return aSize;
   }
--- a/image/imgFrame.cpp
+++ b/image/imgFrame.cpp
@@ -76,35 +76,35 @@ static bool ShouldUseHeap(const IntSize&
   // On some platforms (i.e. Android), a volatile buffer actually keeps a file
   // handle active. We would like to avoid too many since we could easily
   // exhaust the pool. However, other platforms we do not have the file handle
   // problem, and additionally we may avoid a superfluous memset since the
   // volatile memory starts out as zero-filled. Hence the knobs below.
 
   // For as long as an animated image is retained, its frames will never be
   // released to let the OS purge volatile buffers.
-  if (aIsAnimated && StaticPrefs::ImageMemAnimatedUseHeap()) {
+  if (aIsAnimated && StaticPrefs::image_mem_animated_use_heap()) {
     return true;
   }
 
   // Lets us avoid too many small images consuming all of the handles. The
   // actual allocation checks for overflow.
   int32_t bufferSize = (aStride * aSize.width) / 1024;
-  if (bufferSize < StaticPrefs::ImageMemVolatileMinThresholdKB()) {
+  if (bufferSize < StaticPrefs::image_mem_volatile_min_threshold_kb()) {
     return true;
   }
 
   return false;
 }
 
 static already_AddRefed<DataSourceSurface> AllocateBufferForImage(
     const IntSize& size, SurfaceFormat format, bool aIsAnimated = false) {
   int32_t stride = VolatileSurfaceStride(size, format);
 
-  if (gfxVars::GetUseWebRenderOrDefault() && StaticPrefs::ImageMemShared()) {
+  if (gfxVars::GetUseWebRenderOrDefault() && StaticPrefs::image_mem_shared()) {
     RefPtr<SourceSurfaceSharedData> newSurf = new SourceSurfaceSharedData();
     if (newSurf->Init(size, stride, format)) {
       return newSurf.forget();
     }
   } else if (ShouldUseHeap(size, stride, aIsAnimated)) {
     RefPtr<SourceSurfaceAlignedRawData> newSurf =
         new SourceSurfaceAlignedRawData();
     if (newSurf->Init(size, format, false, 0, stride)) {
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -81,17 +81,17 @@ class imgMemoryReporter final : public n
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override {
     MOZ_ASSERT(NS_IsMainThread());
 
     layers::CompositorManagerChild* manager =
         CompositorManagerChild::GetInstance();
-    if (!manager || !StaticPrefs::ImageMemDebugReporting()) {
+    if (!manager || !StaticPrefs::image_mem_debug_reporting()) {
       layers::SharedSurfacesMemoryReport sharedSurfaces;
       FinishCollectReports(aHandleReport, aData, aAnonymize, sharedSurfaces);
       return NS_OK;
     }
 
     RefPtr<imgMemoryReporter> self(this);
     nsCOMPtr<nsIHandleReportCallback> handleReport(aHandleReport);
     nsCOMPtr<nsISupports> data(aData);
@@ -258,17 +258,17 @@ class imgMemoryReporter final : public n
           counter.URI().Truncate(max);
           counter.URI().AppendLiteral(" (truncated)");
         }
         counter.URI().ReplaceChar('/', '\\');
       }
 
       summaryTotal += counter;
 
-      if (counter.IsNotable() || StaticPrefs::ImageMemDebugReporting()) {
+      if (counter.IsNotable() || StaticPrefs::image_mem_debug_reporting()) {
         ReportImage(aHandleReport, aData, aPathPrefix, counter,
                     aSharedSurfaces);
       } else {
         ImageMemoryReporter::TrimSharedSurfaces(counter, aSharedSurfaces);
         nonNotableTotal += counter;
       }
     }
 
@@ -339,17 +339,17 @@ class imgMemoryReporter final : public n
       }
 
       ImageMemoryReporter::AppendSharedSurfacePrefix(surfacePathPrefix, counter,
                                                      aSharedSurfaces);
 
       if (counter.Type() == SurfaceMemoryCounterType::NORMAL) {
         PlaybackType playback = counter.Key().Playback();
         if (playback == PlaybackType::eAnimated) {
-          if (StaticPrefs::ImageMemDebugReporting()) {
+          if (StaticPrefs::image_mem_debug_reporting()) {
             surfacePathPrefix.AppendPrintf(
                 " (animation %4u)", uint32_t(counter.Values().FrameIndex()));
           } else {
             surfacePathPrefix.AppendLiteral(" (animation)");
           }
         }
 
         if (counter.Key().Flags() != DefaultSurfaceFlags()) {
@@ -1246,18 +1246,18 @@ imgCacheQueue& imgLoader::GetCacheQueue(
   return aForChrome ? mChromeCacheQueue : mCacheQueue;
 }
 
 imgCacheQueue& imgLoader::GetCacheQueue(const ImageCacheKey& aKey) {
   return GetCacheQueue(aKey.IsChrome());
 }
 
 void imgLoader::GlobalInit() {
-  sCacheTimeWeight = StaticPrefs::ImageCacheTimeWeight() / 1000.0;
-  int32_t cachesize = StaticPrefs::ImageCacheSize();
+  sCacheTimeWeight = StaticPrefs::image_cache_timeweight() / 1000.0;
+  int32_t cachesize = StaticPrefs::image_cache_size();
   sCacheMaxSize = cachesize > 0 ? cachesize : 0;
 
   sMemReporter = new imgMemoryReporter();
   RegisterStrongAsyncMemoryReporter(sMemReporter);
   RegisterImagesContentUsedUncompressedDistinguishedAmount(
       imgMemoryReporter::ImagesContentUsedUncompressedDistinguishedAmount);
 }
 
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -464,17 +464,17 @@ void imgRequest::AdjustPriority(imgReque
 void imgRequest::AdjustPriorityInternal(int32_t aDelta) {
   nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(mChannel);
   if (p) {
     p->AdjustPriority(aDelta);
   }
 }
 
 void imgRequest::BoostPriority(uint32_t aCategory) {
-  if (!StaticPrefs::ImageLayoutNetworkPriority()) {
+  if (!StaticPrefs::image_layout_network_priority()) {
     return;
   }
 
   uint32_t newRequestedCategory =
       (mBoostCategoriesRequested & aCategory) ^ aCategory;
   if (!newRequestedCategory) {
     // priority boost for each category can only apply once.
     return;
--- a/image/test/gtest/TestSurfaceCache.cpp
+++ b/image/test/gtest/TestSurfaceCache.cpp
@@ -38,18 +38,18 @@ TEST_F(ImageSurfaceCache, Factor2) {
 
   // Figure out how much data we have.
   uint64_t length;
   nsresult rv = inputStream->Available(&length);
   ASSERT_TRUE(NS_SUCCEEDED(rv));
 
   // Ensures we meet the threshold for FLAG_SYNC_DECODE_IF_FAST to do sync
   // decoding without the implications of FLAG_SYNC_DECODE.
-  ASSERT_LT(length,
-            static_cast<uint64_t>(StaticPrefs::ImageMemDecodeBytesAtATime()));
+  ASSERT_LT(length, static_cast<uint64_t>(
+                        StaticPrefs::image_mem_decode_bytes_at_a_time()));
 
   // Write the data into the image.
   rv = image->OnImageDataAvailable(nullptr, nullptr, inputStream, 0,
                                    static_cast<uint32_t>(length));
   ASSERT_TRUE(NS_SUCCEEDED(rv));
 
   // Let the image know we've sent all the data.
   rv = image->OnImageDataComplete(nullptr, nullptr, NS_OK, true);
@@ -68,17 +68,17 @@ TEST_F(ImageSurfaceCache, Factor2) {
   // If the data stream is small enough, as we assert above,
   // FLAG_SYNC_DECODE_IF_FAST will allow us to decode sync, but avoid forcing
   // SurfaceCache::Lookup. Instead it will use SurfaceCache::LookupBestMatch.
   const uint32_t bestMatchFlags = imgIContainer::FLAG_HIGH_QUALITY_SCALING |
                                   imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
 
   // We need the default threshold to be enabled (otherwise we should disable
   // this test).
-  int32_t threshold = StaticPrefs::ImageCacheFactor2ThresholdSurfaces();
+  int32_t threshold = StaticPrefs::image_cache_factor2_threshold_surfaces();
   ASSERT_TRUE(threshold >= 0);
 
   // We need to know what the native sizes are, otherwise factor of 2 mode will
   // be disabled.
   size_t nativeSizes = image->GetNativeSizesLength();
   ASSERT_EQ(nativeSizes, 1u);
 
   // Threshold is the native size count and the pref threshold added together.
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -3584,217 +3584,217 @@ VARCACHE_PREF(
 
 //---------------------------------------------------------------------------
 // Prefs starting with "image."
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(
   Live,
   "image.animated.decode-on-demand.threshold-kb",
-  ImageAnimatedDecodeOnDemandThresholdKB,
+   image_animated_decode_on_demand_threshold_kb,
   RelaxedAtomicUint32, 20480
 )
 
 VARCACHE_PREF(
   Live,
   "image.animated.decode-on-demand.batch-size",
-  ImageAnimatedDecodeOnDemandBatchSize,
+   image_animated_decode_on_demand_batch_size,
   RelaxedAtomicUint32, 6
 )
 
 // Whether we should recycle already displayed frames instead of discarding
 // them. This saves on the allocation itself, and may be able to reuse the
 // contents as well. Only applies if generating full frames.
 VARCACHE_PREF(
   Once,
   "image.animated.decode-on-demand.recycle",
-  ImageAnimatedDecodeOnDemandRecycle,
+   image_animated_decode_on_demand_recycle,
   bool, true
 )
 
 VARCACHE_PREF(
   Live,
   "image.animated.resume-from-last-displayed",
-  ImageAnimatedResumeFromLastDisplayed,
+   image_animated_resume_from_last_displayed,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "image.cache.factor2.threshold-surfaces",
-  ImageCacheFactor2ThresholdSurfaces,
+   image_cache_factor2_threshold_surfaces,
   RelaxedAtomicInt32, -1
 )
 
 VARCACHE_PREF(
   Live,
   "image.cache.max-rasterized-svg-threshold-kb",
-  ImageCacheMaxRasterizedSVGThresholdKB,
+   image_cache_max_rasterized_svg_threshold_kb,
   RelaxedAtomicInt32, 90*1024
 )
 
 // The maximum size, in bytes, of the decoded images we cache.
 VARCACHE_PREF(
   Once,
   "image.cache.size",
-  ImageCacheSize,
+   image_cache_size,
   int32_t, 5*1024*1024
 )
 
 // A weight, from 0-1000, to place on time when comparing to size.
 // Size is given a weight of 1000 - timeweight.
 VARCACHE_PREF(
   Once,
   "image.cache.timeweight",
-  ImageCacheTimeWeight,
+   image_cache_timeweight,
   int32_t, 500
 )
 
 VARCACHE_PREF(
   Live,
   "image.decode-immediately.enabled",
-  ImageDecodeImmediatelyEnabled,
+   image_decode_immediately_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "image.downscale-during-decode.enabled",
-  ImageDownscaleDuringDecodeEnabled,
+   image_downscale_during_decode_enabled,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "image.infer-src-animation.threshold-ms",
-  ImageInferSrcAnimationThresholdMS,
+   image_infer_src_animation_threshold_ms,
   RelaxedAtomicUint32, 2000
 )
 
 VARCACHE_PREF(
   Live,
   "image.layout_network_priority",
-  ImageLayoutNetworkPriority,
+   image_layout_network_priority,
   RelaxedAtomicBool, true
 )
 
 // Chunk size for calls to the image decoders.
 VARCACHE_PREF(
   Once,
   "image.mem.decode_bytes_at_a_time",
-  ImageMemDecodeBytesAtATime,
+   image_mem_decode_bytes_at_a_time,
   uint32_t, 16384
 )
 
 VARCACHE_PREF(
   Live,
   "image.mem.discardable",
-  ImageMemDiscardable,
+   image_mem_discardable,
   RelaxedAtomicBool, false
 )
 
 // Discards inactive image frames of _animated_ images and re-decodes them on
 // demand from compressed data. Has no effect if image.mem.discardable is false.
 VARCACHE_PREF(
   Once,
   "image.mem.animated.discardable",
-  ImageMemAnimatedDiscardable,
+   image_mem_animated_discardable,
   bool, true
 )
 
 VARCACHE_PREF(
   Live,
   "image.mem.animated.use_heap",
-  ImageMemAnimatedUseHeap,
+   image_mem_animated_use_heap,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "image.mem.debug-reporting",
-  ImageMemDebugReporting,
+   image_mem_debug_reporting,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "image.mem.shared",
-  ImageMemShared,
+   image_mem_shared,
   RelaxedAtomicBool, true
 )
 
 // How much of the data in the surface cache is discarded when we get a memory
 // pressure notification, as a fraction. The discard factor is interpreted as a
 // reciprocal, so a discard factor of 1 means to discard everything in the
 // surface cache on memory pressure, a discard factor of 2 means to discard half
 // of the data, and so forth. The default should be a good balance for desktop
 // and laptop systems, where we never discard visible images.
 VARCACHE_PREF(
   Once,
   "image.mem.surfacecache.discard_factor",
-  ImageMemSurfaceCacheDiscardFactor,
+   image_mem_surfacecache_discard_factor,
   uint32_t, 1
 )
 
 // Maximum size for the surface cache, in kilobytes.
 VARCACHE_PREF(
   Once,
   "image.mem.surfacecache.max_size_kb",
-  ImageMemSurfaceCacheMaxSizeKB,
+   image_mem_surfacecache_max_size_kb,
   uint32_t, 1024 * 1024
 )
 
 // Minimum timeout for expiring unused images from the surface cache, in
 // milliseconds. This controls how long we store cached temporary surfaces.
 VARCACHE_PREF(
   Once,
   "image.mem.surfacecache.min_expiration_ms",
-  ImageMemSurfaceCacheMinExpirationMS,
+   image_mem_surfacecache_min_expiration_ms,
   uint32_t, 60*1000
 )
 
 // The surface cache's size, within the constraints of the maximum size set
 // above, is determined as a fraction of main memory size. The size factor is
 // interpreted as a reciprocal, so a size factor of 4 means to use no more than
 // 1/4 of main memory.  The default should be a good balance for most systems.
 VARCACHE_PREF(
   Once,
   "image.mem.surfacecache.size_factor",
-  ImageMemSurfaceCacheSizeFactor,
+   image_mem_surfacecache_size_factor,
   uint32_t, 4
 )
 
 VARCACHE_PREF(
   Live,
   "image.mem.volatile.min_threshold_kb",
-  ImageMemVolatileMinThresholdKB,
+   image_mem_volatile_min_threshold_kb,
   RelaxedAtomicInt32, -1
 )
 
 // How long in ms before we should start shutting down idle decoder threads.
 VARCACHE_PREF(
   Once,
   "image.multithreaded_decoding.idle_timeout",
-  ImageMTDecodingIdleTimeout,
+   image_multithreaded_decoding_idle_timeout,
   int32_t, 600000
 )
 
 // How many threads we'll use for multithreaded decoding. If < 0, will be
 // automatically determined based on the system's number of cores.
 VARCACHE_PREF(
   Once,
   "image.multithreaded_decoding.limit",
-  ImageMTDecodingLimit,
+   image_multithreaded_decoding_limit,
   int32_t, -1
 )
 
 VARCACHE_PREF(
   Live,
   "image.webp.enabled",
-  ImageWebPEnabled,
+   image_webp_enabled,
   RelaxedAtomicBool, false
 )
 
 //---------------------------------------------------------------------------
 // Prefs starting with "javascript."
 //---------------------------------------------------------------------------
 
 // BigInt API