Skip to content

Commit

Permalink
Bug 1523969 part 10 - Move method definition inline comments to new l…
Browse files Browse the repository at this point in the history
…ine in 'image/'. r=aosmond

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

--HG--
extra : rebase_source : 9898cccd7791d12b8ece17fa489b530fffd89ff6
  • Loading branch information
eqrion committed Feb 25, 2019
1 parent c355a03 commit 1b09808
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 102 deletions.
15 changes: 10 additions & 5 deletions image/DecodePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ 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)

Expand Down Expand Up @@ -309,13 +311,15 @@ bool DecodePoolImpl::CreateThread() {
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();
Expand All @@ -325,7 +329,8 @@ bool DecodePoolImpl::CreateThread() {
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.
Expand Down
47 changes: 26 additions & 21 deletions image/DecoderFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ 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;

Expand Down Expand Up @@ -80,8 +81,10 @@ namespace image {
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) {
Expand Down Expand Up @@ -119,7 +122,8 @@ namespace image {
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,
Expand Down Expand Up @@ -173,7 +177,8 @@ namespace image {
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,
Expand Down Expand Up @@ -227,7 +232,8 @@ namespace image {
return NS_OK;
}

/* static */ already_AddRefed<Decoder> DecoderFactory::CloneAnimationDecoder(
/* static */
already_AddRefed<Decoder> DecoderFactory::CloneAnimationDecoder(
Decoder* aDecoder) {
MOZ_ASSERT(aDecoder);

Expand Down Expand Up @@ -257,10 +263,10 @@ namespace image {
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;
}
Expand All @@ -281,14 +287,12 @@ DecoderFactory::CreateMetadataDecoder(DecoderType aType,
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) {
Expand Down Expand Up @@ -330,7 +334,8 @@ DecoderFactory::CreateDecoderForICOResource(DecoderType aType,
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) {
Expand Down Expand Up @@ -365,8 +370,8 @@ DecoderFactory::CreateDecoderForICOResource(DecoderType aType,
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;
Expand Down
5 changes: 3 additions & 2 deletions image/ImageCacheKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ bool ImageCacheKey::SchemeIs(const char* aScheme) {
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.
Expand Down
21 changes: 13 additions & 8 deletions image/ImageFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
namespace mozilla {
namespace image {

/*static*/ void ImageFactory::Initialize() {}
/*static*/
void ImageFactory::Initialize() {}

static uint32_t ComputeImageFlags(nsIURI* uri, const nsCString& aMimeType,
bool isMultiPart) {
Expand Down Expand Up @@ -104,7 +105,8 @@ static void NotifyImageLoading(nsIURI* aURI) {
}
#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) {
Expand Down Expand Up @@ -141,7 +143,8 @@ static already_AddRefed<Image> BadImage(const char* aMessage,
return aImage.forget();
}

/* static */ already_AddRefed<Image> ImageFactory::CreateAnonymousImage(
/* static */
already_AddRefed<Image> ImageFactory::CreateAnonymousImage(
const nsCString& aMimeType, uint32_t aSizeHint /* = 0 */) {
nsresult rv;

Expand All @@ -164,9 +167,9 @@ static already_AddRefed<Image> BadImage(const char* aMessage,
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);

Expand Down Expand Up @@ -218,7 +221,8 @@ uint32_t GetContentSize(nsIRequest* aRequest) {
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) {
Expand All @@ -245,7 +249,8 @@ uint32_t GetContentSize(nsIRequest* aRequest) {
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) {
Expand Down
21 changes: 14 additions & 7 deletions image/ImageMemoryReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,34 @@ class ImageMemoryReporter::WebRenderReporter final : public nsIMemoryReporter {

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) {
Expand All @@ -74,7 +78,8 @@ NS_IMPL_ISUPPORTS(ImageMemoryReporter::WebRenderReporter, nsIMemoryReporter)
}
}

/* static */ void ImageMemoryReporter::ReportSharedSurface(
/* static */
void ImageMemoryReporter::ReportSharedSurface(
nsIHandleReportCallback* aHandleReport, nsISupports* aData,
bool aIsForCompositor, uint64_t aExternalId,
const layers::SharedSurfacesMemoryReport::SurfaceEntry& aEntry) {
Expand Down Expand Up @@ -123,7 +128,8 @@ NS_IMPL_ISUPPORTS(ImageMemoryReporter::WebRenderReporter, nsIMemoryReporter)
aData);
}

/* static */ void ImageMemoryReporter::AppendSharedSurfacePrefix(
/* static */
void ImageMemoryReporter::AppendSharedSurfacePrefix(
nsACString& aPathPrefix, const SurfaceMemoryCounter& aCounter,
layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
uint64_t extId = aCounter.Values().ExternalId();
Expand All @@ -148,7 +154,8 @@ NS_IMPL_ISUPPORTS(ImageMemoryReporter::WebRenderReporter, nsIMemoryReporter)
}
}

/* static */ void ImageMemoryReporter::TrimSharedSurfaces(
/* static */
void ImageMemoryReporter::TrimSharedSurfaces(
const ImageMemoryCounter& aCounter,
layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
if (aSharedSurfaces.mSurfaces.empty()) {
Expand Down
42 changes: 25 additions & 17 deletions image/ImageOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,53 @@ 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();
Expand Down Expand Up @@ -134,17 +140,19 @@ ImageOps::CreateImageBuffer(already_AddRefed<nsIInputStream> aInputStream) {
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;
}
Expand Down
4 changes: 2 additions & 2 deletions image/RasterImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1546,8 +1546,8 @@ void RasterImage::DoError() {
("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);
}
Expand Down
Loading

0 comments on commit 1b09808

Please sign in to comment.