From a60b979b8e79fe939a4dd422bca3811baa966541 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 7 Mar 2013 11:07:12 -0500 Subject: [PATCH 01/11] Bug 824647 - delete histograms when StatisticsRecorder is deleted; r=jlebar --- ipc/chromium/src/base/histogram.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ipc/chromium/src/base/histogram.cc b/ipc/chromium/src/base/histogram.cc index f0794475e8d5..819d901772a8 100644 --- a/ipc/chromium/src/base/histogram.cc +++ b/ipc/chromium/src/base/histogram.cc @@ -96,7 +96,6 @@ Histogram* Histogram::FactoryGet(const std::string& name, // Extra variable is not needed... but this keeps this section basically // identical to other derived classes in this file (and compiler will // optimize away the extra variable. - // To avoid racy destruction at shutdown, the following will be leaked. Histogram* tentative_histogram = new Histogram(name, minimum, maximum, bucket_count); tentative_histogram->InitializeBucketRange(); @@ -853,7 +852,6 @@ Histogram* LinearHistogram::FactoryGet(const std::string& name, maximum = kSampleType_MAX - 1; if (!StatisticsRecorder::FindHistogram(name, &histogram)) { - // To avoid racy destruction at shutdown, the following will be leaked. LinearHistogram* tentative_histogram = new LinearHistogram(name, minimum, maximum, bucket_count); tentative_histogram->InitializeBucketRange(); @@ -949,7 +947,6 @@ Histogram* BooleanHistogram::FactoryGet(const std::string& name, Flags flags) { Histogram* histogram(NULL); if (!StatisticsRecorder::FindHistogram(name, &histogram)) { - // To avoid racy destruction at shutdown, the following will be leaked. BooleanHistogram* tentative_histogram = new BooleanHistogram(name); tentative_histogram->InitializeBucketRange(); tentative_histogram->SetFlags(flags); @@ -991,7 +988,6 @@ FlagHistogram::FactoryGet(const std::string &name, Flags flags) Histogram *h(nullptr); if (!StatisticsRecorder::FindHistogram(name, &h)) { - // To avoid racy destruction at shutdown, the following will be leaked. FlagHistogram *fh = new FlagHistogram(name); fh->InitializeBucketRange(); fh->SetFlags(flags); @@ -1075,7 +1071,6 @@ Histogram* CustomHistogram::FactoryGet(const std::string& name, DCHECK_LT(ranges.back(), kSampleType_MAX); if (!StatisticsRecorder::FindHistogram(name, &histogram)) { - // To avoid racy destruction at shutdown, the following will be leaked. CustomHistogram* tentative_histogram = new CustomHistogram(name, ranges); tentative_histogram->InitializedCustomBucketRange(ranges); tentative_histogram->SetFlags(flags); @@ -1152,6 +1147,13 @@ StatisticsRecorder::~StatisticsRecorder() { base::AutoLock auto_lock(*lock_); histograms = histograms_; histograms_ = NULL; + for (HistogramMap::iterator it = histograms->begin(); + histograms->end() != it; + ++it) { + // No other clients permanently hold Histogram references, so we + // have the only one and it is safe to delete it. + delete it->second; + } } delete histograms; // We don't delete lock_ on purpose to avoid having to properly protect From 3d05feef6ea28b343308d7357b438d0746b421b4 Mon Sep 17 00:00:00 2001 From: James Willcox Date: Mon, 18 Mar 2013 13:34:43 -0400 Subject: [PATCH 02/11] Bug 829747 - Update WebGL canvases asynchronously r=jgilbert,bgirard --- gfx/gl/GLContext.cpp | 4 +- gfx/gl/GLScreenBuffer.cpp | 52 ++++++++++++++-------- gfx/gl/GLScreenBuffer.h | 4 ++ gfx/gl/SurfaceStream.cpp | 60 ++++++++++++++++++++++---- gfx/gl/SurfaceStream.h | 22 ++++++++-- gfx/gl/SurfaceTypes.h | 1 + gfx/layers/basic/BasicCanvasLayer.cpp | 8 ++-- gfx/layers/basic/BasicLayerManager.cpp | 3 +- gfx/layers/ipc/ShadowLayers.cpp | 10 +++++ gfx/layers/ipc/ShadowLayers.h | 3 ++ gfx/layers/ipc/ShadowLayersParent.cpp | 9 ++-- gfx/layers/opengl/CanvasLayerOGL.cpp | 1 - 12 files changed, 137 insertions(+), 40 deletions(-) diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index f5cfe73e616b..e6913d0d6b68 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -2879,7 +2879,7 @@ GLContext::CreateScreenBufferImpl(const gfxIntSize& size, const SurfaceCaps& cap if (!newScreen) return false; - if (!newScreen->PublishFrame(size)) { + if (!newScreen->Resize(size)) { delete newScreen; return false; } @@ -2901,7 +2901,7 @@ GLContext::ResizeScreenBuffer(const gfxIntSize& size) if (!IsOffscreenSizeAllowed(size)) return false; - return mScreen->PublishFrame(size); + return mScreen->Resize(size); } diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index 5f8560095d5b..aa6247e6d32c 100644 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -325,27 +325,12 @@ GLScreenBuffer::Morph(SurfaceFactory_GL* newFactory, SurfaceStreamType streamTyp mStream = newStream; } -bool -GLScreenBuffer::Swap(const gfxIntSize& size) +void +GLScreenBuffer::Attach(SharedSurface* surface, const gfxIntSize& size) { ScopedBindFramebuffer autoFB(mGL); - SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size); - if (!nextSurf) { - SurfaceFactory_GL* basicFactory = - new SurfaceFactory_Basic(mGL, mFactory->Caps()); - nextSurf = mStream->SwapProducer(basicFactory, size); - if (!nextSurf) { - delete basicFactory; - return false; - } - - // Swap out the apparently defective old factory. - delete mFactory; - mFactory = basicFactory; - } - - SharedSurface_GL* surf = SharedSurface_GL::Cast(nextSurf); + SharedSurface_GL* surf = SharedSurface_GL::Cast(surface); if (mRead && SharedSurf()) SharedSurf()->UnlockProd(); @@ -376,6 +361,27 @@ GLScreenBuffer::Swap(const gfxIntSize& size) if (!PreserveBuffer()) { // DiscardFramebuffer here could help perf on some mobile platforms. } +} + +bool +GLScreenBuffer::Swap(const gfxIntSize& size) +{ + SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size); + if (!nextSurf) { + SurfaceFactory_GL* basicFactory = + new SurfaceFactory_Basic(mGL, mFactory->Caps()); + nextSurf = mStream->SwapProducer(basicFactory, size); + if (!nextSurf) { + delete basicFactory; + return false; + } + + // Swap out the apparently defective old factory. + delete mFactory; + mFactory = basicFactory; + } + + Attach(nextSurf, size); return true; } @@ -389,6 +395,16 @@ GLScreenBuffer::PublishFrame(const gfxIntSize& size) return good; } +bool +GLScreenBuffer::Resize(const gfxIntSize& size) +{ + SharedSurface* surface = mStream->Resize(mFactory, size); + if (!surface) + return false; + + Attach(surface, size); + return true; +} DrawBuffer* GLScreenBuffer::CreateDraw(const gfxIntSize& size) diff --git a/gfx/gl/GLScreenBuffer.h b/gfx/gl/GLScreenBuffer.h index 8f2268a4bae2..0fd6f27b1c71 100644 --- a/gfx/gl/GLScreenBuffer.h +++ b/gfx/gl/GLScreenBuffer.h @@ -265,9 +265,13 @@ protected: public: bool PublishFrame(const gfxIntSize& size); + bool Resize(const gfxIntSize& size); + void Readback(SharedSurface_GL* src, gfxImageSurface* dest); protected: + void Attach(SharedSurface* surface, const gfxIntSize& size); + DrawBuffer* CreateDraw(const gfxIntSize& size); ReadBuffer* CreateRead(SharedSurface_GL* surf); diff --git a/gfx/gl/SurfaceStream.cpp b/gfx/gl/SurfaceStream.cpp index 0442093c5e51..423d948ae1a6 100644 --- a/gfx/gl/SurfaceStream.cpp +++ b/gfx/gl/SurfaceStream.cpp @@ -8,6 +8,7 @@ #include "gfxPoint.h" #include "SharedSurface.h" #include "SurfaceFactory.h" +#include "sampler.h" namespace mozilla { namespace gfx { @@ -20,7 +21,7 @@ SurfaceStream::ChooseGLStreamType(SurfaceStream::OMTC omtc, if (preserveBuffer) return SurfaceStreamType::TripleBuffer_Copy; else - return SurfaceStreamType::TripleBuffer; + return SurfaceStreamType::TripleBuffer_Async; } else { if (preserveBuffer) return SurfaceStreamType::SingleBuffer; @@ -37,6 +38,8 @@ SurfaceStream::CreateForType(SurfaceStreamType type, SurfaceStream* prevStream) return new SurfaceStream_SingleBuffer(prevStream); case SurfaceStreamType::TripleBuffer_Copy: return new SurfaceStream_TripleBuffer_Copy(prevStream); + case SurfaceStreamType::TripleBuffer_Async: + return new SurfaceStream_TripleBuffer_Async(prevStream); case SurfaceStreamType::TripleBuffer: return new SurfaceStream_TripleBuffer(prevStream); default: @@ -158,7 +161,18 @@ SurfaceStream::SwapConsumer() return ret; } +SharedSurface* +SurfaceStream::Resize(SurfaceFactory* factory, const gfxIntSize& size) +{ + MonitorAutoLock lock(mMonitor); + if (mProducer) { + Scrap(mProducer); + } + + New(factory, size, mProducer); + return mProducer; +} SurfaceStream_SingleBuffer::SurfaceStream_SingleBuffer(SurfaceStream* prevStream) : SurfaceStream(SurfaceStreamType::SingleBuffer, prevStream) @@ -200,7 +214,7 @@ SharedSurface* SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { - MutexAutoLock lock(mMutex); + MonitorAutoLock lock(mMonitor); if (mConsumer) { Recycle(factory, mConsumer); } @@ -238,7 +252,7 @@ SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory, SharedSurface* SurfaceStream_SingleBuffer::SwapConsumer_NoWait() { - MutexAutoLock lock(mMutex); + MonitorAutoLock lock(mMonitor); // Use Cons, if present. // Otherwise, just use Prod directly. @@ -293,7 +307,7 @@ SharedSurface* SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { - MutexAutoLock lock(mMutex); + MonitorAutoLock lock(mMonitor); RecycleScraps(factory); if (mProducer) { @@ -323,10 +337,11 @@ SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory, return mProducer; } + SharedSurface* SurfaceStream_TripleBuffer_Copy::SwapConsumer_NoWait() { - MutexAutoLock lock(mMutex); + MonitorAutoLock lock(mMonitor); if (mStaging) { Scrap(mConsumer); @@ -380,13 +395,18 @@ SharedSurface* SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { - MutexAutoLock lock(mMutex); + SAMPLE_LABEL("SurfaceStream_TripleBuffer", "SwapProducer"); + + MonitorAutoLock lock(mMonitor); if (mProducer) { RecycleScraps(factory); - if (mStaging) - Recycle(factory, mStaging); + // If WaitForCompositor succeeds, mStaging has moved to mConsumer. + // If it failed, we might have to scrap it. + if (mStaging && !WaitForCompositor()) + Scrap(mStaging); + MOZ_ASSERT(!mStaging); Move(mProducer, mStaging); mStaging->Fence(); } @@ -400,14 +420,36 @@ SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, SharedSurface* SurfaceStream_TripleBuffer::SwapConsumer_NoWait() { - MutexAutoLock lock(mMutex); + MonitorAutoLock lock(mMonitor); if (mStaging) { Scrap(mConsumer); Move(mStaging, mConsumer); + mMonitor.NotifyAll(); } return mConsumer; } +SurfaceStream_TripleBuffer_Async::SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream) + : SurfaceStream_TripleBuffer(prevStream) +{ +} + +SurfaceStream_TripleBuffer_Async::~SurfaceStream_TripleBuffer_Async() +{ +} + +bool +SurfaceStream_TripleBuffer_Async::WaitForCompositor() +{ + SAMPLE_LABEL("SurfaceStream_TripleBuffer_Async", "WaitForCompositor"); + + // We are assumed to be locked + while (mStaging) + mMonitor.Wait(); + + return true; +} + } /* namespace gfx */ } /* namespace mozilla */ diff --git a/gfx/gl/SurfaceStream.h b/gfx/gl/SurfaceStream.h index ca878f067697..ae8666a6b341 100644 --- a/gfx/gl/SurfaceStream.h +++ b/gfx/gl/SurfaceStream.h @@ -8,7 +8,7 @@ #include #include -#include "mozilla/Mutex.h" +#include "mozilla/Monitor.h" #include "mozilla/Attributes.h" #include "gfxPoint.h" #include "SurfaceTypes.h" @@ -48,7 +48,7 @@ protected: SharedSurface* mProducer; std::set mSurfaces; std::stack mScraps; - mutable Mutex mMutex; + mutable Monitor mMonitor; bool mIsAlive; // |previous| can be null, indicating this is the first one. @@ -56,7 +56,7 @@ protected: SurfaceStream(SurfaceStreamType type, SurfaceStream* prevStream) : mType(type) , mProducer(nullptr) - , mMutex("SurfaceStream mutex") + , mMonitor("SurfaceStream monitor") , mIsAlive(true) { MOZ_ASSERT(!prevStream || mType != prevStream->mType, @@ -107,6 +107,8 @@ public: virtual SharedSurface* SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) = 0; + virtual SharedSurface* Resize(SurfaceFactory* factory, const gfxIntSize& size); + protected: // SwapCons will return the same surface more than once, // if nothing new has been published. @@ -169,6 +171,9 @@ protected: SharedSurface* mStaging; SharedSurface* mConsumer; + // Returns true if we were able to wait, false if not + virtual bool WaitForCompositor() { return false; } + public: SurfaceStream_TripleBuffer(SurfaceStream* prevStream); virtual ~SurfaceStream_TripleBuffer(); @@ -182,6 +187,17 @@ public: virtual void SurrenderSurfaces(SharedSurface*& producer, SharedSurface*& consumer); }; +class SurfaceStream_TripleBuffer_Async + : public SurfaceStream_TripleBuffer +{ +protected: + virtual bool WaitForCompositor(); + +public: + SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream); + virtual ~SurfaceStream_TripleBuffer_Async(); +}; + } /* namespace gfx */ } /* namespace mozilla */ diff --git a/gfx/gl/SurfaceTypes.h b/gfx/gl/SurfaceTypes.h index b8c9d3c45a29..d4f588c8fb61 100644 --- a/gfx/gl/SurfaceTypes.h +++ b/gfx/gl/SurfaceTypes.h @@ -78,6 +78,7 @@ MOZ_END_ENUM_CLASS(SharedSurfaceType) MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t) SingleBuffer, TripleBuffer_Copy, + TripleBuffer_Async, TripleBuffer, Max MOZ_END_ENUM_CLASS(SurfaceStreamType) diff --git a/gfx/layers/basic/BasicCanvasLayer.cpp b/gfx/layers/basic/BasicCanvasLayer.cpp index d3f2911c7a1f..834441b9312e 100644 --- a/gfx/layers/basic/BasicCanvasLayer.cpp +++ b/gfx/layers/basic/BasicCanvasLayer.cpp @@ -12,6 +12,7 @@ #include "SurfaceStream.h" #include "SharedSurfaceGL.h" #include "SharedSurfaceEGL.h" +#include "sampler.h" #include "BasicLayersImpl.h" #include "nsXULAppAPI.h" @@ -411,6 +412,7 @@ BasicShadowableCanvasLayer::Initialize(const Data& aData) void BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer) { + SAMPLE_LABEL("BasicShadowableCanvasLayer", "Paint"); if (!HasShadow()) { BasicCanvasLayer::Paint(aContext, aMaskLayer); return; @@ -436,9 +438,9 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer) // Call Painted() to reset our dirty 'bit'. Painted(); FireDidTransactionCallback(); - BasicManager()->PaintedCanvas(BasicManager()->Hold(this), - mNeedsYFlip, - mBackBuffer); + BasicManager()->PaintedCanvasNoSwap(BasicManager()->Hold(this), + mNeedsYFlip, + mBackBuffer); // Move SharedTextureHandle ownership to ShadowLayer mBackBuffer = SurfaceDescriptor(); return; diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index a984708371c2..411886812d77 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -523,7 +523,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, void* aCallbackData, EndTransactionFlags aFlags) { - SAMPLE_LABEL("BasicLayerManager", "EndTranscationInternal"); + SAMPLE_LABEL("BasicLayerManager", "EndTransactionInternal"); #ifdef MOZ_LAYERS_HAVE_LOG MOZ_LAYERS_LOG((" ----- (beginning paint)")); Log(); @@ -871,6 +871,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, void* aCallbackData, ReadbackProcessor* aReadback) { + SAMPLE_LABEL("BasicLayerManager", "PaintLayer"); PaintContext paintContext(aTarget, aLayer, aCallback, aCallbackData, aReadback); // Don't attempt to paint layers with a singular transform, cairo will diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 4d365e3d5734..458e36061528 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -297,6 +297,16 @@ ShadowLayerForwarder::PaintedCanvas(ShadowableLayer* aCanvas, aNeedYFlip)); } +void +ShadowLayerForwarder::PaintedCanvasNoSwap(ShadowableLayer* aCanvas, + bool aNeedYFlip, + const SurfaceDescriptor& aNewFrontSurface) +{ + mTxn->AddNoSwapPaint(OpPaintCanvas(NULL, Shadow(aCanvas), + aNewFrontSurface, + aNeedYFlip)); +} + bool ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies) { diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 5d59accaa8c7..efefd14a031a 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -219,6 +219,9 @@ public: void PaintedCanvas(ShadowableLayer* aCanvas, bool aNeedYFlip, const SurfaceDescriptor& aNewFrontSurface); + void PaintedCanvasNoSwap(ShadowableLayer* aCanvas, + bool aNeedYFlip, + const SurfaceDescriptor& aNewFrontSurface); /** * End the current transaction and forward it to ShadowLayerManager. diff --git a/gfx/layers/ipc/ShadowLayersParent.cpp b/gfx/layers/ipc/ShadowLayersParent.cpp index 7b5847be608e..b36f47e76bba 100644 --- a/gfx/layers/ipc/ShadowLayersParent.cpp +++ b/gfx/layers/ipc/ShadowLayersParent.cpp @@ -422,11 +422,14 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray& cset, RenderTraceInvalidateStart(canvas, "FF00FF", canvas->GetVisibleRegion().GetBounds()); canvas->SetAllocator(this); - CanvasSurface newBack; + CanvasSurface newBack = CanvasSurface(null_t()); canvas->Swap(op.newFrontBuffer(), op.needYFlip(), &newBack); canvas->Updated(); - replyv.push_back(OpBufferSwap(shadow, NULL, - newBack)); + + if (newBack.type() != CanvasSurface::Tnull_t) { + replyv.push_back(OpBufferSwap(shadow, NULL, + newBack)); + } RenderTraceInvalidateEnd(canvas, "FF00FF"); break; diff --git a/gfx/layers/opengl/CanvasLayerOGL.cpp b/gfx/layers/opengl/CanvasLayerOGL.cpp index 0f783c8346ae..d607de57d1e6 100644 --- a/gfx/layers/opengl/CanvasLayerOGL.cpp +++ b/gfx/layers/opengl/CanvasLayerOGL.cpp @@ -444,7 +444,6 @@ ShadowCanvasLayerOGL::Swap(const CanvasSurface& aNewFront, SurfaceStreamHandle handle = (SurfaceStreamHandle)nullptr; mFrontBufferDescriptor = SurfaceStreamDescriptor(handle, false); } - *aNewBack = mFrontBufferDescriptor; mFrontBufferDescriptor = aNewFront; mNeedsYFlip = needYFlip; } else { From 7f4fde71519ec160735c88a500824942ab70508d Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Thu, 14 Mar 2013 14:28:05 -0400 Subject: [PATCH 03/11] bug 851224 - make install should ignore version downgrades r=mfinkle --- mobile/android/build.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/build.mk b/mobile/android/build.mk index 885d5a1ede4e..bc41c126e8b8 100644 --- a/mobile/android/build.mk +++ b/mobile/android/build.mk @@ -31,7 +31,7 @@ endif endif install:: - $(ANDROID_PLATFORM_TOOLS)/adb install -r $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk + $(ANDROID_PLATFORM_TOOLS)/adb install -r -d $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk else @echo "Mobile can't be installed directly." @exit 1 From 9f022df7cfb729c3281893d471c20092479c1fb2 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 18 Mar 2013 13:54:04 -0400 Subject: [PATCH 04/11] [Bug 851972] Remove XPIDL for ComponentTransferFunctionElement r=Ms2ger --- .../src/SVGComponentTransferFunctionElement.h | 36 ++----- content/svg/content/src/nsSVGFilters.cpp | 98 +++++-------------- dom/interfaces/svg/nsIDOMSVGFilters.idl | 41 -------- 3 files changed, 36 insertions(+), 139 deletions(-) diff --git a/content/svg/content/src/SVGComponentTransferFunctionElement.h b/content/svg/content/src/SVGComponentTransferFunctionElement.h index a63048f83fe2..5ed4b690c60e 100644 --- a/content/svg/content/src/SVGComponentTransferFunctionElement.h +++ b/content/svg/content/src/SVGComponentTransferFunctionElement.h @@ -38,7 +38,6 @@ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID) NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const; @@ -62,7 +61,6 @@ protected: virtual EnumAttributesInfo GetEnumInfo(); virtual NumberListAttributesInfo GetNumberListInfo(); - // nsIDOMSVGComponentTransferFunctionElement properties: enum { TABLEVALUES }; SVGAnimatedNumberList mNumberListAttributes[1]; static NumberListInfo sNumberListInfo[1]; @@ -87,24 +85,20 @@ namespace mozilla { namespace dom { class SVGFEFuncRElement : public SVGComponentTransferFunctionElement, - public nsIDOMSVGFEFuncRElement + public nsIDOMSVGElement { friend nsresult (::NS_NewSVGFEFuncRElement( nsIContent** aResult, already_AddRefed aNodeInfo)); protected: - SVGFEFuncRElement(already_AddRefed aNodeInfo) + SVGFEFuncRElement(already_AddRefed aNodeInfo) : SVGComponentTransferFunctionElement(aNodeInfo) {} public: // interfaces: NS_DECL_ISUPPORTS_INHERITED - NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::) - - NS_DECL_NSIDOMSVGFEFUNCRELEMENT - virtual int32_t GetChannel() { return 0; } - + NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::) NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT_TO_GENERIC @@ -127,22 +121,18 @@ namespace mozilla { namespace dom { class SVGFEFuncGElement : public SVGComponentTransferFunctionElement, - public nsIDOMSVGFEFuncGElement + public nsIDOMSVGElement { friend nsresult (::NS_NewSVGFEFuncGElement( nsIContent** aResult, already_AddRefed aNodeInfo)); protected: - SVGFEFuncGElement(already_AddRefed aNodeInfo) + SVGFEFuncGElement(already_AddRefed aNodeInfo) : SVGComponentTransferFunctionElement(aNodeInfo) {} public: // interfaces: NS_DECL_ISUPPORTS_INHERITED - NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::) - - NS_DECL_NSIDOMSVGFEFUNCGELEMENT - virtual int32_t GetChannel() { return 1; } NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::) @@ -167,22 +157,18 @@ namespace mozilla { namespace dom { class SVGFEFuncBElement : public SVGComponentTransferFunctionElement, - public nsIDOMSVGFEFuncBElement + public nsIDOMSVGElement { friend nsresult (::NS_NewSVGFEFuncBElement( nsIContent** aResult, already_AddRefed aNodeInfo)); protected: - SVGFEFuncBElement(already_AddRefed aNodeInfo) + SVGFEFuncBElement(already_AddRefed aNodeInfo) : SVGComponentTransferFunctionElement(aNodeInfo) {} public: // interfaces: NS_DECL_ISUPPORTS_INHERITED - NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::) - - NS_DECL_NSIDOMSVGFEFUNCBELEMENT - virtual int32_t GetChannel() { return 2; } NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::) @@ -207,22 +193,18 @@ namespace mozilla { namespace dom { class SVGFEFuncAElement : public SVGComponentTransferFunctionElement, - public nsIDOMSVGFEFuncAElement + public nsIDOMSVGElement { friend nsresult (::NS_NewSVGFEFuncAElement( nsIContent** aResult, already_AddRefed aNodeInfo)); protected: - SVGFEFuncAElement(already_AddRefed aNodeInfo) + SVGFEFuncAElement(already_AddRefed aNodeInfo) : SVGComponentTransferFunctionElement(aNodeInfo) {} public: // interfaces: NS_DECL_ISUPPORTS_INHERITED - NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::) - - NS_DECL_NSIDOMSVGFEFUNCAELEMENT - virtual int32_t GetChannel() { return 3; } NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::) diff --git a/content/svg/content/src/nsSVGFilters.cpp b/content/svg/content/src/nsSVGFilters.cpp index 3aef70b240ee..a1239391dd87 100644 --- a/content/svg/content/src/nsSVGFilters.cpp +++ b/content/svg/content/src/nsSVGFilters.cpp @@ -53,6 +53,13 @@ using namespace mozilla; using namespace mozilla::dom; +static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; +static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1; +static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2; +static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3; +static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4; +static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5; + void CopyDataRect(uint8_t *aDest, const uint8_t *aSrc, uint32_t aStride, const nsIntRect& aDataRect) @@ -1479,15 +1486,15 @@ nsSVGElement::NumberInfo SVGComponentTransferFunctionElement::sNumberInfo[5] = nsSVGEnumMapping SVGComponentTransferFunctionElement::sTypeMap[] = { {&nsGkAtoms::identity, - nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY}, + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY}, {&nsGkAtoms::table, - nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_TABLE}, + SVG_FECOMPONENTTRANSFER_TYPE_TABLE}, {&nsGkAtoms::discrete, - nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE}, + SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE}, {&nsGkAtoms::linear, - nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_LINEAR}, + SVG_FECOMPONENTTRANSFER_TYPE_LINEAR}, {&nsGkAtoms::gamma, - nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_GAMMA}, + SVG_FECOMPONENTTRANSFER_TYPE_GAMMA}, {nullptr, 0} }; @@ -1495,7 +1502,7 @@ nsSVGElement::EnumInfo SVGComponentTransferFunctionElement::sEnumInfo[1] = { { &nsGkAtoms::type, sTypeMap, - nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY + SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY } }; @@ -1521,7 +1528,7 @@ NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElementBase) bool SVGComponentTransferFunctionElement::AttributeAffectsRendering(int32_t aNameSpaceID, - nsIAtom* aAttribute) const + nsIAtom* aAttribute) const { return aNameSpaceID == kNameSpaceID_None && (aAttribute == nsGkAtoms::tableValues || @@ -1534,92 +1541,49 @@ SVGComponentTransferFunctionElement::AttributeAffectsRendering(int32_t aNameSpac } //---------------------------------------------------------------------- -// nsIDOMSVGComponentTransferFunctionElement methods -/* readonly attribute nsIDOMSVGAnimatedEnumeration type; */ already_AddRefed SVGComponentTransferFunctionElement::Type() { return mEnumAttributes[TYPE].ToDOMAnimatedEnum(this); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetType(nsIDOMSVGAnimatedEnumeration * *aType) -{ - *aType = Type().get(); - return NS_OK; -} -/* readonly attribute DOMSVGAnimatedNumberList tableValues; */ already_AddRefed SVGComponentTransferFunctionElement::TableValues() { return DOMSVGAnimatedNumberList::GetDOMWrapper( &mNumberListAttributes[TABLEVALUES], this, TABLEVALUES); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetTableValues(nsISupports * *aTableValues) -{ - *aTableValues = TableValues().get(); - return NS_OK; -} -/* readonly attribute nsIDOMSVGAnimatedNumber slope; */ already_AddRefed SVGComponentTransferFunctionElement::Slope() { return mNumberAttributes[SLOPE].ToDOMAnimatedNumber(this); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetSlope(nsIDOMSVGAnimatedNumber * *aSlope) -{ - *aSlope = Slope().get(); - return NS_OK; -} -/* readonly attribute nsIDOMSVGAnimatedNumber intercept; */ already_AddRefed SVGComponentTransferFunctionElement::Intercept() { return mNumberAttributes[INTERCEPT].ToDOMAnimatedNumber(this); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetIntercept(nsIDOMSVGAnimatedNumber * *aIntercept) -{ - *aIntercept = Intercept().get(); - return NS_OK; -} -/* readonly attribute nsIDOMSVGAnimatedNumber amplitude; */ already_AddRefed SVGComponentTransferFunctionElement::Amplitude() { return mNumberAttributes[AMPLITUDE].ToDOMAnimatedNumber(this); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetAmplitude(nsIDOMSVGAnimatedNumber * *aAmplitude) -{ - *aAmplitude = Amplitude().get(); - return NS_OK; -} -/* readonly attribute nsIDOMSVGAnimatedNumber exponent; */ already_AddRefed SVGComponentTransferFunctionElement::Exponent() { return mNumberAttributes[EXPONENT].ToDOMAnimatedNumber(this); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetExponent(nsIDOMSVGAnimatedNumber * *aExponent) -{ - *aExponent = Exponent().get(); - return NS_OK; -} -/* readonly attribute nsIDOMSVGAnimatedNumber offset; */ already_AddRefed SVGComponentTransferFunctionElement::Offset() { return mNumberAttributes[OFFSET].ToDOMAnimatedNumber(this); } -NS_IMETHODIMP SVGComponentTransferFunctionElement::GetOffset(nsIDOMSVGAnimatedNumber * *aOffset) -{ - *aOffset = Offset().get(); - return NS_OK; -} bool SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable) @@ -1637,7 +1601,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable) uint32_t i; switch (type) { - case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_TABLE: + case SVG_FECOMPONENTTRANSFER_TYPE_TABLE: { if (tableValues.Length() < 2) return false; @@ -1655,7 +1619,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable) break; } - case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: + case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: { if (tableValues.Length() < 1) return false; @@ -1672,7 +1636,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable) break; } - case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: + case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: { for (i = 0; i < 256; i++) { int32_t val = int32_t(slope * i + 255 * intercept); @@ -1683,7 +1647,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable) break; } - case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: + case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: { for (i = 0; i < 256; i++) { int32_t val = int32_t(255 * (amplitude * pow(i / 255.0f, exponent) + offset)); @@ -1694,7 +1658,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable) break; } - case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: + case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: default: break; } @@ -1725,12 +1689,10 @@ SVGComponentTransferFunctionElement::GetNumberInfo() ArrayLength(sNumberInfo)); } -NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncRElement, +NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncRElement, SVGComponentTransferFunctionElement, nsIDOMNode, nsIDOMElement, - nsIDOMSVGElement, - nsIDOMSVGComponentTransferFunctionElement, - nsIDOMSVGFEFuncRElement) + nsIDOMSVGElement) /* virtual */ JSObject* SVGFEFuncRElement::WrapNode(JSContext* aCx, JSObject* aScope) @@ -1748,12 +1710,10 @@ namespace dom { NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncRElement) -NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncGElement, +NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncGElement, SVGComponentTransferFunctionElement, nsIDOMNode, nsIDOMElement, - nsIDOMSVGElement, - nsIDOMSVGComponentTransferFunctionElement, - nsIDOMSVGFEFuncGElement) + nsIDOMSVGElement) /* virtual */ JSObject* SVGFEFuncGElement::WrapNode(JSContext* aCx, JSObject* aScope) @@ -1771,12 +1731,10 @@ namespace dom { NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncGElement) -NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncBElement, +NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncBElement, SVGComponentTransferFunctionElement, nsIDOMNode, nsIDOMElement, - nsIDOMSVGElement, - nsIDOMSVGComponentTransferFunctionElement, - nsIDOMSVGFEFuncBElement) + nsIDOMSVGElement) /* virtual */ JSObject* SVGFEFuncBElement::WrapNode(JSContext* aCx, JSObject* aScope) @@ -1794,12 +1752,10 @@ namespace dom { NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncBElement) -NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncAElement, +NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncAElement, SVGComponentTransferFunctionElement, nsIDOMNode, nsIDOMElement, - nsIDOMSVGElement, - nsIDOMSVGComponentTransferFunctionElement, - nsIDOMSVGFEFuncAElement) + nsIDOMSVGElement) /* virtual */ JSObject* SVGFEFuncAElement::WrapNode(JSContext* aCx, JSObject* aScope) diff --git a/dom/interfaces/svg/nsIDOMSVGFilters.idl b/dom/interfaces/svg/nsIDOMSVGFilters.idl index 6da0e3865f0a..693c12902096 100644 --- a/dom/interfaces/svg/nsIDOMSVGFilters.idl +++ b/dom/interfaces/svg/nsIDOMSVGFilters.idl @@ -37,27 +37,6 @@ interface nsIDOMSVGFEColorMatrixElement : nsIDOMSVGFilterPrimitiveStandardAttrib readonly attribute nsISupports values; }; -[scriptable, uuid(3fa8c369-df5b-4bfb-9651-c999bc22fbc7)] -interface nsIDOMSVGComponentTransferFunctionElement : nsIDOMSVGElement -{ - // Component Transfer Types - const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; - const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1; - const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2; - const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3; - const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4; - const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5; - - readonly attribute nsIDOMSVGAnimatedEnumeration type; - // SVGAnimatedNumberList - readonly attribute nsISupports tableValues; - readonly attribute nsIDOMSVGAnimatedNumber slope; - readonly attribute nsIDOMSVGAnimatedNumber intercept; - readonly attribute nsIDOMSVGAnimatedNumber amplitude; - readonly attribute nsIDOMSVGAnimatedNumber exponent; - readonly attribute nsIDOMSVGAnimatedNumber offset; -}; - [scriptable, uuid(f264fd1f-b272-4796-99b5-68c90cbd030c)] interface nsIDOMSVGFECompositeElement : nsIDOMSVGFilterPrimitiveStandardAttributes { @@ -82,26 +61,6 @@ interface nsIDOMSVGFECompositeElement : nsIDOMSVGFilterPrimitiveStandardAttribut }; -[scriptable, uuid(7ff6cba9-65e0-48d2-9d81-4ab26782a945)] -interface nsIDOMSVGFEFuncRElement : nsIDOMSVGComponentTransferFunctionElement -{ -}; - -[scriptable, uuid(b6a7ad39-724f-42ab-8d3f-a05d1cf7ab0c)] -interface nsIDOMSVGFEFuncGElement : nsIDOMSVGComponentTransferFunctionElement -{ -}; - -[scriptable, uuid(c414b7dd-7ff2-4158-988a-20943d22db52)] -interface nsIDOMSVGFEFuncBElement : nsIDOMSVGComponentTransferFunctionElement -{ -}; - -[scriptable, uuid(f4f5fe63-9570-48f7-ba7e-a5300fa71aed)] -interface nsIDOMSVGFEFuncAElement : nsIDOMSVGComponentTransferFunctionElement -{ -}; - [scriptable, uuid(08f2d7e5-b79f-405c-8140-7faa72c53ead)] interface nsIDOMSVGFEGaussianBlurElement : nsIDOMSVGFilterPrimitiveStandardAttributes { From 513bfe54a9a74f00dbcfccc04cb05c12b8dd3bdb Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Mon, 18 Mar 2013 10:58:31 -0700 Subject: [PATCH 05/11] Bug 851981: Make loop iterator in mozalloc_handle_oom a size_t instead of an int, to fix build warning for signed/unsigned comparison. r=bsmedberg --- memory/mozalloc/mozalloc_oom.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/memory/mozalloc/mozalloc_oom.cpp b/memory/mozalloc/mozalloc_oom.cpp index 39a464ef7a0f..4ad24142482d 100644 --- a/memory/mozalloc/mozalloc_oom.cpp +++ b/memory/mozalloc/mozalloc_oom.cpp @@ -11,6 +11,7 @@ #include "mozilla/mozalloc_abort.h" #include "mozilla/mozalloc_oom.h" +#include "mozilla/Assertions.h" static mozalloc_oom_abort_handler gAbortHandler; @@ -27,7 +28,7 @@ void mozalloc_handle_oom(size_t size) { char oomMsg[] = OOM_MSG_LEADER OOM_MSG_DIGITS OOM_MSG_TRAILER; - int i; + size_t i; // NB: this is handle_oom() stage 1, which simply aborts on OOM. // we might proceed to a stage 2 in which an attempt is made to @@ -36,6 +37,9 @@ mozalloc_handle_oom(size_t size) if (gAbortHandler) gAbortHandler(size); + MOZ_STATIC_ASSERT(OOM_MSG_FIRST_DIGIT_OFFSET > 0, + "Loop below will never terminate (i can't go below 0)"); + // Insert size into the diagnostic message using only primitive operations for (i = OOM_MSG_LAST_DIGIT_OFFSET; size && i >= OOM_MSG_FIRST_DIGIT_OFFSET; i--) { From 66ebac5b32714228b417cf70927a4ad7a7c4a1c6 Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Mon, 18 Mar 2013 11:02:08 -0700 Subject: [PATCH 06/11] Bug 845785 - re-exclude test_Range-mutations.html for frequent crashes, a=test-only --- testing/mochitest/b2g.json | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 78153a4b406a..7bc13aa934cf 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -259,6 +259,7 @@ "dom/imptests/webapps/DOMCore/tests/approved/test_Range-extractContents.html":"", "dom/imptests/webapps/DOMCore/tests/approved/test_Range-insertNode.html":"", "dom/imptests/webapps/DOMCore/tests/approved/test_Range-surroundContents.html":"", + "dom/imptests/webapps/DOMCore/tests/approved/test_Range-mutations.html":" Test timed out.", "dom/indexedDB/": "", "dom/mobilemessage/tests/test_sms_basics.html": "", "dom/media/tests/mochitest/test_getUserMedia_exceptions.html":"", From 01a87f0686378bb729e8e7928a625d38feb80c6a Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 18 Mar 2013 11:04:07 -0700 Subject: [PATCH 07/11] Bug 848538 - Push a cx before calling into ctypes callbacks. r=jorendorff --- js/xpconnect/src/XPCJSRuntime.cpp | 17 +++++++++++++++++ js/xpconnect/src/xpcprivate.h | 2 ++ .../ctypes/tests/unit/test_jsctypes.js.in | 7 +++++++ 3 files changed, 26 insertions(+) diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 37c4431d48e0..b534097a89a6 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1105,6 +1105,22 @@ XPCJSRuntime::ActivityCallback(void *arg, JSBool active) } } +// static +// +// JS-CTypes creates and caches a JSContext that it uses when executing JS +// callbacks. When we're notified that ctypes is about to call into some JS, +// push the cx to maintain the integrity of the context stack. +void +XPCJSRuntime::CTypesActivityCallback(JSContext *cx, js::CTypesActivityType type) +{ + if (type == js::CTYPES_CALLBACK_BEGIN) { + if (!Get()->GetJSContextStack()->Push(cx)) + MOZ_CRASH(); + } else if (type == js::CTYPES_CALLBACK_END) { + Get()->GetJSContextStack()->Pop(); + } +} + size_t XPCJSRuntime::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) { @@ -2638,6 +2654,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect) #endif JS_SetAccumulateTelemetryCallback(mJSRuntime, AccumulateTelemetryCallback); js::SetActivityCallback(mJSRuntime, ActivityCallback, this); + js::SetCTypesActivityCallback(mJSRuntime, CTypesActivityCallback); // The JS engine needs to keep the source code around in order to implement // Function.prototype.toSource(). It'd be nice to not have to do this for diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 1acf86b04257..31a530f8ef06 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -897,6 +897,8 @@ public: void RemoveGCCallback(JSGCCallback cb); static void ActivityCallback(void *arg, JSBool active); + static void CTypesActivityCallback(JSContext *cx, + js::CTypesActivityType type); bool XBLScopesEnabled() { return gXBLScopesEnabled; diff --git a/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in b/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in index bcda0cbc3bfa..214a9d82d491 100644 --- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in +++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in @@ -2628,6 +2628,13 @@ function run_single_closure_tests(library, abi, suffix) var fn_v_t = ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, []).ptr; fn_v_t(function() {})(); // Don't crash + // Code evaluated in a sandbox uses (and pushes) a separate JSContext. + // Make sure that we don't run into an assertion caused by a cx stack + // mismatch with the cx stashed in the closure. + var sb = Components.utils.Sandbox("http://www.example.com"); + sb.fn = fn_v_t(function() {sb.foo = {};}); + Components.utils.evalInSandbox("fn();", sb); + // Make sure that a void callback can't return an error sentinel. var sentinelThrew = false; try { From 93dc121b06812fcf81420286fee89882875449c2 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Mon, 18 Mar 2013 11:14:56 -0700 Subject: [PATCH 08/11] Fix OdinMonkey when --disable-ion (no bug, r=me) --HG-- extra : rebase_source : 3536acf09aecbdcb2ca9156873fc39571328975a --- js/src/Makefile.in | 7 +++---- js/src/builtin/TestingFunctions.cpp | 10 ++++++++++ js/src/frontend/BytecodeCompiler.cpp | 2 ++ js/src/frontend/BytecodeEmitter.cpp | 2 ++ js/src/ion/AsmJS.cpp | 4 ++-- js/src/ion/AsmJSLink.cpp | 4 ++++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 72bf2b8ca044..aab90d17ae1e 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -46,7 +46,6 @@ VPATH += \ $(srcdir)/ds \ $(srcdir)/frontend \ $(srcdir)/gc \ - $(srcdir)/ion \ $(srcdir)/vm \ $(NULL) @@ -145,9 +144,6 @@ CPPSRCS = \ Unicode.cpp \ Xdr.cpp \ Module.cpp \ - AsmJS.cpp \ - AsmJSLink.cpp \ - AsmJSSignalHandlers.cpp \ $(NULL) # Changes to internal header files, used externally, massively slow down @@ -295,6 +291,9 @@ CPPSRCS += MIR.cpp \ ParallelArrayAnalysis.cpp \ UnreachableCodeElimination.cpp \ EffectiveAddressAnalysis.cpp \ + AsmJS.cpp \ + AsmJSLink.cpp \ + AsmJSSignalHandlers.cpp \ $(NULL) endif #ENABLE_ION ifeq (86, $(findstring 86,$(TARGET_CPU))) diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 374ad0c62035..d711a9040ea6 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -905,6 +905,16 @@ js::testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp) return true; } +#ifndef JS_ION +JSBool +js::IsAsmJSCompilationAvailable(JSContext *cx, unsigned argc, Value *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + args.rval().set(BooleanValue(false)); + return true; +} +#endif + static JSFunctionSpecWithHelp TestingFunctions[] = { JS_FN_HELP("gc", ::GC, 0, 0, "gc([obj] | 'compartment')", diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 69d9562154c0..a3bdaada4592 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -407,12 +407,14 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions pn = fn->pn_body; } +#ifdef JS_ION /* * Do asm.js compilation once the parse tree has been fully assembled but * before emitting since we need to know whether to emit JSOP_LINKASMJS. */ if (fn->pn_funbox->useAsm && !CompileAsmJS(cx, parser.tokenStream, fn, script)) return false; +#endif if (!SetSourceMap(cx, parser.tokenStream, ss, script)) return false; diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 1fca919ee0b0..315a8b6f4e93 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -4392,12 +4392,14 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) script->bindings = funbox->bindings; +#ifdef JS_ION // Do asm.js compilation at the beginning of emitting to avoid // compiling twice when JS_BufferIsCompilableUnit and to know whether // to emit JSOP_LINKASMJS. Don't fold constants as this will // misrepresent the source JS as written to the type checker. if (funbox->useAsm && !CompileAsmJS(cx, *bce->tokenStream(), pn, script)) return false; +#endif BytecodeEmitter bce2(bce, bce->parser, funbox, script, bce->evalCaller, bce->hasGlobalScope, pn->pn_pos.begin.lineno, bce->selfHostingMode); diff --git a/js/src/ion/AsmJS.cpp b/js/src/ion/AsmJS.cpp index cc79139c7217..d27003655a16 100644 --- a/js/src/ion/AsmJS.cpp +++ b/js/src/ion/AsmJS.cpp @@ -16,14 +16,14 @@ using namespace js; using namespace js::frontend; using namespace mozilla; -#ifdef JS_ASMJS - #include "ion/CodeGenerator.h" #include "ion/MIR.h" #include "ion/MIRGraph.h" using namespace js::ion; +#ifdef JS_ASMJS + /*****************************************************************************/ // ParseNode utilities diff --git a/js/src/ion/AsmJSLink.cpp b/js/src/ion/AsmJSLink.cpp index 03f6afa6a94f..3433fc186242 100644 --- a/js/src/ion/AsmJSLink.cpp +++ b/js/src/ion/AsmJSLink.cpp @@ -17,6 +17,8 @@ using namespace js; using namespace js::ion; using namespace mozilla; +#ifdef JS_ASMJS + static bool LinkFail(JSContext *cx, const char *str) { @@ -403,3 +405,5 @@ js::LinkAsmJS(JSContext *cx, StackFrame *fp, MutableHandleValue rval) rval.set(ObjectValue(*obj)); return true; } + +#endif // defined(JS_ASMJS) From 8a6532e5346d2c2da519657f9711e7a92d427e84 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 18 Mar 2013 18:58:58 +0000 Subject: [PATCH 09/11] Backed out changeset 7268c16cad16 (bug 829747) for causing B2G test timeouts; CLOSED TREE --- gfx/gl/GLContext.cpp | 4 +- gfx/gl/GLScreenBuffer.cpp | 52 ++++++++-------------- gfx/gl/GLScreenBuffer.h | 4 -- gfx/gl/SurfaceStream.cpp | 60 ++++---------------------- gfx/gl/SurfaceStream.h | 22 ++-------- gfx/gl/SurfaceTypes.h | 1 - gfx/layers/basic/BasicCanvasLayer.cpp | 8 ++-- gfx/layers/basic/BasicLayerManager.cpp | 3 +- gfx/layers/ipc/ShadowLayers.cpp | 10 ----- gfx/layers/ipc/ShadowLayers.h | 3 -- gfx/layers/ipc/ShadowLayersParent.cpp | 9 ++-- gfx/layers/opengl/CanvasLayerOGL.cpp | 1 + 12 files changed, 40 insertions(+), 137 deletions(-) diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index e6913d0d6b68..f5cfe73e616b 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -2879,7 +2879,7 @@ GLContext::CreateScreenBufferImpl(const gfxIntSize& size, const SurfaceCaps& cap if (!newScreen) return false; - if (!newScreen->Resize(size)) { + if (!newScreen->PublishFrame(size)) { delete newScreen; return false; } @@ -2901,7 +2901,7 @@ GLContext::ResizeScreenBuffer(const gfxIntSize& size) if (!IsOffscreenSizeAllowed(size)) return false; - return mScreen->Resize(size); + return mScreen->PublishFrame(size); } diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index aa6247e6d32c..5f8560095d5b 100644 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -325,12 +325,27 @@ GLScreenBuffer::Morph(SurfaceFactory_GL* newFactory, SurfaceStreamType streamTyp mStream = newStream; } -void -GLScreenBuffer::Attach(SharedSurface* surface, const gfxIntSize& size) +bool +GLScreenBuffer::Swap(const gfxIntSize& size) { ScopedBindFramebuffer autoFB(mGL); - SharedSurface_GL* surf = SharedSurface_GL::Cast(surface); + SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size); + if (!nextSurf) { + SurfaceFactory_GL* basicFactory = + new SurfaceFactory_Basic(mGL, mFactory->Caps()); + nextSurf = mStream->SwapProducer(basicFactory, size); + if (!nextSurf) { + delete basicFactory; + return false; + } + + // Swap out the apparently defective old factory. + delete mFactory; + mFactory = basicFactory; + } + + SharedSurface_GL* surf = SharedSurface_GL::Cast(nextSurf); if (mRead && SharedSurf()) SharedSurf()->UnlockProd(); @@ -361,27 +376,6 @@ GLScreenBuffer::Attach(SharedSurface* surface, const gfxIntSize& size) if (!PreserveBuffer()) { // DiscardFramebuffer here could help perf on some mobile platforms. } -} - -bool -GLScreenBuffer::Swap(const gfxIntSize& size) -{ - SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size); - if (!nextSurf) { - SurfaceFactory_GL* basicFactory = - new SurfaceFactory_Basic(mGL, mFactory->Caps()); - nextSurf = mStream->SwapProducer(basicFactory, size); - if (!nextSurf) { - delete basicFactory; - return false; - } - - // Swap out the apparently defective old factory. - delete mFactory; - mFactory = basicFactory; - } - - Attach(nextSurf, size); return true; } @@ -395,16 +389,6 @@ GLScreenBuffer::PublishFrame(const gfxIntSize& size) return good; } -bool -GLScreenBuffer::Resize(const gfxIntSize& size) -{ - SharedSurface* surface = mStream->Resize(mFactory, size); - if (!surface) - return false; - - Attach(surface, size); - return true; -} DrawBuffer* GLScreenBuffer::CreateDraw(const gfxIntSize& size) diff --git a/gfx/gl/GLScreenBuffer.h b/gfx/gl/GLScreenBuffer.h index 0fd6f27b1c71..8f2268a4bae2 100644 --- a/gfx/gl/GLScreenBuffer.h +++ b/gfx/gl/GLScreenBuffer.h @@ -265,13 +265,9 @@ protected: public: bool PublishFrame(const gfxIntSize& size); - bool Resize(const gfxIntSize& size); - void Readback(SharedSurface_GL* src, gfxImageSurface* dest); protected: - void Attach(SharedSurface* surface, const gfxIntSize& size); - DrawBuffer* CreateDraw(const gfxIntSize& size); ReadBuffer* CreateRead(SharedSurface_GL* surf); diff --git a/gfx/gl/SurfaceStream.cpp b/gfx/gl/SurfaceStream.cpp index 423d948ae1a6..0442093c5e51 100644 --- a/gfx/gl/SurfaceStream.cpp +++ b/gfx/gl/SurfaceStream.cpp @@ -8,7 +8,6 @@ #include "gfxPoint.h" #include "SharedSurface.h" #include "SurfaceFactory.h" -#include "sampler.h" namespace mozilla { namespace gfx { @@ -21,7 +20,7 @@ SurfaceStream::ChooseGLStreamType(SurfaceStream::OMTC omtc, if (preserveBuffer) return SurfaceStreamType::TripleBuffer_Copy; else - return SurfaceStreamType::TripleBuffer_Async; + return SurfaceStreamType::TripleBuffer; } else { if (preserveBuffer) return SurfaceStreamType::SingleBuffer; @@ -38,8 +37,6 @@ SurfaceStream::CreateForType(SurfaceStreamType type, SurfaceStream* prevStream) return new SurfaceStream_SingleBuffer(prevStream); case SurfaceStreamType::TripleBuffer_Copy: return new SurfaceStream_TripleBuffer_Copy(prevStream); - case SurfaceStreamType::TripleBuffer_Async: - return new SurfaceStream_TripleBuffer_Async(prevStream); case SurfaceStreamType::TripleBuffer: return new SurfaceStream_TripleBuffer(prevStream); default: @@ -161,18 +158,7 @@ SurfaceStream::SwapConsumer() return ret; } -SharedSurface* -SurfaceStream::Resize(SurfaceFactory* factory, const gfxIntSize& size) -{ - MonitorAutoLock lock(mMonitor); - if (mProducer) { - Scrap(mProducer); - } - - New(factory, size, mProducer); - return mProducer; -} SurfaceStream_SingleBuffer::SurfaceStream_SingleBuffer(SurfaceStream* prevStream) : SurfaceStream(SurfaceStreamType::SingleBuffer, prevStream) @@ -214,7 +200,7 @@ SharedSurface* SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { - MonitorAutoLock lock(mMonitor); + MutexAutoLock lock(mMutex); if (mConsumer) { Recycle(factory, mConsumer); } @@ -252,7 +238,7 @@ SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory, SharedSurface* SurfaceStream_SingleBuffer::SwapConsumer_NoWait() { - MonitorAutoLock lock(mMonitor); + MutexAutoLock lock(mMutex); // Use Cons, if present. // Otherwise, just use Prod directly. @@ -307,7 +293,7 @@ SharedSurface* SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { - MonitorAutoLock lock(mMonitor); + MutexAutoLock lock(mMutex); RecycleScraps(factory); if (mProducer) { @@ -337,11 +323,10 @@ SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory, return mProducer; } - SharedSurface* SurfaceStream_TripleBuffer_Copy::SwapConsumer_NoWait() { - MonitorAutoLock lock(mMonitor); + MutexAutoLock lock(mMutex); if (mStaging) { Scrap(mConsumer); @@ -395,18 +380,13 @@ SharedSurface* SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { - SAMPLE_LABEL("SurfaceStream_TripleBuffer", "SwapProducer"); - - MonitorAutoLock lock(mMonitor); + MutexAutoLock lock(mMutex); if (mProducer) { RecycleScraps(factory); - // If WaitForCompositor succeeds, mStaging has moved to mConsumer. - // If it failed, we might have to scrap it. - if (mStaging && !WaitForCompositor()) - Scrap(mStaging); + if (mStaging) + Recycle(factory, mStaging); - MOZ_ASSERT(!mStaging); Move(mProducer, mStaging); mStaging->Fence(); } @@ -420,36 +400,14 @@ SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, SharedSurface* SurfaceStream_TripleBuffer::SwapConsumer_NoWait() { - MonitorAutoLock lock(mMonitor); + MutexAutoLock lock(mMutex); if (mStaging) { Scrap(mConsumer); Move(mStaging, mConsumer); - mMonitor.NotifyAll(); } return mConsumer; } -SurfaceStream_TripleBuffer_Async::SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream) - : SurfaceStream_TripleBuffer(prevStream) -{ -} - -SurfaceStream_TripleBuffer_Async::~SurfaceStream_TripleBuffer_Async() -{ -} - -bool -SurfaceStream_TripleBuffer_Async::WaitForCompositor() -{ - SAMPLE_LABEL("SurfaceStream_TripleBuffer_Async", "WaitForCompositor"); - - // We are assumed to be locked - while (mStaging) - mMonitor.Wait(); - - return true; -} - } /* namespace gfx */ } /* namespace mozilla */ diff --git a/gfx/gl/SurfaceStream.h b/gfx/gl/SurfaceStream.h index ae8666a6b341..ca878f067697 100644 --- a/gfx/gl/SurfaceStream.h +++ b/gfx/gl/SurfaceStream.h @@ -8,7 +8,7 @@ #include #include -#include "mozilla/Monitor.h" +#include "mozilla/Mutex.h" #include "mozilla/Attributes.h" #include "gfxPoint.h" #include "SurfaceTypes.h" @@ -48,7 +48,7 @@ protected: SharedSurface* mProducer; std::set mSurfaces; std::stack mScraps; - mutable Monitor mMonitor; + mutable Mutex mMutex; bool mIsAlive; // |previous| can be null, indicating this is the first one. @@ -56,7 +56,7 @@ protected: SurfaceStream(SurfaceStreamType type, SurfaceStream* prevStream) : mType(type) , mProducer(nullptr) - , mMonitor("SurfaceStream monitor") + , mMutex("SurfaceStream mutex") , mIsAlive(true) { MOZ_ASSERT(!prevStream || mType != prevStream->mType, @@ -107,8 +107,6 @@ public: virtual SharedSurface* SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) = 0; - virtual SharedSurface* Resize(SurfaceFactory* factory, const gfxIntSize& size); - protected: // SwapCons will return the same surface more than once, // if nothing new has been published. @@ -171,9 +169,6 @@ protected: SharedSurface* mStaging; SharedSurface* mConsumer; - // Returns true if we were able to wait, false if not - virtual bool WaitForCompositor() { return false; } - public: SurfaceStream_TripleBuffer(SurfaceStream* prevStream); virtual ~SurfaceStream_TripleBuffer(); @@ -187,17 +182,6 @@ public: virtual void SurrenderSurfaces(SharedSurface*& producer, SharedSurface*& consumer); }; -class SurfaceStream_TripleBuffer_Async - : public SurfaceStream_TripleBuffer -{ -protected: - virtual bool WaitForCompositor(); - -public: - SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream); - virtual ~SurfaceStream_TripleBuffer_Async(); -}; - } /* namespace gfx */ } /* namespace mozilla */ diff --git a/gfx/gl/SurfaceTypes.h b/gfx/gl/SurfaceTypes.h index d4f588c8fb61..b8c9d3c45a29 100644 --- a/gfx/gl/SurfaceTypes.h +++ b/gfx/gl/SurfaceTypes.h @@ -78,7 +78,6 @@ MOZ_END_ENUM_CLASS(SharedSurfaceType) MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t) SingleBuffer, TripleBuffer_Copy, - TripleBuffer_Async, TripleBuffer, Max MOZ_END_ENUM_CLASS(SurfaceStreamType) diff --git a/gfx/layers/basic/BasicCanvasLayer.cpp b/gfx/layers/basic/BasicCanvasLayer.cpp index 834441b9312e..d3f2911c7a1f 100644 --- a/gfx/layers/basic/BasicCanvasLayer.cpp +++ b/gfx/layers/basic/BasicCanvasLayer.cpp @@ -12,7 +12,6 @@ #include "SurfaceStream.h" #include "SharedSurfaceGL.h" #include "SharedSurfaceEGL.h" -#include "sampler.h" #include "BasicLayersImpl.h" #include "nsXULAppAPI.h" @@ -412,7 +411,6 @@ BasicShadowableCanvasLayer::Initialize(const Data& aData) void BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer) { - SAMPLE_LABEL("BasicShadowableCanvasLayer", "Paint"); if (!HasShadow()) { BasicCanvasLayer::Paint(aContext, aMaskLayer); return; @@ -438,9 +436,9 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer) // Call Painted() to reset our dirty 'bit'. Painted(); FireDidTransactionCallback(); - BasicManager()->PaintedCanvasNoSwap(BasicManager()->Hold(this), - mNeedsYFlip, - mBackBuffer); + BasicManager()->PaintedCanvas(BasicManager()->Hold(this), + mNeedsYFlip, + mBackBuffer); // Move SharedTextureHandle ownership to ShadowLayer mBackBuffer = SurfaceDescriptor(); return; diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 411886812d77..a984708371c2 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -523,7 +523,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, void* aCallbackData, EndTransactionFlags aFlags) { - SAMPLE_LABEL("BasicLayerManager", "EndTransactionInternal"); + SAMPLE_LABEL("BasicLayerManager", "EndTranscationInternal"); #ifdef MOZ_LAYERS_HAVE_LOG MOZ_LAYERS_LOG((" ----- (beginning paint)")); Log(); @@ -871,7 +871,6 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, void* aCallbackData, ReadbackProcessor* aReadback) { - SAMPLE_LABEL("BasicLayerManager", "PaintLayer"); PaintContext paintContext(aTarget, aLayer, aCallback, aCallbackData, aReadback); // Don't attempt to paint layers with a singular transform, cairo will diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 458e36061528..4d365e3d5734 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -297,16 +297,6 @@ ShadowLayerForwarder::PaintedCanvas(ShadowableLayer* aCanvas, aNeedYFlip)); } -void -ShadowLayerForwarder::PaintedCanvasNoSwap(ShadowableLayer* aCanvas, - bool aNeedYFlip, - const SurfaceDescriptor& aNewFrontSurface) -{ - mTxn->AddNoSwapPaint(OpPaintCanvas(NULL, Shadow(aCanvas), - aNewFrontSurface, - aNeedYFlip)); -} - bool ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies) { diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index efefd14a031a..5d59accaa8c7 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -219,9 +219,6 @@ public: void PaintedCanvas(ShadowableLayer* aCanvas, bool aNeedYFlip, const SurfaceDescriptor& aNewFrontSurface); - void PaintedCanvasNoSwap(ShadowableLayer* aCanvas, - bool aNeedYFlip, - const SurfaceDescriptor& aNewFrontSurface); /** * End the current transaction and forward it to ShadowLayerManager. diff --git a/gfx/layers/ipc/ShadowLayersParent.cpp b/gfx/layers/ipc/ShadowLayersParent.cpp index b36f47e76bba..7b5847be608e 100644 --- a/gfx/layers/ipc/ShadowLayersParent.cpp +++ b/gfx/layers/ipc/ShadowLayersParent.cpp @@ -422,14 +422,11 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray& cset, RenderTraceInvalidateStart(canvas, "FF00FF", canvas->GetVisibleRegion().GetBounds()); canvas->SetAllocator(this); - CanvasSurface newBack = CanvasSurface(null_t()); + CanvasSurface newBack; canvas->Swap(op.newFrontBuffer(), op.needYFlip(), &newBack); canvas->Updated(); - - if (newBack.type() != CanvasSurface::Tnull_t) { - replyv.push_back(OpBufferSwap(shadow, NULL, - newBack)); - } + replyv.push_back(OpBufferSwap(shadow, NULL, + newBack)); RenderTraceInvalidateEnd(canvas, "FF00FF"); break; diff --git a/gfx/layers/opengl/CanvasLayerOGL.cpp b/gfx/layers/opengl/CanvasLayerOGL.cpp index d607de57d1e6..0f783c8346ae 100644 --- a/gfx/layers/opengl/CanvasLayerOGL.cpp +++ b/gfx/layers/opengl/CanvasLayerOGL.cpp @@ -444,6 +444,7 @@ ShadowCanvasLayerOGL::Swap(const CanvasSurface& aNewFront, SurfaceStreamHandle handle = (SurfaceStreamHandle)nullptr; mFrontBufferDescriptor = SurfaceStreamDescriptor(handle, false); } + *aNewBack = mFrontBufferDescriptor; mFrontBufferDescriptor = aNewFront; mNeedsYFlip = needYFlip; } else { From 148aacdb1d69e0ca279c841da942bbc740fcf160 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 18 Mar 2013 12:54:55 -0700 Subject: [PATCH 10/11] Bug 848538 - Followup test bustage fix on a CLOSED TREE. r=me --- toolkit/components/ctypes/tests/unit/test_jsctypes.js.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in b/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in index 214a9d82d491..07d19a1d4d29 100644 --- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in +++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in @@ -2631,9 +2631,11 @@ function run_single_closure_tests(library, abi, suffix) // Code evaluated in a sandbox uses (and pushes) a separate JSContext. // Make sure that we don't run into an assertion caused by a cx stack // mismatch with the cx stashed in the closure. - var sb = Components.utils.Sandbox("http://www.example.com"); - sb.fn = fn_v_t(function() {sb.foo = {};}); - Components.utils.evalInSandbox("fn();", sb); + try { + var sb = Components.utils.Sandbox("http://www.example.com"); + sb.fn = fn_v_t(function() {sb.foo = {};}); + Components.utils.evalInSandbox("fn();", sb); + } catch (e) {} // Components not available in workers. // Make sure that a void callback can't return an error sentinel. var sentinelThrew = false; From 62c6138093df86baf46338c2a7802201cb744ae4 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 18 Mar 2013 12:57:35 -0700 Subject: [PATCH 11/11] Back out Bug 462463 for massively regressing pymake depend build speed. CLOSED TREE --- build/cl.py | 1 - build/unix/add_phony_targets.py | 37 ------- config/expandlibs_exec.py | 3 - config/expandlibs_gen.py | 5 +- config/rules.mk | 13 ++- configure.in | 2 +- js/src/build/cl.py | 1 - js/src/build/unix/add_phony_targets.py | 37 ------- js/src/build/unix/mddepend.pl | 139 +++++++++++++++++++++++++ js/src/config/expandlibs_exec.py | 3 - js/src/config/expandlibs_gen.py | 5 +- js/src/config/rules.mk | 13 ++- js/src/configure.in | 2 +- python/codegen/makeutils.py | 2 - xpcom/idl-parser/header.py | 2 - 15 files changed, 161 insertions(+), 104 deletions(-) delete mode 100644 build/unix/add_phony_targets.py delete mode 100644 js/src/build/unix/add_phony_targets.py create mode 100644 js/src/build/unix/mddepend.pl diff --git a/build/cl.py b/build/cl.py index 8d7c526047d4..00318ade63f2 100644 --- a/build/cl.py +++ b/build/cl.py @@ -57,7 +57,6 @@ def InvokeClWithDependencyGeneration(cmdline): f = open(depstarget, "w") for dep in sorted(deps): print >>f, "%s: %s" % (target, dep) - print >>f, "%s:" % dep if __name__ == "__main__": InvokeClWithDependencyGeneration(sys.argv[1:]) diff --git a/build/unix/add_phony_targets.py b/build/unix/add_phony_targets.py deleted file mode 100644 index 4556bd9415e0..000000000000 --- a/build/unix/add_phony_targets.py +++ /dev/null @@ -1,37 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import pymake.data -import pymake.parser -import pymake.parserdata -import sys - -''' -Modifies the output of Sun Studio's -xM to look more like the output -of gcc's -MD -MP, adding phony targets for dependencies. -''' - - -def add_phony_targets(path): - print path - deps = set() - targets = set() - for stmt in pymake.parser.parsefile(path): - if isinstance(stmt, pymake.parserdata.Rule): - assert isinstance(stmt.depexp, pymake.data.StringExpansion) - assert isinstance(stmt.targetexp, pymake.data.StringExpansion) - for d in stmt.depexp.s.split(): - deps.add(d) - for t in stmt.targetexp.s.split(): - targets.add(t) - phony_targets = deps - targets - if not phony_targets: - return - with open(path, 'a') as f: - f.writelines('%s:\n' % d for d in phony_targets) - - -if __name__ == '__main__': - for f in sys.argv[1:]: - add_phony_targets(f) diff --git a/config/expandlibs_exec.py b/config/expandlibs_exec.py index 2a3274d54301..e93564d781a1 100644 --- a/config/expandlibs_exec.py +++ b/config/expandlibs_exec.py @@ -329,9 +329,6 @@ def main(): with open(options.depend, 'w') as depfile: depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target))) - for dep in deps: - if os.path.isfile(dep) and dep != options.target: - depfile.write("%s :\n" % dep) if __name__ == '__main__': main() diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py index 25962f60c943..4ece9d578816 100644 --- a/config/expandlibs_gen.py +++ b/config/expandlibs_gen.py @@ -44,7 +44,4 @@ if __name__ == '__main__': if options.depend: ensureParentDir(options.depend) with open(options.depend, 'w') as depfile: - deps = ExpandLibsDeps(args) - depfile.write("%s : %s\n" % (options.output, ' '.join(deps))) - for dep in deps: - depfile.write("%s :\n" % dep) + depfile.write("%s : %s\n" % (options.output, ' '.join(ExpandLibsDeps(args)))) diff --git a/config/rules.mk b/config/rules.mk index 826c4ce0ab27..44d8d46ea7f0 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -986,19 +986,17 @@ define MAKE_DEPS_AUTO_CC if test -d $(@D); then \ echo "Building deps for $< using Sun Studio cc"; \ $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \ - $(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \ fi endef define MAKE_DEPS_AUTO_CXX if test -d $(@D); then \ echo "Building deps for $< using Sun Studio CC"; \ $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \ - $(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \ fi endef endif # Sun Studio on Solaris -$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS) +$(OBJS) $(HOST_OBJS): $(GLOBAL_DEPS) # Rules for building native targets must come first because of the host_ prefix $(HOST_COBJS): host_%.$(OBJ_SUFFIX): %.c @@ -1615,7 +1613,14 @@ ifneq (,$(filter-out all chrome default export realchrome tools clean clobber cl MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES)))) ifneq (,$(MDDEPEND_FILES)) -include $(MDDEPEND_FILES) +# The script mddepend.pl checks the dependencies and writes to stdout +# one rule to force out-of-date objects. For example, +# foo.o boo.o: FORCE +# The script has an advantage over including the *.pp files directly +# because it handles the case when header files are removed from the build. +# 'make' would complain that there is no way to build missing headers. +ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES)) +$(eval $(ALL_PP_RESULTS)) endif endif diff --git a/configure.in b/configure.in index b18e333546f6..972687929225 100644 --- a/configure.in +++ b/configure.in @@ -7935,7 +7935,7 @@ dnl ======================================================== MOZ_ARG_HEADER(Build dependencies) if test "$GNU_CC" -a "$GNU_CXX"; then - _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp' + _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)' dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk elif test "$SOLARIS_SUNPRO_CC"; then _DEPEND_CFLAGS= diff --git a/js/src/build/cl.py b/js/src/build/cl.py index 8d7c526047d4..00318ade63f2 100644 --- a/js/src/build/cl.py +++ b/js/src/build/cl.py @@ -57,7 +57,6 @@ def InvokeClWithDependencyGeneration(cmdline): f = open(depstarget, "w") for dep in sorted(deps): print >>f, "%s: %s" % (target, dep) - print >>f, "%s:" % dep if __name__ == "__main__": InvokeClWithDependencyGeneration(sys.argv[1:]) diff --git a/js/src/build/unix/add_phony_targets.py b/js/src/build/unix/add_phony_targets.py deleted file mode 100644 index 4556bd9415e0..000000000000 --- a/js/src/build/unix/add_phony_targets.py +++ /dev/null @@ -1,37 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import pymake.data -import pymake.parser -import pymake.parserdata -import sys - -''' -Modifies the output of Sun Studio's -xM to look more like the output -of gcc's -MD -MP, adding phony targets for dependencies. -''' - - -def add_phony_targets(path): - print path - deps = set() - targets = set() - for stmt in pymake.parser.parsefile(path): - if isinstance(stmt, pymake.parserdata.Rule): - assert isinstance(stmt.depexp, pymake.data.StringExpansion) - assert isinstance(stmt.targetexp, pymake.data.StringExpansion) - for d in stmt.depexp.s.split(): - deps.add(d) - for t in stmt.targetexp.s.split(): - targets.add(t) - phony_targets = deps - targets - if not phony_targets: - return - with open(path, 'a') as f: - f.writelines('%s:\n' % d for d in phony_targets) - - -if __name__ == '__main__': - for f in sys.argv[1:]: - add_phony_targets(f) diff --git a/js/src/build/unix/mddepend.pl b/js/src/build/unix/mddepend.pl new file mode 100644 index 000000000000..231998fdffb8 --- /dev/null +++ b/js/src/build/unix/mddepend.pl @@ -0,0 +1,139 @@ +#!/usr/bin/env perl + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# mddepend.pl - Reads in dependencies generated my -MD flag. Prints list +# of objects that need to be rebuilt. These can then be added to the +# PHONY target. Using this script copes with the problem of header +# files that have been removed from the build. +# +# Usage: +# mddepend.pl +# +# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com). + +use strict; + +use constant DEBUG => 0; + +my $outfile = shift @ARGV; +my $silent = $ENV{MAKEFLAGS} =~ /^\w*s|\s-s/; + +my $line = ''; +my %alldeps; +# Parse dependency files +while (<>) { + s/\r?\n$//; # Handle both unix and DOS line endings + $line .= $_; + if ($line =~ /\\$/) { + chop $line; + next; + } + + $line =~ s|\\|/|g; + + my ($obj,$rest) = split /\s*:\s+/, $line, 2; + $line = ''; + next if !$obj || !$rest; + + my @deps = split /\s+/, $rest; + push @{$alldeps{$obj}}, @deps; + if (DEBUG >= 2) { + foreach my $dep (@deps) { print STDERR "add $obj $dep\n"; } + } +} + +# Test dependencies +my %modtimes; # cache +my @objs; # force rebuild on these +OBJ_LOOP: foreach my $obj (keys %alldeps) { + my $mtime = (stat $obj)[9] or next; + + my %not_in_cache; + my $deps = $alldeps{$obj}; + foreach my $dep_file (@{$deps}) { + my $dep_mtime = $modtimes{$dep_file}; + if (not defined $dep_mtime) { + print STDERR "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2; + $not_in_cache{$dep_file} = 1; + next; + } + + print STDERR "Found $dep_file in cache\n" if DEBUG >= 2; + + if ($dep_mtime > $mtime) { + print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG; + } + elsif ($dep_mtime == -1) { + print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG; + } + else { + print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2; + next; + } + + push @objs, $obj; # dependency is missing or newer + next OBJ_LOOP; # skip checking the rest of the dependencies + } + + foreach my $dep_file (keys %not_in_cache) { + print STDERR "STAT $dep_file for $obj\n" if DEBUG >= 2; + my $dep_mtime = $modtimes{$dep_file} = (stat $dep_file)[9] || -1; + + if ($dep_mtime > $mtime) { + print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG; + } + elsif ($dep_mtime == -1) { + print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG; + } + else { + print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2; + next; + } + + push @objs, $obj; # dependency is missing or newer + next OBJ_LOOP; # skip checking the rest of the dependencies + } + + # If we get here it means nothing needs to be done for $obj +} + +# Output objects to rebuild (if needed). +if ($outfile eq '-') { + if (@objs) { + print "@objs: FORCE\n"; + } +} elsif (@objs) { + my $old_output; + my $new_output = "@objs: FORCE\n"; + + # Read in the current dependencies file. + open(OLD, "<$outfile") + and $old_output = ; + close(OLD); + + # Only write out the dependencies if they are different. + if ($new_output ne $old_output) { + open(OUT, ">$outfile") and print OUT "$new_output"; + print "Updating dependencies file, $outfile\n" unless $silent; + if (DEBUG) { + print "new: $new_output\n"; + print "was: $old_output\n" if $old_output ne ''; + } + } +} elsif (-s $outfile) { + # Remove the old dependencies because all objects are up to date. + print "Removing old dependencies file, $outfile\n" unless $silent; + + if (DEBUG) { + my $old_output; + open(OLD, "<$outfile") + and $old_output = ; + close(OLD); + print "was: $old_output\n"; + } + + unlink $outfile; +} diff --git a/js/src/config/expandlibs_exec.py b/js/src/config/expandlibs_exec.py index 2a3274d54301..e93564d781a1 100644 --- a/js/src/config/expandlibs_exec.py +++ b/js/src/config/expandlibs_exec.py @@ -329,9 +329,6 @@ def main(): with open(options.depend, 'w') as depfile: depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target))) - for dep in deps: - if os.path.isfile(dep) and dep != options.target: - depfile.write("%s :\n" % dep) if __name__ == '__main__': main() diff --git a/js/src/config/expandlibs_gen.py b/js/src/config/expandlibs_gen.py index 25962f60c943..4ece9d578816 100644 --- a/js/src/config/expandlibs_gen.py +++ b/js/src/config/expandlibs_gen.py @@ -44,7 +44,4 @@ if __name__ == '__main__': if options.depend: ensureParentDir(options.depend) with open(options.depend, 'w') as depfile: - deps = ExpandLibsDeps(args) - depfile.write("%s : %s\n" % (options.output, ' '.join(deps))) - for dep in deps: - depfile.write("%s :\n" % dep) + depfile.write("%s : %s\n" % (options.output, ' '.join(ExpandLibsDeps(args)))) diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 826c4ce0ab27..44d8d46ea7f0 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -986,19 +986,17 @@ define MAKE_DEPS_AUTO_CC if test -d $(@D); then \ echo "Building deps for $< using Sun Studio cc"; \ $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \ - $(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \ fi endef define MAKE_DEPS_AUTO_CXX if test -d $(@D); then \ echo "Building deps for $< using Sun Studio CC"; \ $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \ - $(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \ fi endef endif # Sun Studio on Solaris -$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS) +$(OBJS) $(HOST_OBJS): $(GLOBAL_DEPS) # Rules for building native targets must come first because of the host_ prefix $(HOST_COBJS): host_%.$(OBJ_SUFFIX): %.c @@ -1615,7 +1613,14 @@ ifneq (,$(filter-out all chrome default export realchrome tools clean clobber cl MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES)))) ifneq (,$(MDDEPEND_FILES)) -include $(MDDEPEND_FILES) +# The script mddepend.pl checks the dependencies and writes to stdout +# one rule to force out-of-date objects. For example, +# foo.o boo.o: FORCE +# The script has an advantage over including the *.pp files directly +# because it handles the case when header files are removed from the build. +# 'make' would complain that there is no way to build missing headers. +ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES)) +$(eval $(ALL_PP_RESULTS)) endif endif diff --git a/js/src/configure.in b/js/src/configure.in index 05e8b6a630c9..e9eb614a9f12 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -3976,7 +3976,7 @@ dnl ======================================================== MOZ_ARG_HEADER(Build dependencies) if test "$GNU_CC" -a "$GNU_CXX"; then - _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp' + _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)' dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk elif test "$SOLARIS_SUNPRO_CC"; then _DEPEND_CFLAGS= diff --git a/python/codegen/makeutils.py b/python/codegen/makeutils.py index 0a7ede1ab631..da53162d70bb 100644 --- a/python/codegen/makeutils.py +++ b/python/codegen/makeutils.py @@ -18,6 +18,4 @@ def writeMakeDependOutput(filename): f.write('\n\n') for filename in targets[1:]: f.write('%s: %s\n' % (makeQuote(filename), makeQuote(targets[0]))) - for filename in dependencies: - f.write('%s:\n' % filename) diff --git a/xpcom/idl-parser/header.py b/xpcom/idl-parser/header.py index 7725eeddee18..2102ab02e007 100644 --- a/xpcom/idl-parser/header.py +++ b/xpcom/idl-parser/header.py @@ -538,5 +538,3 @@ if __name__ == '__main__': deps = [dep.replace('\\', '/') for dep in idl.deps] print >>depfd, "%s: %s" % (options.outfile, " ".join(deps)) - for dep in deps: - print >>depfd, "%s:" % dep