Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond
authorRyan Hunt <rhunt@eqrion.net>
Mon, 25 Feb 2019 16:07:58 -0600
changeset 461891 240e874ed11862376247ea177a88ddf00924e0da
parent 461890 0a3f7bcc8145ef68d331c1a0b6ae1fee587f774e
child 461892 a683a7c54dc47148e011b356e3d8450bfb2988e3
push id35631
push userrgurzau@mozilla.com
push dateFri, 01 Mar 2019 13:06:03 +0000
treeherdermozilla-central@d4e19870e27f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond
bugs1523969
milestone67.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 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond Differential Revision: https://phabricator.services.mozilla.com/D21110
image/DecodePool.cpp
image/DecoderFactory.cpp
image/ImageCacheKey.cpp
image/ImageFactory.cpp
image/ImageMemoryReporter.cpp
image/ImageOps.cpp
image/RasterImage.cpp
image/ShutdownTracker.cpp
image/SourceBuffer.cpp
image/SurfaceCache.cpp
image/SurfaceCacheUtils.cpp
image/encoders/jpeg/nsJPEGEncoder.cpp
image/imgLoader.cpp
--- a/image/DecodePool.cpp
+++ b/image/DecodePool.cpp
@@ -31,18 +31,20 @@ using std::min;
 
 namespace mozilla {
 namespace image {
 
 ///////////////////////////////////////////////////////////////////////////////
 // DecodePool implementation.
 ///////////////////////////////////////////////////////////////////////////////
 
-/* static */ StaticRefPtr<DecodePool> DecodePool::sSingleton;
-/* static */ uint32_t DecodePool::sNumCores = 0;
+/* static */
+StaticRefPtr<DecodePool> DecodePool::sSingleton;
+/* static */
+uint32_t DecodePool::sNumCores = 0;
 
 NS_IMPL_ISUPPORTS(DecodePool, nsIObserver)
 
 struct Work {
   enum class Type { TASK, SHUTDOWN } mType;
 
   RefPtr<IDecodingTask> mTask;
 };
@@ -304,33 +306,36 @@ bool DecodePoolImpl::CreateThread() {
 
   mThreads.AppendElement(std::move(thread));
   --mAvailableThreads;
   ++mIdleThreads;
   MOZ_ASSERT(mIdleThreads <= mThreads.Capacity());
   return true;
 }
 
-/* static */ void DecodePool::Initialize() {
+/* static */
+void DecodePool::Initialize() {
   MOZ_ASSERT(NS_IsMainThread());
   sNumCores = max<int32_t>(PR_GetNumberOfProcessors(), 1);
   DecodePool::Singleton();
 }
 
-/* static */ DecodePool* DecodePool::Singleton() {
+/* static */
+DecodePool* DecodePool::Singleton() {
   if (!sSingleton) {
     MOZ_ASSERT(NS_IsMainThread());
     sSingleton = new DecodePool();
     ClearOnShutdown(&sSingleton);
   }
 
   return sSingleton;
 }
 
-/* static */ uint32_t DecodePool::NumberOfCores() { return sNumCores; }
+/* static */
+uint32_t DecodePool::NumberOfCores() { return sNumCores; }
 
 DecodePool::DecodePool() : mMutex("image::DecodePool") {
   // Determine the number of threads we want.
   int32_t prefLimit = gfxPrefs::ImageMTDecodingLimit();
   uint32_t limit;
   if (prefLimit <= 0) {
     int32_t numCores = NumberOfCores();
     if (numCores <= 1) {
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -23,17 +23,18 @@
 #include "nsWebPDecoder.h"
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace image {
 
-/* static */ DecoderType DecoderFactory::GetDecoderType(const char* aMimeType) {
+/* static */
+DecoderType DecoderFactory::GetDecoderType(const char* aMimeType) {
   // By default we don't know.
   DecoderType type = DecoderType::UNKNOWN;
 
   // PNG
   if (!strcmp(aMimeType, IMAGE_PNG)) {
     type = DecoderType::PNG;
   } else if (!strcmp(aMimeType, IMAGE_X_PNG)) {
     type = DecoderType::PNG;
@@ -75,18 +76,20 @@ namespace image {
     // WebP
   } else if (!strcmp(aMimeType, IMAGE_WEBP) && gfxPrefs::ImageWebPEnabled()) {
     type = DecoderType::WEBP;
   }
 
   return type;
 }
 
-/* static */ already_AddRefed<Decoder> DecoderFactory::GetDecoder(
-    DecoderType aType, RasterImage* aImage, bool aIsRedecode) {
+/* static */
+already_AddRefed<Decoder> DecoderFactory::GetDecoder(DecoderType aType,
+                                                     RasterImage* aImage,
+                                                     bool aIsRedecode) {
   RefPtr<Decoder> decoder;
 
   switch (aType) {
     case DecoderType::PNG:
       decoder = new nsPNGDecoder(aImage);
       break;
     case DecoderType::GIF:
       decoder = new nsGIFDecoder2(aImage);
@@ -114,17 +117,18 @@ namespace image {
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown decoder type");
   }
 
   return decoder.forget();
 }
 
-/* static */ nsresult DecoderFactory::CreateDecoder(
+/* static */
+nsresult DecoderFactory::CreateDecoder(
     DecoderType aType, NotNull<RasterImage*> aImage,
     NotNull<SourceBuffer*> aSourceBuffer, const IntSize& aIntrinsicSize,
     const IntSize& aOutputSize, DecoderFlags aDecoderFlags,
     SurfaceFlags aSurfaceFlags, IDecodingTask** aOutTask) {
   if (aType == DecoderType::UNKNOWN) {
     return NS_ERROR_INVALID_ARG;
   }
 
@@ -168,17 +172,18 @@ namespace image {
   }
 
   // Return the surface provider in its IDecodingTask guise.
   RefPtr<IDecodingTask> task = provider.get();
   task.forget(aOutTask);
   return NS_OK;
 }
 
-/* static */ nsresult DecoderFactory::CreateAnimationDecoder(
+/* static */
+nsresult DecoderFactory::CreateAnimationDecoder(
     DecoderType aType, NotNull<RasterImage*> aImage,
     NotNull<SourceBuffer*> aSourceBuffer, const IntSize& aIntrinsicSize,
     DecoderFlags aDecoderFlags, SurfaceFlags aSurfaceFlags,
     size_t aCurrentFrame, IDecodingTask** aOutTask) {
   if (aType == DecoderType::UNKNOWN) {
     return NS_ERROR_INVALID_ARG;
   }
 
@@ -222,17 +227,18 @@ namespace image {
   }
 
   // Return the surface provider in its IDecodingTask guise.
   RefPtr<IDecodingTask> task = provider.get();
   task.forget(aOutTask);
   return NS_OK;
 }
 
-/* static */ already_AddRefed<Decoder> DecoderFactory::CloneAnimationDecoder(
+/* static */
+already_AddRefed<Decoder> DecoderFactory::CloneAnimationDecoder(
     Decoder* aDecoder) {
   MOZ_ASSERT(aDecoder);
 
   // In an ideal world, we would assert aDecoder->HasAnimation() but we cannot.
   // The decoder may not have detected it is animated yet (e.g. it did not even
   // get scheduled yet, or it has only decoded the first frame and has yet to
   // rediscover it is animated).
   DecoderType type = aDecoder->GetType();
@@ -252,20 +258,20 @@ namespace image {
 
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
   }
 
   return decoder.forget();
 }
 
-/* static */ already_AddRefed<IDecodingTask>
-DecoderFactory::CreateMetadataDecoder(DecoderType aType,
-                                      NotNull<RasterImage*> aImage,
-                                      NotNull<SourceBuffer*> aSourceBuffer) {
+/* static */
+already_AddRefed<IDecodingTask> DecoderFactory::CreateMetadataDecoder(
+    DecoderType aType, NotNull<RasterImage*> aImage,
+    NotNull<SourceBuffer*> aSourceBuffer) {
   if (aType == DecoderType::UNKNOWN) {
     return nullptr;
   }
 
   RefPtr<Decoder> decoder =
       GetDecoder(aType, aImage, /* aIsRedecode = */ false);
   MOZ_ASSERT(decoder, "Should have a decoder now");
 
@@ -276,24 +282,22 @@ DecoderFactory::CreateMetadataDecoder(De
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
   }
 
   RefPtr<IDecodingTask> task = new MetadataDecodingTask(WrapNotNull(decoder));
   return task.forget();
 }
 
-/* static */ already_AddRefed<Decoder>
-DecoderFactory::CreateDecoderForICOResource(DecoderType aType,
-                                            SourceBufferIterator&& aIterator,
-                                            NotNull<nsICODecoder*> aICODecoder,
-                                            bool aIsMetadataDecode,
-                                            const Maybe<IntSize>& aExpectedSize,
-                                            const Maybe<uint32_t>& aDataOffset
-                                            /* = Nothing() */) {
+/* static */
+already_AddRefed<Decoder> DecoderFactory::CreateDecoderForICOResource(
+    DecoderType aType, SourceBufferIterator&& aIterator,
+    NotNull<nsICODecoder*> aICODecoder, bool aIsMetadataDecode,
+    const Maybe<IntSize>& aExpectedSize, const Maybe<uint32_t>& aDataOffset
+    /* = Nothing() */) {
   // Create the decoder.
   RefPtr<Decoder> decoder;
   switch (aType) {
     case DecoderType::BMP:
       MOZ_ASSERT(aDataOffset);
       decoder =
           new nsBMPDecoder(aICODecoder->GetImageMaybeNull(), *aDataOffset);
       break;
@@ -325,17 +329,18 @@ DecoderFactory::CreateDecoderForICOResou
 
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
   }
 
   return decoder.forget();
 }
 
-/* static */ already_AddRefed<Decoder> DecoderFactory::CreateAnonymousDecoder(
+/* static */
+already_AddRefed<Decoder> DecoderFactory::CreateAnonymousDecoder(
     DecoderType aType, NotNull<SourceBuffer*> aSourceBuffer,
     const Maybe<IntSize>& aOutputSize, DecoderFlags aDecoderFlags,
     SurfaceFlags aSurfaceFlags) {
   if (aType == DecoderType::UNKNOWN) {
     return nullptr;
   }
 
   RefPtr<Decoder> decoder =
@@ -360,18 +365,18 @@ DecoderFactory::CreateDecoderForICOResou
 
   if (NS_FAILED(decoder->Init())) {
     return nullptr;
   }
 
   return decoder.forget();
 }
 
-/* static */ already_AddRefed<Decoder>
-DecoderFactory::CreateAnonymousMetadataDecoder(
+/* static */
+already_AddRefed<Decoder> DecoderFactory::CreateAnonymousMetadataDecoder(
     DecoderType aType, NotNull<SourceBuffer*> aSourceBuffer) {
   if (aType == DecoderType::UNKNOWN) {
     return nullptr;
   }
 
   RefPtr<Decoder> decoder =
       GetDecoder(aType, /* aImage = */ nullptr, /* aIsRedecode = */ false);
   MOZ_ASSERT(decoder, "Should have a decoder now");
--- a/image/ImageCacheKey.cpp
+++ b/image/ImageCacheKey.cpp
@@ -131,18 +131,19 @@ void ImageCacheKey::EnsureHash() const {
   mHash.emplace(hash);
 }
 
 bool ImageCacheKey::SchemeIs(const char* aScheme) {
   bool matches = false;
   return NS_SUCCEEDED(mURI->SchemeIs(aScheme, &matches)) && matches;
 }
 
-/* static */ void* ImageCacheKey::GetSpecialCaseDocumentToken(
-    Document* aDocument, nsIURI* aURI) {
+/* static */
+void* ImageCacheKey::GetSpecialCaseDocumentToken(Document* aDocument,
+                                                 nsIURI* aURI) {
   // Cookie-averse documents can never have storage granted to them.  Since they
   // may not have inner windows, they would require special handling below, so
   // just bail out early here.
   if (!aDocument || aDocument->IsCookieAverse()) {
     return nullptr;
   }
 
   // For controlled documents, we cast the pointer into a void* to avoid
--- a/image/ImageFactory.cpp
+++ b/image/ImageFactory.cpp
@@ -24,17 +24,18 @@
 #include "nsContentUtils.h"
 #include "nsIScriptSecurityManager.h"
 
 #include "gfxPrefs.h"
 
 namespace mozilla {
 namespace image {
 
-/*static*/ void ImageFactory::Initialize() {}
+/*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 = gfxPrefs::ImageMemDiscardable();
   bool doDecodeImmediately = gfxPrefs::ImageDecodeImmediatelyEnabled();
@@ -99,17 +100,18 @@ static void NotifyImageLoading(nsIURI* a
     nsAutoCString spec;
     aURI->GetSpec(spec);
     obs->NotifyObservers(nullptr, "image-loading",
                          NS_ConvertUTF8toUTF16(spec).get());
   }
 }
 #endif
 
-/* static */ already_AddRefed<Image> ImageFactory::CreateImage(
+/* static */
+already_AddRefed<Image> ImageFactory::CreateImage(
     nsIRequest* aRequest, ProgressTracker* aProgressTracker,
     const nsCString& aMimeType, nsIURI* aURI, bool aIsMultiPart,
     uint32_t aInnerWindowId) {
   MOZ_ASSERT(gfxPrefs::SingletonExists(),
              "Pref observers should have been initialized already");
 
   // Compute the image's initialization flags.
   uint32_t imageFlags = ComputeImageFlags(aURI, aMimeType, aIsMultiPart);
@@ -136,17 +138,18 @@ static void NotifyImageLoading(nsIURI* a
 // Marks an image as having an error before returning it.
 template <typename T>
 static already_AddRefed<Image> BadImage(const char* aMessage,
                                         RefPtr<T>& aImage) {
   aImage->SetHasError();
   return aImage.forget();
 }
 
-/* static */ already_AddRefed<Image> ImageFactory::CreateAnonymousImage(
+/* static */
+already_AddRefed<Image> ImageFactory::CreateAnonymousImage(
     const nsCString& aMimeType, uint32_t aSizeHint /* = 0 */) {
   nsresult rv;
 
   RefPtr<RasterImage> newImage = new RasterImage();
 
   RefPtr<ProgressTracker> newTracker = new ProgressTracker();
   newTracker->SetImage(newImage);
   newImage->SetProgressTracker(newTracker);
@@ -159,19 +162,19 @@ static already_AddRefed<Image> BadImage(
   rv = newImage->SetSourceSizeHint(aSizeHint);
   if (NS_FAILED(rv)) {
     return BadImage("RasterImage::SetSourceSizeHint failed", newImage);
   }
 
   return newImage.forget();
 }
 
-/* static */ already_AddRefed<MultipartImage>
-ImageFactory::CreateMultipartImage(Image* aFirstPart,
-                                   ProgressTracker* aProgressTracker) {
+/* static */
+already_AddRefed<MultipartImage> ImageFactory::CreateMultipartImage(
+    Image* aFirstPart, ProgressTracker* aProgressTracker) {
   MOZ_ASSERT(aFirstPart);
   MOZ_ASSERT(aProgressTracker);
 
   RefPtr<MultipartImage> newImage = new MultipartImage(aFirstPart);
   aProgressTracker->SetImage(newImage);
   newImage->SetProgressTracker(aProgressTracker);
 
   newImage->Init();
@@ -213,17 +216,18 @@ uint32_t GetContentSize(nsIRequest* aReq
       }
     }
   }
 
   // Fallback - neither http nor file. We'll use dynamic allocation.
   return 0;
 }
 
-/* static */ already_AddRefed<Image> ImageFactory::CreateRasterImage(
+/* static */
+already_AddRefed<Image> ImageFactory::CreateRasterImage(
     nsIRequest* aRequest, ProgressTracker* aProgressTracker,
     const nsCString& aMimeType, nsIURI* aURI, uint32_t aImageFlags,
     uint32_t aInnerWindowId) {
   MOZ_ASSERT(aProgressTracker);
 
   nsresult rv;
 
   RefPtr<RasterImage> newImage = new RasterImage(aURI);
@@ -240,17 +244,18 @@ uint32_t GetContentSize(nsIRequest* aReq
   rv = newImage->SetSourceSizeHint(GetContentSize(aRequest));
   if (NS_FAILED(rv)) {
     return BadImage("RasterImage::SetSourceSizeHint failed", newImage);
   }
 
   return newImage.forget();
 }
 
-/* static */ already_AddRefed<Image> ImageFactory::CreateVectorImage(
+/* static */
+already_AddRefed<Image> ImageFactory::CreateVectorImage(
     nsIRequest* aRequest, ProgressTracker* aProgressTracker,
     const nsCString& aMimeType, nsIURI* aURI, uint32_t aImageFlags,
     uint32_t aInnerWindowId) {
   MOZ_ASSERT(aProgressTracker);
 
   nsresult rv;
 
   RefPtr<VectorImage> newImage = new VectorImage(aURI);
--- a/image/ImageMemoryReporter.cpp
+++ b/image/ImageMemoryReporter.cpp
@@ -31,55 +31,60 @@ class ImageMemoryReporter::WebRenderRepo
   }
 
  private:
   virtual ~WebRenderReporter() {}
 };
 
 NS_IMPL_ISUPPORTS(ImageMemoryReporter::WebRenderReporter, nsIMemoryReporter)
 
-/* static */ void ImageMemoryReporter::InitForWebRender() {
+/* static */
+void ImageMemoryReporter::InitForWebRender() {
   MOZ_ASSERT(XRE_IsParentProcess() || XRE_IsGPUProcess());
   if (!sWrReporter) {
     sWrReporter = new WebRenderReporter();
     RegisterStrongMemoryReporter(sWrReporter);
   }
 }
 
-/* static */ void ImageMemoryReporter::ShutdownForWebRender() {
+/* static */
+void ImageMemoryReporter::ShutdownForWebRender() {
   MOZ_ASSERT(XRE_IsParentProcess() || XRE_IsGPUProcess());
   if (sWrReporter) {
     UnregisterStrongMemoryReporter(sWrReporter);
     sWrReporter = nullptr;
   }
 }
 
-/* static */ void ImageMemoryReporter::ReportSharedSurfaces(
+/* static */
+void ImageMemoryReporter::ReportSharedSurfaces(
     nsIHandleReportCallback* aHandleReport, nsISupports* aData,
     const layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
   ReportSharedSurfaces(aHandleReport, aData,
                        /* aIsForCompositor */ false, aSharedSurfaces);
 }
 
-/* static */ void ImageMemoryReporter::ReportSharedSurfaces(
+/* static */
+void ImageMemoryReporter::ReportSharedSurfaces(
     nsIHandleReportCallback* aHandleReport, nsISupports* aData,
     bool aIsForCompositor,
     const layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
   MOZ_ASSERT_IF(aIsForCompositor, XRE_IsParentProcess() || XRE_IsGPUProcess());
   MOZ_ASSERT_IF(!aIsForCompositor,
                 XRE_IsParentProcess() || XRE_IsContentProcess());
 
   for (auto i = aSharedSurfaces.mSurfaces.begin();
        i != aSharedSurfaces.mSurfaces.end(); ++i) {
     ReportSharedSurface(aHandleReport, aData, aIsForCompositor, i->first,
                         i->second);
   }
 }
 
-/* static */ void ImageMemoryReporter::ReportSharedSurface(
+/* static */
+void ImageMemoryReporter::ReportSharedSurface(
     nsIHandleReportCallback* aHandleReport, nsISupports* aData,
     bool aIsForCompositor, uint64_t aExternalId,
     const layers::SharedSurfacesMemoryReport::SurfaceEntry& aEntry) {
   nsAutoCString path;
   if (aIsForCompositor) {
     path.AppendLiteral("gfx/webrender/images/mapped_from_owner/");
   } else {
     path.AppendLiteral("gfx/webrender/images/owner_cache_missing/");
@@ -118,17 +123,18 @@ NS_IMPL_ISUPPORTS(ImageMemoryReporter::W
                      : nsIMemoryReporter::KIND_OTHER;
 
   NS_NAMED_LITERAL_CSTRING(desc, "Decoded image data stored in shared memory.");
   aHandleReport->Callback(EmptyCString(), path, kind,
                           nsIMemoryReporter::UNITS_BYTES, surfaceSize, desc,
                           aData);
 }
 
-/* static */ void ImageMemoryReporter::AppendSharedSurfacePrefix(
+/* 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 (gfxPrefs::ImageMemDebugReporting()) {
       aPathPrefix.AppendLiteral(", external_id:");
@@ -143,17 +149,18 @@ NS_IMPL_ISUPPORTS(ImageMemoryReporter::W
 
     if (gpuEntry != aSharedSurfaces.mSurfaces.end()) {
       MOZ_ASSERT(gpuEntry->second.mCreatorRef);
       aSharedSurfaces.mSurfaces.erase(gpuEntry);
     }
   }
 }
 
-/* static */ void ImageMemoryReporter::TrimSharedSurfaces(
+/* static */
+void ImageMemoryReporter::TrimSharedSurfaces(
     const ImageMemoryCounter& aCounter,
     layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
   if (aSharedSurfaces.mSurfaces.empty()) {
     return;
   }
 
   for (const SurfaceMemoryCounter& counter : aCounter.Surfaces()) {
     uint64_t extId = counter.Values().ExternalId();
--- a/image/ImageOps.cpp
+++ b/image/ImageOps.cpp
@@ -21,57 +21,63 @@
 #include "OrientedImage.h"
 #include "SourceBuffer.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace image {
 
-/* static */ already_AddRefed<Image> ImageOps::Freeze(Image* aImage) {
+/* static */
+already_AddRefed<Image> ImageOps::Freeze(Image* aImage) {
   RefPtr<Image> frozenImage = new FrozenImage(aImage);
   return frozenImage.forget();
 }
 
-/* static */ already_AddRefed<imgIContainer> ImageOps::Freeze(
-    imgIContainer* aImage) {
+/* static */
+already_AddRefed<imgIContainer> ImageOps::Freeze(imgIContainer* aImage) {
   nsCOMPtr<imgIContainer> frozenImage =
       new FrozenImage(static_cast<Image*>(aImage));
   return frozenImage.forget();
 }
 
-/* static */ already_AddRefed<Image> ImageOps::Clip(
-    Image* aImage, nsIntRect aClip, const Maybe<nsSize>& aSVGViewportSize) {
+/* static */
+already_AddRefed<Image> ImageOps::Clip(Image* aImage, nsIntRect aClip,
+                                       const Maybe<nsSize>& aSVGViewportSize) {
   RefPtr<Image> clippedImage =
       new ClippedImage(aImage, aClip, aSVGViewportSize);
   return clippedImage.forget();
 }
 
-/* static */ already_AddRefed<imgIContainer> ImageOps::Clip(
+/* static */
+already_AddRefed<imgIContainer> ImageOps::Clip(
     imgIContainer* aImage, nsIntRect aClip,
     const Maybe<nsSize>& aSVGViewportSize) {
   nsCOMPtr<imgIContainer> clippedImage =
       new ClippedImage(static_cast<Image*>(aImage), aClip, aSVGViewportSize);
   return clippedImage.forget();
 }
 
-/* static */ already_AddRefed<Image> ImageOps::Orient(
-    Image* aImage, Orientation aOrientation) {
+/* static */
+already_AddRefed<Image> ImageOps::Orient(Image* aImage,
+                                         Orientation aOrientation) {
   RefPtr<Image> orientedImage = new OrientedImage(aImage, aOrientation);
   return orientedImage.forget();
 }
 
-/* static */ already_AddRefed<imgIContainer> ImageOps::Orient(
-    imgIContainer* aImage, Orientation aOrientation) {
+/* static */
+already_AddRefed<imgIContainer> ImageOps::Orient(imgIContainer* aImage,
+                                                 Orientation aOrientation) {
   nsCOMPtr<imgIContainer> orientedImage =
       new OrientedImage(static_cast<Image*>(aImage), aOrientation);
   return orientedImage.forget();
 }
 
-/* static */ already_AddRefed<imgIContainer> ImageOps::CreateFromDrawable(
+/* static */
+already_AddRefed<imgIContainer> ImageOps::CreateFromDrawable(
     gfxDrawable* aDrawable) {
   nsCOMPtr<imgIContainer> drawableImage = new DynamicImage(aDrawable);
   return drawableImage.forget();
 }
 
 class ImageOps::ImageBufferImpl final : public ImageOps::ImageBuffer {
  public:
   explicit ImageBufferImpl(already_AddRefed<SourceBuffer> aSourceBuffer)
@@ -129,27 +135,29 @@ ImageOps::CreateImageBuffer(already_AddR
     return nullptr;
   }
   sourceBuffer->Complete(NS_OK);
 
   RefPtr<ImageBuffer> imageBuffer = new ImageBufferImpl(sourceBuffer.forget());
   return imageBuffer.forget();
 }
 
-/* static */ nsresult ImageOps::DecodeMetadata(
-    already_AddRefed<nsIInputStream> aInputStream, const nsACString& aMimeType,
-    ImageMetadata& aMetadata) {
+/* static */
+nsresult ImageOps::DecodeMetadata(already_AddRefed<nsIInputStream> aInputStream,
+                                  const nsACString& aMimeType,
+                                  ImageMetadata& aMetadata) {
   nsCOMPtr<nsIInputStream> inputStream = std::move(aInputStream);
   RefPtr<ImageBuffer> buffer = CreateImageBuffer(inputStream.forget());
   return DecodeMetadata(buffer, aMimeType, aMetadata);
 }
 
-/* static */ nsresult ImageOps::DecodeMetadata(ImageBuffer* aBuffer,
-                                               const nsACString& aMimeType,
-                                               ImageMetadata& aMetadata) {
+/* static */
+nsresult ImageOps::DecodeMetadata(ImageBuffer* aBuffer,
+                                  const nsACString& aMimeType,
+                                  ImageMetadata& aMetadata) {
   if (!aBuffer) {
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<SourceBuffer> sourceBuffer = aBuffer->GetSourceBuffer();
   if (NS_WARN_IF(!sourceBuffer)) {
     return NS_ERROR_FAILURE;
   }
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1541,18 +1541,18 @@ void RasterImage::DoError() {
 
   // Invalidate to get rid of any partially-drawn image content.
   NotifyProgress(NoProgress, IntRect(0, 0, mSize.width, mSize.height));
 
   MOZ_LOG(gImgLog, LogLevel::Error,
           ("RasterImage: [this=%p] Error detected for image\n", this));
 }
 
-/* static */ void RasterImage::HandleErrorWorker::DispatchIfNeeded(
-    RasterImage* aImage) {
+/* static */
+void RasterImage::HandleErrorWorker::DispatchIfNeeded(RasterImage* aImage) {
   RefPtr<HandleErrorWorker> worker = new HandleErrorWorker(aImage);
   NS_DispatchToMainThread(worker);
 }
 
 RasterImage::HandleErrorWorker::HandleErrorWorker(RasterImage* aImage)
     : Runnable("image::RasterImage::HandleErrorWorker"), mImage(aImage) {
   MOZ_ASSERT(mImage, "Should have image");
 }
--- a/image/ShutdownTracker.cpp
+++ b/image/ShutdownTracker.cpp
@@ -48,21 +48,21 @@ struct ShutdownObserver : public nsIObse
 };
 
 NS_IMPL_ISUPPORTS(ShutdownObserver, nsIObserver)
 
 ///////////////////////////////////////////////////////////////////////////////
 // Public API
 ///////////////////////////////////////////////////////////////////////////////
 
-/* static */ void ShutdownTracker::Initialize() {
+/* static */
+void ShutdownTracker::Initialize() {
   nsCOMPtr<nsIObserverService> os = services::GetObserverService();
   if (os) {
     os->AddObserver(new ShutdownObserver, "xpcom-will-shutdown", false);
   }
 }
 
-/* static */ bool ShutdownTracker::ShutdownHasStarted() {
-  return sShutdownHasStarted;
-}
+/* static */
+bool ShutdownTracker::ShutdownHasStarted() { return sShutdownHasStarted; }
 
 }  // namespace image
 }  // namespace mozilla
--- a/image/SourceBuffer.cpp
+++ b/image/SourceBuffer.cpp
@@ -251,17 +251,18 @@ nsresult SourceBuffer::Compact() {
 
   // Remove the redundant chunks.
   mChunks.RemoveElementsAt(1, mChunks.Length() - 1);
   mChunks.Compact();
 
   return NS_OK;
 }
 
-/* static */ size_t SourceBuffer::RoundedUpCapacity(size_t aCapacity) {
+/* static */
+size_t SourceBuffer::RoundedUpCapacity(size_t aCapacity) {
   // Protect against overflow.
   if (MOZ_UNLIKELY(SIZE_MAX - aCapacity < MIN_CHUNK_CAPACITY)) {
     return aCapacity;
   }
 
   // Round up to the next multiple of MIN_CHUNK_CAPACITY (which should be the
   // size of a page).
   size_t roundedCapacity =
--- a/image/SurfaceCache.cpp
+++ b/image/SurfaceCache.cpp
@@ -1377,17 +1377,18 @@ class SurfaceCacheImpl final : public ns
 
 NS_IMPL_ISUPPORTS(SurfaceCacheImpl, nsIMemoryReporter)
 NS_IMPL_ISUPPORTS(SurfaceCacheImpl::MemoryPressureObserver, nsIObserver)
 
 ///////////////////////////////////////////////////////////////////////////////
 // Public API
 ///////////////////////////////////////////////////////////////////////////////
 
-/* static */ void SurfaceCache::Initialize() {
+/* static */
+void SurfaceCache::Initialize() {
   // Initialize preferences.
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!sInstance, "Shouldn't initialize more than once");
 
   // See gfxPrefs for the default values of these preferences.
 
   // Length of time before an unused surface is removed from the cache, in
   // milliseconds.
@@ -1431,189 +1432,204 @@ NS_IMPL_ISUPPORTS(SurfaceCacheImpl::Memo
   // the size is a limit that the cache may not grow beyond, but we do not
   // actually allocate any storage for surfaces at this time.
   sInstance = new SurfaceCacheImpl(surfaceCacheExpirationTimeMS,
                                    surfaceCacheDiscardFactor,
                                    finalSurfaceCacheSizeBytes);
   sInstance->InitMemoryReporter();
 }
 
-/* static */ void SurfaceCache::Shutdown() {
+/* static */
+void SurfaceCache::Shutdown() {
   RefPtr<SurfaceCacheImpl> cache;
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(sInstance, "No singleton - was Shutdown() called twice?");
     cache = sInstance.forget();
   }
 }
 
-/* static */ LookupResult SurfaceCache::Lookup(const ImageKey aImageKey,
-                                               const SurfaceKey& aSurfaceKey,
-                                               bool aMarkUsed) {
+/* static */
+LookupResult SurfaceCache::Lookup(const ImageKey aImageKey,
+                                  const SurfaceKey& aSurfaceKey,
+                                  bool aMarkUsed) {
   nsTArray<RefPtr<CachedSurface>> discard;
   LookupResult rv(MatchType::NOT_FOUND);
 
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (!sInstance) {
       return rv;
     }
 
     rv = sInstance->Lookup(aImageKey, aSurfaceKey, lock, aMarkUsed);
     sInstance->TakeDiscard(discard, lock);
   }
 
   return rv;
 }
 
-/* static */ LookupResult SurfaceCache::LookupBestMatch(
-    const ImageKey aImageKey, const SurfaceKey& aSurfaceKey, bool aMarkUsed) {
+/* static */
+LookupResult SurfaceCache::LookupBestMatch(const ImageKey aImageKey,
+                                           const SurfaceKey& aSurfaceKey,
+                                           bool aMarkUsed) {
   nsTArray<RefPtr<CachedSurface>> discard;
   LookupResult rv(MatchType::NOT_FOUND);
 
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (!sInstance) {
       return rv;
     }
 
     rv = sInstance->LookupBestMatch(aImageKey, aSurfaceKey, lock, aMarkUsed);
     sInstance->TakeDiscard(discard, lock);
   }
 
   return rv;
 }
 
-/* static */ InsertOutcome SurfaceCache::Insert(
-    NotNull<ISurfaceProvider*> aProvider) {
+/* static */
+InsertOutcome SurfaceCache::Insert(NotNull<ISurfaceProvider*> aProvider) {
   nsTArray<RefPtr<CachedSurface>> discard;
   InsertOutcome rv(InsertOutcome::FAILURE);
 
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (!sInstance) {
       return rv;
     }
 
     rv = sInstance->Insert(aProvider, /* aSetAvailable = */ false, lock);
     sInstance->TakeDiscard(discard, lock);
   }
 
   return rv;
 }
 
-/* static */ bool SurfaceCache::CanHold(const IntSize& aSize,
-                                        uint32_t aBytesPerPixel /* = 4 */) {
+/* static */
+bool SurfaceCache::CanHold(const IntSize& aSize,
+                           uint32_t aBytesPerPixel /* = 4 */) {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (!sInstance) {
     return false;
   }
 
   Cost cost = ComputeCost(aSize, aBytesPerPixel);
   return sInstance->CanHold(cost);
 }
 
-/* static */ bool SurfaceCache::CanHold(size_t aSize) {
+/* static */
+bool SurfaceCache::CanHold(size_t aSize) {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (!sInstance) {
     return false;
   }
 
   return sInstance->CanHold(aSize);
 }
 
-/* static */ void SurfaceCache::SurfaceAvailable(
-    NotNull<ISurfaceProvider*> aProvider) {
+/* static */
+void SurfaceCache::SurfaceAvailable(NotNull<ISurfaceProvider*> aProvider) {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (!sInstance) {
     return;
   }
 
   sInstance->SurfaceAvailable(aProvider, lock);
 }
 
-/* static */ void SurfaceCache::LockImage(const ImageKey aImageKey) {
+/* static */
+void SurfaceCache::LockImage(const ImageKey aImageKey) {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (sInstance) {
     return sInstance->LockImage(aImageKey);
   }
 }
 
-/* static */ void SurfaceCache::UnlockImage(const ImageKey aImageKey) {
+/* static */
+void SurfaceCache::UnlockImage(const ImageKey aImageKey) {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (sInstance) {
     return sInstance->UnlockImage(aImageKey, lock);
   }
 }
 
-/* static */ void SurfaceCache::UnlockEntries(const ImageKey aImageKey) {
+/* static */
+void SurfaceCache::UnlockEntries(const ImageKey aImageKey) {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (sInstance) {
     return sInstance->UnlockEntries(aImageKey, lock);
   }
 }
 
-/* static */ void SurfaceCache::RemoveImage(const ImageKey aImageKey) {
+/* static */
+void SurfaceCache::RemoveImage(const ImageKey aImageKey) {
   RefPtr<ImageSurfaceCache> discard;
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (sInstance) {
       discard = sInstance->RemoveImage(aImageKey, lock);
     }
   }
 }
 
-/* static */ void SurfaceCache::PruneImage(const ImageKey aImageKey) {
+/* static */
+void SurfaceCache::PruneImage(const ImageKey aImageKey) {
   nsTArray<RefPtr<CachedSurface>> discard;
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (sInstance) {
       sInstance->PruneImage(aImageKey, lock);
       sInstance->TakeDiscard(discard, lock);
     }
   }
 }
 
-/* static */ void SurfaceCache::DiscardAll() {
+/* static */
+void SurfaceCache::DiscardAll() {
   nsTArray<RefPtr<CachedSurface>> discard;
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (sInstance) {
       sInstance->DiscardAll(lock);
       sInstance->TakeDiscard(discard, lock);
     }
   }
 }
 
-/* static */ void SurfaceCache::CollectSizeOfSurfaces(
+/* static */
+void SurfaceCache::CollectSizeOfSurfaces(
     const ImageKey aImageKey, nsTArray<SurfaceMemoryCounter>& aCounters,
     MallocSizeOf aMallocSizeOf) {
   nsTArray<RefPtr<CachedSurface>> discard;
   {
     StaticMutexAutoLock lock(sInstanceMutex);
     if (!sInstance) {
       return;
     }
 
     sInstance->CollectSizeOfSurfaces(aImageKey, aCounters, aMallocSizeOf, lock);
     sInstance->TakeDiscard(discard, lock);
   }
 }
 
-/* static */ size_t SurfaceCache::MaximumCapacity() {
+/* static */
+size_t SurfaceCache::MaximumCapacity() {
   StaticMutexAutoLock lock(sInstanceMutex);
   if (!sInstance) {
     return 0;
   }
 
   return sInstance->MaximumCapacity();
 }
 
-/* static */ bool SurfaceCache::IsLegalSize(const IntSize& aSize) {
+/* static */
+bool SurfaceCache::IsLegalSize(const IntSize& aSize) {
   // reject over-wide or over-tall images
   const int32_t k64KLimit = 0x0000FFFF;
   if (MOZ_UNLIKELY(aSize.width > k64KLimit || aSize.height > k64KLimit)) {
     NS_WARNING("image too big");
     return false;
   }
 
   // protect against invalid sizes
--- a/image/SurfaceCacheUtils.cpp
+++ b/image/SurfaceCacheUtils.cpp
@@ -5,14 +5,13 @@
 
 #include "SurfaceCacheUtils.h"
 
 #include "SurfaceCache.h"
 
 namespace mozilla {
 namespace image {
 
-/* static */ void SurfaceCacheUtils::DiscardAll() {
-  SurfaceCache::DiscardAll();
-}
+/* static */
+void SurfaceCacheUtils::DiscardAll() { SurfaceCache::DiscardAll(); }
 
 }  // namespace image
 }  // namespace mozilla
--- a/image/encoders/jpeg/nsJPEGEncoder.cpp
+++ b/image/encoders/jpeg/nsJPEGEncoder.cpp
@@ -413,31 +413,31 @@ void nsJPEGEncoder::NotifyListener() {
     mCallback = nullptr;
     mCallbackTarget = nullptr;
     mNotifyThreshold = 0;
 
     callback->OnInputStreamReady(this);
   }
 }
 
-/* static */ void nsJPEGEncoderInternal::initDestination(
-    jpeg_compress_struct* cinfo) {
+/* static */
+void nsJPEGEncoderInternal::initDestination(jpeg_compress_struct* cinfo) {
   nsJPEGEncoder* that = static_cast<nsJPEGEncoder*>(cinfo->client_data);
   NS_ASSERTION(!that->mImageBuffer, "Image buffer already initialized");
 
   that->mImageBufferSize = 8192;
   that->mImageBuffer = (uint8_t*)malloc(that->mImageBufferSize);
   that->mImageBufferUsed = 0;
 
   cinfo->dest->next_output_byte = that->mImageBuffer;
   cinfo->dest->free_in_buffer = that->mImageBufferSize;
 }
 
-/* static */ boolean nsJPEGEncoderInternal::emptyOutputBuffer(
-    jpeg_compress_struct* cinfo) {
+/* static */
+boolean nsJPEGEncoderInternal::emptyOutputBuffer(jpeg_compress_struct* cinfo) {
   nsJPEGEncoder* that = static_cast<nsJPEGEncoder*>(cinfo->client_data);
   NS_ASSERTION(that->mImageBuffer, "No buffer to empty!");
 
   // When we're reallocing the buffer we need to take the lock to ensure
   // that nobody is trying to read from the buffer we are destroying
   ReentrantMonitorAutoEnter autoEnter(that->mReentrantMonitor);
 
   that->mImageBufferUsed = that->mImageBufferSize;
@@ -462,29 +462,30 @@ void nsJPEGEncoder::NotifyListener() {
   }
   that->mImageBuffer = newBuf;
 
   cinfo->dest->next_output_byte = &that->mImageBuffer[that->mImageBufferUsed];
   cinfo->dest->free_in_buffer = that->mImageBufferSize - that->mImageBufferUsed;
   return 1;
 }
 
-/* static */ void nsJPEGEncoderInternal::termDestination(
-    jpeg_compress_struct* cinfo) {
+/* static */
+void nsJPEGEncoderInternal::termDestination(jpeg_compress_struct* cinfo) {
   nsJPEGEncoder* that = static_cast<nsJPEGEncoder*>(cinfo->client_data);
   if (!that->mImageBuffer) {
     return;
   }
   that->mImageBufferUsed = cinfo->dest->next_output_byte - that->mImageBuffer;
   NS_ASSERTION(that->mImageBufferUsed < that->mImageBufferSize,
                "JPEG library busted, got a bad image buffer size");
   that->NotifyListener();
 }
 
-/* static */ void nsJPEGEncoderInternal::errorExit(jpeg_common_struct* cinfo) {
+/* static */
+void nsJPEGEncoderInternal::errorExit(jpeg_common_struct* cinfo) {
   nsresult error_code;
   encoder_error_mgr* err = (encoder_error_mgr*)cinfo->err;
 
   // Convert error to a browser error code
   switch (cinfo->err->msg_code) {
     case JERR_OUT_OF_MEMORY:
       error_code = NS_ERROR_OUT_OF_MEMORY;
       break;
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -909,17 +909,18 @@ static nsresult NewImageChannel(
   if (childLoadGroup) {
     childLoadGroup->SetParentLoadGroup(aLoadGroup);
   }
   (*aResult)->SetLoadGroup(loadGroup);
 
   return NS_OK;
 }
 
-/* static */ uint32_t imgCacheEntry::SecondsFromPRTime(PRTime prTime) {
+/* static */
+uint32_t imgCacheEntry::SecondsFromPRTime(PRTime prTime) {
   return uint32_t(int64_t(prTime) / int64_t(PR_USEC_PER_SEC));
 }
 
 imgCacheEntry::imgCacheEntry(imgLoader* loader, imgRequest* request,
                              bool forcePrincipalCheck)
     : mLoader(loader),
       mRequest(request),
       mDataSize(0),
@@ -1153,17 +1154,18 @@ uint32_t imgLoader::sCacheMaxSize;
 imgMemoryReporter* imgLoader::sMemReporter;
 
 NS_IMPL_ISUPPORTS(imgLoader, imgILoader, nsIContentSniffer, imgICache,
                   nsISupportsWeakReference, nsIObserver)
 
 static imgLoader* gNormalLoader = nullptr;
 static imgLoader* gPrivateBrowsingLoader = nullptr;
 
-/* static */ already_AddRefed<imgLoader> imgLoader::CreateImageLoader() {
+/* static */
+already_AddRefed<imgLoader> imgLoader::CreateImageLoader() {
   // In some cases, such as xpctests, XPCOM modules are not automatically
   // initialized.  We need to make sure that our module is initialized before
   // we hand out imgLoader instances and code starts using them.
   mozilla::image::EnsureModuleInitialized();
 
   RefPtr<imgLoader> loader = new imgLoader();
   loader->Init();