From 8144fa3e460c3b2ba3b44d4baa90f094a0396d0f Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Thu, 10 Jul 2014 11:00:31 -0400 Subject: [PATCH] Bug 1037028 - More namespace cleanups in imglib, r=seth --- image/src/ClippedImage.cpp | 9 +++--- image/src/ClippedImage.h | 10 +++--- image/src/DiscardTracker.cpp | 2 +- image/src/DiscardTracker.h | 4 +-- image/src/FrameAnimator.cpp | 9 +++--- image/src/FrameAnimator.h | 6 ++-- image/src/FrameBlender.cpp | 3 -- image/src/FrameBlender.h | 6 ++-- image/src/FrameSequence.cpp | 3 -- image/src/FrameSequence.h | 2 +- image/src/FrozenImage.cpp | 7 +++-- image/src/FrozenImage.h | 4 +-- image/src/Image.h | 6 ++-- image/src/ImageFactory.cpp | 2 +- image/src/ImageMetadata.cpp | 6 +++- image/src/ImageWrapper.cpp | 19 ++++++------ image/src/ImageWrapper.h | 4 +-- image/src/OrientedImage.cpp | 11 ++++--- image/src/OrientedImage.h | 8 ++--- image/src/RasterImage.cpp | 13 ++++---- image/src/RasterImage.h | 3 +- image/src/ScriptedNotificationObserver.cpp | 6 +++- image/src/SurfaceCache.cpp | 8 +++-- image/src/SurfaceCache.h | 6 ++-- image/src/VectorImage.cpp | 12 ++++---- image/src/VectorImage.h | 4 +-- image/src/imgFrame.cpp | 14 ++++++--- image/src/imgFrame.h | 36 ++++++++++++---------- 28 files changed, 119 insertions(+), 104 deletions(-) diff --git a/image/src/ClippedImage.cpp b/image/src/ClippedImage.cpp index f7ec6131a1c..940e28cd8c1 100644 --- a/image/src/ClippedImage.cpp +++ b/image/src/ClippedImage.cpp @@ -13,12 +13,13 @@ #include "Orientation.h" #include "SVGImageContext.h" -using namespace mozilla; -using namespace mozilla::gfx; -using mozilla::layers::LayerManager; -using mozilla::layers::ImageContainer; namespace mozilla { + +using namespace gfx; +using layers::LayerManager; +using layers::ImageContainer; + namespace image { class ClippedImageCachedSurface diff --git a/image/src/ClippedImage.h b/image/src/ClippedImage.h index 1c2534ceb82..1e92dab60e3 100644 --- a/image/src/ClippedImage.h +++ b/image/src/ClippedImage.h @@ -26,7 +26,7 @@ class DrawSingleTileCallback; */ class ClippedImage : public ImageWrapper { - typedef mozilla::gfx::SourceSurface SourceSurface; + typedef gfx::SourceSurface SourceSurface; public: NS_DECL_ISUPPORTS_INHERITED @@ -37,10 +37,10 @@ public: NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE; NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE; NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE; - NS_IMETHOD_(mozilla::TemporaryRef) + NS_IMETHOD_(TemporaryRef) GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE; - NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager, - mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE; + NS_IMETHOD GetImageContainer(layers::LayerManager* aManager, + layers::ImageContainer** _retval) MOZ_OVERRIDE; NS_IMETHOD Draw(gfxContext* aContext, GraphicsFilter aFilter, const gfxMatrix& aUserSpaceToImageSpace, @@ -60,7 +60,7 @@ protected: virtual ~ClippedImage(); private: - mozilla::TemporaryRef + TemporaryRef GetFrameInternal(const nsIntSize& aViewportSize, const SVGImageContext* aSVGContext, uint32_t aWhichFrame, diff --git a/image/src/DiscardTracker.cpp b/image/src/DiscardTracker.cpp index 1772948e431..0dfac6a78fb 100644 --- a/image/src/DiscardTracker.cpp +++ b/image/src/DiscardTracker.cpp @@ -24,7 +24,7 @@ static const char* sDiscardTimeoutPref = "image.mem.min_discard_timeout_ms"; /* static */ uint32_t DiscardTracker::sMaxDecodedImageKB = 42 * 1024; /* static */ uint32_t DiscardTracker::sHardLimitDecodedImageKB = 0; /* static */ PRLock * DiscardTracker::sAllocationLock = nullptr; -/* static */ mozilla::Mutex* DiscardTracker::sNodeListMutex = nullptr; +/* static */ Mutex* DiscardTracker::sNodeListMutex = nullptr; /* static */ Atomic DiscardTracker::sShutdown(false); /* diff --git a/image/src/DiscardTracker.h b/image/src/DiscardTracker.h index 7b11b9f503a..1a12b19d062 100644 --- a/image/src/DiscardTracker.h +++ b/image/src/DiscardTracker.h @@ -123,14 +123,14 @@ class DiscardTracker static nsCOMPtr sTimer; static bool sInitialized; static bool sTimerOn; - static mozilla::Atomic sDiscardRunnablePending; + static Atomic sDiscardRunnablePending; static uint64_t sCurrentDecodedImageBytes; static uint32_t sMinDiscardTimeoutMs; static uint32_t sMaxDecodedImageKB; static uint32_t sHardLimitDecodedImageKB; // Lock for safegarding the 64-bit sCurrentDecodedImageBytes static PRLock *sAllocationLock; - static mozilla::Mutex* sNodeListMutex; + static Mutex* sNodeListMutex; static Atomic sShutdown; }; diff --git a/image/src/FrameAnimator.cpp b/image/src/FrameAnimator.cpp index e38577a8f7a..ef866ecdcfb 100644 --- a/image/src/FrameAnimator.cpp +++ b/image/src/FrameAnimator.cpp @@ -8,8 +8,8 @@ #include "imgIContainer.h" -using namespace mozilla::image; -using namespace mozilla; +namespace mozilla { +namespace image { FrameAnimator::FrameAnimator(FrameBlender& aFrameBlender, uint16_t aAnimationMode) @@ -177,7 +177,7 @@ FrameAnimator::AdvanceFrame(TimeStamp aTime) } FrameAnimator::RefreshResult -FrameAnimator::RequestRefresh(const mozilla::TimeStamp& aTime) +FrameAnimator::RequestRefresh(const TimeStamp& aTime) { // only advance the frame if the current time is greater than or // equal to the current frame's end time. @@ -263,4 +263,5 @@ FrameAnimator::GetFirstFrameRefreshArea() const return mFirstFrameRefreshArea; } - +} // namespace image +} // namespace mozilla diff --git a/image/src/FrameAnimator.h b/image/src/FrameAnimator.h index d792cd6829f..df39ff7ec4c 100644 --- a/image/src/FrameAnimator.h +++ b/image/src/FrameAnimator.h @@ -61,7 +61,7 @@ public: * Returns the result of that blending, including whether the current frame * changed and what the resulting dirty rectangle is. */ - RefreshResult RequestRefresh(const mozilla::TimeStamp& aTime); + RefreshResult RequestRefresh(const TimeStamp& aTime); /** * Call when this image is finished decoding so we know that there aren't any @@ -136,14 +136,14 @@ private: // methods * @returns a RefreshResult that shows whether the frame was successfully * advanced, and its resulting dirty rect. */ - RefreshResult AdvanceFrame(mozilla::TimeStamp aTime); + RefreshResult AdvanceFrame(TimeStamp aTime); /** * Get the time the frame we're currently displaying is supposed to end. * * In the error case, returns an "infinity" timestamp. */ - mozilla::TimeStamp GetCurrentImgFrameEndTime() const; + TimeStamp GetCurrentImgFrameEndTime() const; private: // data //! Area of the first frame that needs to be redrawn on subsequent loops. diff --git a/image/src/FrameBlender.cpp b/image/src/FrameBlender.cpp index 712a5a8001d..64c188c0b45 100644 --- a/image/src/FrameBlender.cpp +++ b/image/src/FrameBlender.cpp @@ -10,9 +10,6 @@ #include "pixman.h" -using namespace mozilla; -using namespace mozilla::image; - namespace mozilla { namespace image { diff --git a/image/src/FrameBlender.h b/image/src/FrameBlender.h index 94ecf6761ee..3a922ebfab2 100644 --- a/image/src/FrameBlender.h +++ b/image/src/FrameBlender.h @@ -12,11 +12,11 @@ #include "FrameSequence.h" #include "nsCOMPtr.h" -class imgFrame; - namespace mozilla { namespace image { +class imgFrame; + /** * FrameBlender stores and gives access to imgFrames. It also knows how to * blend frames from previous to next, looping if necessary. @@ -78,7 +78,7 @@ public: void SetSize(nsIntSize aSize) { mSize = aSize; } size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxMemoryLocation aLocation, - mozilla::MallocSizeOf aMallocSizeOf) const; + MallocSizeOf aMallocSizeOf) const; void ResetAnimation(); diff --git a/image/src/FrameSequence.cpp b/image/src/FrameSequence.cpp index ef666110f36..544bb51deae 100644 --- a/image/src/FrameSequence.cpp +++ b/image/src/FrameSequence.cpp @@ -5,9 +5,6 @@ #include "FrameSequence.h" -using namespace mozilla; -using namespace mozilla::image; - namespace mozilla { namespace image { diff --git a/image/src/FrameSequence.h b/image/src/FrameSequence.h index 697c6d146d8..f281201706d 100644 --- a/image/src/FrameSequence.h +++ b/image/src/FrameSequence.h @@ -174,7 +174,7 @@ public: uint32_t GetNumFrames() const; size_t SizeOfDecodedWithComputedFallbackIfHeap(gfxMemoryLocation aLocation, - mozilla::MallocSizeOf aMallocSizeOf) const; + MallocSizeOf aMallocSizeOf) const; private: // data //! All the frames of the image diff --git a/image/src/FrozenImage.cpp b/image/src/FrozenImage.cpp index 2cc5866bea8..add73dd38fe 100644 --- a/image/src/FrozenImage.cpp +++ b/image/src/FrozenImage.cpp @@ -5,9 +5,10 @@ #include "FrozenImage.h" -using namespace mozilla::gfx; - namespace mozilla { + +using namespace gfx; + namespace image { NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper) @@ -86,7 +87,7 @@ FrozenImage::Draw(gfxContext* aContext, } NS_IMETHODIMP_(void) -FrozenImage::RequestRefresh(const mozilla::TimeStamp& aTime) +FrozenImage::RequestRefresh(const TimeStamp& aTime) { // Do nothing. } diff --git a/image/src/FrozenImage.h b/image/src/FrozenImage.h index d59c0a5decf..8fc99faf573 100644 --- a/image/src/FrozenImage.h +++ b/image/src/FrozenImage.h @@ -26,7 +26,7 @@ namespace image { */ class FrozenImage : public ImageWrapper { - typedef mozilla::gfx::SourceSurface SourceSurface; + typedef gfx::SourceSurface SourceSurface; public: NS_DECL_ISUPPORTS_INHERITED @@ -50,7 +50,7 @@ public: const SVGImageContext* aSVGContext, uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE; - NS_IMETHOD_(void) RequestRefresh(const mozilla::TimeStamp& aTime) MOZ_OVERRIDE; + NS_IMETHOD_(void) RequestRefresh(const TimeStamp& aTime) MOZ_OVERRIDE; NS_IMETHOD GetAnimationMode(uint16_t* aAnimationMode) MOZ_OVERRIDE; NS_IMETHOD SetAnimationMode(uint16_t aAnimationMode) MOZ_OVERRIDE; NS_IMETHOD ResetAnimation() MOZ_OVERRIDE; diff --git a/image/src/Image.h b/image/src/Image.h index 7e063ed05b8..7579ef02ec3 100644 --- a/image/src/Image.h +++ b/image/src/Image.h @@ -80,8 +80,8 @@ public: /** * The components that make up SizeOfData(). */ - virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0; - virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const = 0; + virtual size_t HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const = 0; + virtual size_t HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const = 0; virtual size_t NonHeapSizeOfDecoded() const = 0; virtual size_t OutOfProcessSizeOfDecoded() const = 0; @@ -195,7 +195,7 @@ protected: * * Otherwise, this method updates mLastRefreshTime to aTime & returns false. */ - bool HadRecentRefresh(const mozilla::TimeStamp& aTime); + bool HadRecentRefresh(const TimeStamp& aTime); /** * Decides whether animation should or should not be happening, diff --git a/image/src/ImageFactory.cpp b/image/src/ImageFactory.cpp index 2daba132914..f2913aa55b4 100644 --- a/image/src/ImageFactory.cpp +++ b/image/src/ImageFactory.cpp @@ -236,7 +236,7 @@ ImageFactory::CreateRasterImage(nsIRequest* aRequest, nsAutoCString ref; aURI->GetRef(ref); - mozilla::net::nsMediaFragmentURIParser parser(ref); + net::nsMediaFragmentURIParser parser(ref); if (parser.HasResolution()) { newImage->SetRequestedResolution(parser.GetResolution()); } diff --git a/image/src/ImageMetadata.cpp b/image/src/ImageMetadata.cpp index 5b4b0495c1d..cb74600802d 100644 --- a/image/src/ImageMetadata.cpp +++ b/image/src/ImageMetadata.cpp @@ -11,7 +11,8 @@ #include "nsISupportsPrimitives.h" #include "nsXPCOMCID.h" -using namespace mozilla::image; +namespace mozilla { +namespace image { void ImageMetadata::SetOnImage(RasterImage* image) @@ -31,3 +32,6 @@ ImageMetadata::SetOnImage(RasterImage* image) image->SetFrameAsNonPremult(i, mIsNonPremultiplied); } } + +} // namespace image +} // namespace mozilla diff --git a/image/src/ImageWrapper.cpp b/image/src/ImageWrapper.cpp index d345e6859a8..07463089bf4 100644 --- a/image/src/ImageWrapper.cpp +++ b/image/src/ImageWrapper.cpp @@ -10,12 +10,13 @@ #include "mozilla/MemoryReporting.h" -using mozilla::gfx::DataSourceSurface; -using mozilla::gfx::SourceSurface; -using mozilla::layers::LayerManager; -using mozilla::layers::ImageContainer; - namespace mozilla { + +using gfx::DataSourceSurface; +using gfx::SourceSurface; +using layers::LayerManager; +using layers::ImageContainer; + namespace image { // Inherited methods from Image. @@ -45,13 +46,13 @@ ImageWrapper::SizeOfData() } size_t -ImageWrapper::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const +ImageWrapper::HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const { return mInnerImage->HeapSizeOfSourceWithComputedFallback(aMallocSizeOf); } size_t -ImageWrapper::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const +ImageWrapper::HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const { return mInnerImage->HeapSizeOfDecodedWithComputedFallback(aMallocSizeOf); } @@ -276,7 +277,7 @@ ImageWrapper::RequestDiscard() } NS_IMETHODIMP_(void) -ImageWrapper::RequestRefresh(const mozilla::TimeStamp& aTime) +ImageWrapper::RequestRefresh(const TimeStamp& aTime) { return mInnerImage->RequestRefresh(aTime); } @@ -312,7 +313,7 @@ ImageWrapper::GetFirstFrameDelay() } NS_IMETHODIMP_(void) -ImageWrapper::SetAnimationStartTime(const mozilla::TimeStamp& aTime) +ImageWrapper::SetAnimationStartTime(const TimeStamp& aTime) { mInnerImage->SetAnimationStartTime(aTime); } diff --git a/image/src/ImageWrapper.h b/image/src/ImageWrapper.h index f35d554b5a1..071dbff72be 100644 --- a/image/src/ImageWrapper.h +++ b/image/src/ImageWrapper.h @@ -28,8 +28,8 @@ public: virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE; virtual uint32_t SizeOfData() MOZ_OVERRIDE; - virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; - virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; + virtual size_t HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; virtual size_t NonHeapSizeOfDecoded() const MOZ_OVERRIDE; virtual size_t OutOfProcessSizeOfDecoded() const MOZ_OVERRIDE; diff --git a/image/src/OrientedImage.cpp b/image/src/OrientedImage.cpp index 634e21ca99e..9f697909e52 100644 --- a/image/src/OrientedImage.cpp +++ b/image/src/OrientedImage.cpp @@ -11,13 +11,14 @@ #include "OrientedImage.h" -using namespace mozilla::gfx; - using std::swap; -using mozilla::layers::LayerManager; -using mozilla::layers::ImageContainer; namespace mozilla { + +using namespace gfx; +using layers::LayerManager; +using layers::ImageContainer; + namespace image { NS_IMPL_ISUPPORTS_INHERITED0(OrientedImage, ImageWrapper) @@ -107,7 +108,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame, } // Create a surface to draw into. - mozilla::RefPtr target = + RefPtr target = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(IntSize(width, height), surfaceFormat); if (!target) { diff --git a/image/src/OrientedImage.h b/image/src/OrientedImage.h index 46981fa7896..731e1abf484 100644 --- a/image/src/OrientedImage.h +++ b/image/src/OrientedImage.h @@ -23,7 +23,7 @@ namespace image { */ class OrientedImage : public ImageWrapper { - typedef mozilla::gfx::SourceSurface SourceSurface; + typedef gfx::SourceSurface SourceSurface; public: NS_DECL_ISUPPORTS_INHERITED @@ -34,10 +34,10 @@ public: NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE; NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE; NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE; - NS_IMETHOD_(mozilla::TemporaryRef) + NS_IMETHOD_(TemporaryRef) GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE; - NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager, - mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE; + NS_IMETHOD GetImageContainer(layers::LayerManager* aManager, + layers::ImageContainer** _retval) MOZ_OVERRIDE; NS_IMETHOD Draw(gfxContext* aContext, GraphicsFilter aFilter, const gfxMatrix& aUserSpaceToImageSpace, diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 8c0960e5ef0..7ede9adbd14 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -53,10 +53,12 @@ #include "ipc/Nuwa.h" #endif -using namespace mozilla; -using namespace mozilla::gfx; -using namespace mozilla::image; -using namespace mozilla::layers; +namespace mozilla { + +using namespace gfx; +using namespace layers; + +namespace image { // a mask for flags that will affect the decoding #define DECODE_FLAGS_MASK (imgIContainer::FLAG_DECODE_NO_PREMULTIPLY_ALPHA | imgIContainer::FLAG_DECODE_NO_COLORSPACE_CONVERSION) @@ -371,9 +373,6 @@ private: nsAutoPtr mScaleRequest; }; -namespace mozilla { -namespace image { - /* static */ StaticRefPtr RasterImage::DecodePool::sSingleton; static nsCOMPtr sScaleWorkerThread = nullptr; diff --git a/image/src/RasterImage.h b/image/src/RasterImage.h index f5f4b724b41..e16af7b2bbd 100644 --- a/image/src/RasterImage.h +++ b/image/src/RasterImage.h @@ -121,8 +121,6 @@ class nsIRequest; * it's not allocated until the second frame is added. */ -class ScaleRequest; - namespace mozilla { namespace layers { @@ -133,6 +131,7 @@ class Image; namespace image { +class ScaleRequest; class Decoder; class FrameAnimator; diff --git a/image/src/ScriptedNotificationObserver.cpp b/image/src/ScriptedNotificationObserver.cpp index e39acf3e167..76ab798be54 100644 --- a/image/src/ScriptedNotificationObserver.cpp +++ b/image/src/ScriptedNotificationObserver.cpp @@ -8,7 +8,8 @@ #include "imgIScriptedNotificationObserver.h" #include "nsCycleCollectionParticipant.h" -using namespace mozilla::image; +namespace mozilla { +namespace image { NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner) @@ -47,3 +48,6 @@ ScriptedNotificationObserver::Notify(imgIRequest* aRequest, return mInner->IsAnimated(aRequest); return NS_OK; } + +} // namespace image +} // namespace mozilla diff --git a/image/src/SurfaceCache.cpp b/image/src/SurfaceCache.cpp index 946501888d5..c1c327afbf6 100644 --- a/image/src/SurfaceCache.cpp +++ b/image/src/SurfaceCache.cpp @@ -31,9 +31,11 @@ using std::max; using std::min; -using namespace mozilla::gfx; namespace mozilla { + +using namespace gfx; + namespace image { class CachedSurface; @@ -218,7 +220,7 @@ public: , mMaxCost(aSurfaceCacheSize) , mAvailableCost(aSurfaceCacheSize) { - nsCOMPtr os = mozilla::services::GetObserverService(); + nsCOMPtr os = services::GetObserverService(); if (os) os->AddObserver(mMemoryPressureObserver, "memory-pressure", false); } @@ -226,7 +228,7 @@ public: private: virtual ~SurfaceCacheImpl() { - nsCOMPtr os = mozilla::services::GetObserverService(); + nsCOMPtr os = services::GetObserverService(); if (os) os->RemoveObserver(mMemoryPressureObserver, "memory-pressure"); diff --git a/image/src/SurfaceCache.h b/image/src/SurfaceCache.h index 63976cfec2a..83c6718fb6e 100644 --- a/image/src/SurfaceCache.h +++ b/image/src/SurfaceCache.h @@ -135,9 +135,9 @@ struct SurfaceCache * @param aImageKey Key data identifying which image the surface belongs to. * @param aSurfaceKey Key data which uniquely identifies the requested surface. */ - static void Insert(mozilla::gfx::DrawTarget* aTarget, - const ImageKey aImageKey, - const SurfaceKey& aSurfaceKey); + static void Insert(gfx::DrawTarget* aTarget, + const ImageKey aImageKey, + const SurfaceKey& aSurfaceKey); /* * Checks if a surface of a given size could possibly be stored in the cache. diff --git a/image/src/VectorImage.cpp b/image/src/VectorImage.cpp index f6d45898b92..aa39853e9a1 100644 --- a/image/src/VectorImage.cpp +++ b/image/src/VectorImage.cpp @@ -364,7 +364,7 @@ VectorImage::FrameRect(uint32_t aWhichFrame) } size_t -VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const +VectorImage::HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const { // We're not storing the source data -- we just feed that directly to // our helper SVG document as we receive it, for it to parse. @@ -376,7 +376,7 @@ VectorImage::HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocS } size_t -VectorImage::HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const +VectorImage::HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const { // If implementing this, we'll need to restructure our callers to make sure // any amount we return is attributed to the vector images measure (i.e. @@ -503,7 +503,7 @@ VectorImage::ShouldAnimate() } NS_IMETHODIMP_(void) -VectorImage::SetAnimationStartTime(const mozilla::TimeStamp& aTime) +VectorImage::SetAnimationStartTime(const TimeStamp& aTime) { // We don't care about animation start time. } @@ -533,7 +533,7 @@ VectorImage::GetWidth(int32_t* aWidth) //****************************************************************************** /* [notxpcom] void requestRefresh ([const] in TimeStamp aTime); */ NS_IMETHODIMP_(void) -VectorImage::RequestRefresh(const mozilla::TimeStamp& aTime) +VectorImage::RequestRefresh(const TimeStamp& aTime) { if (HadRecentRefresh(aTime)) { return; @@ -755,7 +755,7 @@ VectorImage::GetFrame(uint32_t aWhichFrame, /* [noscript] ImageContainer getImageContainer(); */ NS_IMETHODIMP VectorImage::GetImageContainer(LayerManager* aManager, - mozilla::layers::ImageContainer** _retval) + layers::ImageContainer** _retval) { *_retval = nullptr; return NS_OK; @@ -915,7 +915,7 @@ VectorImage::CreateDrawableAndShow(const SVGDrawingParameters& aParams) return Show(svgDrawable, aParams); // Try to create an offscreen surface. - mozilla::RefPtr target = + RefPtr target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size(), gfx::SurfaceFormat::B8G8R8A8); // If we couldn't create the draw target, it was probably because it would end diff --git a/image/src/VectorImage.h b/image/src/VectorImage.h index 2d77de251c5..29677bd4c0a 100644 --- a/image/src/VectorImage.h +++ b/image/src/VectorImage.h @@ -42,8 +42,8 @@ public: uint32_t aFlags); virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE; - virtual size_t HeapSizeOfSourceWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const; - virtual size_t HeapSizeOfDecodedWithComputedFallback(mozilla::MallocSizeOf aMallocSizeOf) const; + virtual size_t HeapSizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const; + virtual size_t HeapSizeOfDecodedWithComputedFallback(MallocSizeOf aMallocSizeOf) const; virtual size_t NonHeapSizeOfDecoded() const; virtual size_t OutOfProcessSizeOfDecoded() const; diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index e0c8c041409..662218f2b36 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -23,9 +23,12 @@ static bool gDisableOptimize = false; #include "mozilla/CheckedInt.h" #include "mozilla/gfx/Tools.h" -using namespace mozilla; -using namespace mozilla::gfx; -using namespace mozilla::image; + +namespace mozilla { + +using namespace gfx; + +namespace image { static UserDataKey kVolatileBuffer; @@ -750,7 +753,7 @@ void imgFrame::SetCompositingFailed(bool val) // |aMallocSizeOf|. If that fails (because the platform doesn't support it) or // it's non-heap memory, we fall back to computing the size analytically. size_t -imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocation, mozilla::MallocSizeOf aMallocSizeOf) const +imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocation, MallocSizeOf aMallocSizeOf) const { // aMallocSizeOf is only used if aLocation==gfxMemoryLocation::IN_PROCESS_HEAP. It // should be nullptr otherwise. @@ -787,3 +790,6 @@ imgFrame::SizeOfExcludingThisWithComputedFallbackIfHeap(gfxMemoryLocation aLocat return n; } + +} // namespace image +} // namespace mozilla diff --git a/image/src/imgFrame.h b/image/src/imgFrame.h index cd88d69b6b2..6012e741e17 100644 --- a/image/src/imgFrame.h +++ b/image/src/imgFrame.h @@ -13,13 +13,16 @@ #include "gfxDrawable.h" #include "imgIContainer.h" +namespace mozilla { +namespace image { + class imgFrame { - typedef mozilla::gfx::Color Color; - typedef mozilla::gfx::DataSourceSurface DataSourceSurface; - typedef mozilla::gfx::IntSize IntSize; - typedef mozilla::gfx::SourceSurface SourceSurface; - typedef mozilla::gfx::SurfaceFormat SurfaceFormat; + typedef gfx::Color Color; + typedef gfx::DataSourceSurface DataSourceSurface; + typedef gfx::IntSize IntSize; + typedef gfx::SourceSurface SourceSurface; + typedef gfx::SurfaceFormat SurfaceFormat; public: imgFrame(); @@ -67,7 +70,7 @@ public: void SetDiscardable(); - mozilla::TemporaryRef GetSurface(); + TemporaryRef GetSurface(); Color SinglePixelColor() @@ -80,11 +83,11 @@ public: return mSinglePixel; } - mozilla::TemporaryRef CachedSurface(); + TemporaryRef CachedSurface(); size_t SizeOfExcludingThisWithComputedFallbackIfHeap( gfxMemoryLocation aLocation, - mozilla::MallocSizeOf aMallocSizeOf) const; + MallocSizeOf aMallocSizeOf) const; uint8_t GetPaletteDepth() const { return mPaletteDepth; } uint32_t PaletteDataLength() const { @@ -117,15 +120,15 @@ private: // methods SourceSurface* aSurface); private: // data - mozilla::RefPtr mImageSurface; - mozilla::RefPtr mOptSurface; + RefPtr mImageSurface; + RefPtr mOptSurface; IntSize mSize; nsIntPoint mOffset; nsIntRect mDecoded; - mutable mozilla::Mutex mDecodedMutex; + mutable Mutex mDecodedMutex; // The palette and image data for images that are paletted, since Cairo // doesn't support these images. @@ -142,8 +145,8 @@ private: // data /** Indicates how many readers currently have locked this frame */ int32_t mLockCount; - mozilla::RefPtr mVBuf; - mozilla::VolatileBufferPtr mVBufPtr; + RefPtr mVBuf; + VolatileBufferPtr mVBufPtr; SurfaceFormat mFormat; uint8_t mPaletteDepth; @@ -157,8 +160,6 @@ private: // data bool mInformedDiscardTracker; }; -namespace mozilla { -namespace image { // An RAII class to ensure it's easy to balance locks and unlocks on // imgFrames. class AutoFrameLocker @@ -183,7 +184,8 @@ namespace image { imgFrame* mFrame; bool mSucceeded; }; -} -} + +} // namespace image +} // namespace mozilla #endif /* imgFrame_h */