diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index 0dcfc4402cb4..fadb281bfd36 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -194,7 +194,7 @@ struct DrawSurfaceOptions { class GradientStops : public external::AtomicRefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GradientStops) - virtual ~GradientStops() {} + virtual ~GradientStops() = default; virtual BackendType GetBackendType() const = 0; virtual bool IsValid() const { return true; } @@ -211,12 +211,12 @@ class GradientStops : public external::AtomicRefCounted { */ class Pattern { public: - virtual ~Pattern() {} + virtual ~Pattern() = default; virtual PatternType GetType() const = 0; protected: - Pattern() {} + Pattern() = default; }; class ColorPattern : public Pattern { @@ -225,7 +225,7 @@ class ColorPattern : public Pattern { // creating a ColorPattern. explicit ColorPattern(const Color &aColor) : mColor(aColor) {} - virtual PatternType GetType() const override { return PatternType::COLOR; } + PatternType GetType() const override { return PatternType::COLOR; } Color mColor; }; @@ -242,9 +242,7 @@ class LinearGradientPattern : public Pattern { GradientStops *aStops, const Matrix &aMatrix = Matrix()) : mBegin(aBegin), mEnd(aEnd), mStops(aStops), mMatrix(aMatrix) {} - virtual PatternType GetType() const override { - return PatternType::LINEAR_GRADIENT; - } + PatternType GetType() const override { return PatternType::LINEAR_GRADIENT; } Point mBegin; //!< Start of the linear gradient Point mEnd; /**< End of the linear gradient - NOTE: In the case @@ -276,9 +274,7 @@ class RadialGradientPattern : public Pattern { mStops(aStops), mMatrix(aMatrix) {} - virtual PatternType GetType() const override { - return PatternType::RADIAL_GRADIENT; - } + PatternType GetType() const override { return PatternType::RADIAL_GRADIENT; } Point mCenter1; //!< Center of the inner (focal) circle. Point mCenter2; //!< Center of the outer circle. @@ -308,7 +304,7 @@ class SurfacePattern : public Pattern { mMatrix(aMatrix), mSamplingRect(aSamplingRect) {} - virtual PatternType GetType() const override { return PatternType::SURFACE; } + PatternType GetType() const override { return PatternType::SURFACE; } RefPtr mSurface; //!< Surface to use for drawing ExtendMode mExtendMode; /**< This determines how the image is extended @@ -338,7 +334,7 @@ class DrawTargetCaptureImpl; class SourceSurface : public external::AtomicRefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurface) - virtual ~SourceSurface() {} + virtual ~SourceSurface() = default; virtual SurfaceType GetType() const = 0; virtual IntSize GetSize() const = 0; @@ -429,7 +425,7 @@ class DataSourceSurface : public SourceSurface { */ class ScopedMap final { public: - explicit ScopedMap(DataSourceSurface *aSurface, MapType aType) + ScopedMap(DataSourceSurface *aSurface, MapType aType) : mSurface(aSurface), mIsMapped(aSurface->Map(aType, &mMap)) {} ScopedMap(ScopedMap &&aOther) @@ -484,7 +480,7 @@ class DataSourceSurface : public SourceSurface { bool mIsMapped; }; - virtual SurfaceType GetType() const override { return SurfaceType::DATA; } + SurfaceType GetType() const override { return SurfaceType::DATA; } /** @deprecated * Get the raw bitmap data of the surface. * Can return null if there was OOM allocating surface data. @@ -535,7 +531,7 @@ class DataSourceSurface : public SourceSurface { * The returning surface might be null, because of OOM or gfx device reset. * The caller needs to do null-check before using it. */ - virtual already_AddRefed GetDataSurface() override; + already_AddRefed GetDataSurface() override; /** * Add the size of the underlying data buffer to the aggregate. @@ -570,7 +566,7 @@ class DataSourceSurface : public SourceSurface { class PathSink : public RefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathSink) - virtual ~PathSink() {} + virtual ~PathSink() = default; /** Move the current point in the path, any figure currently being drawn will * be considered closed during fill operations, however when stroking the @@ -894,7 +890,7 @@ class NativeFontResource uint32_t aIndex, const uint8_t *aInstanceData, uint32_t aInstanceDataLength) = 0; - virtual ~NativeFontResource() {} + virtual ~NativeFontResource() = default; }; class DrawTargetCapture; @@ -911,7 +907,7 @@ class DrawTarget : public external::AtomicRefCounted { : mTransformDirty(false), mPermitSubpixelAA(false), mFormat(SurfaceFormat::UNKNOWN) {} - virtual ~DrawTarget() {} + virtual ~DrawTarget() = default; virtual bool IsValid() const { return true; }; virtual DrawTargetType GetType() const = 0; @@ -1519,7 +1515,7 @@ class DrawTarget : public external::AtomicRefCounted { class DrawTargetCapture : public DrawTarget { public: - virtual bool IsCaptureDT() const override { return true; } + bool IsCaptureDT() const override { return true; } virtual bool IsEmpty() const = 0; virtual void Dump() = 0; @@ -1530,7 +1526,7 @@ class DrawEventRecorder : public RefCounted { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorder) // returns true if there were any items in the recording virtual bool Finish() = 0; - virtual ~DrawEventRecorder() {} + virtual ~DrawEventRecorder() = default; }; struct Tile { diff --git a/gfx/2d/Blur.h b/gfx/2d/Blur.h index ca8b4b99fb0f..32c60b478bce 100644 --- a/gfx/2d/Blur.h +++ b/gfx/2d/Blur.h @@ -36,7 +36,7 @@ namespace gfx { * A spread N makes each output pixel the maximum value of all source * pixels within a square of side length 2N+1 centered on the output pixel. */ -class GFX2D_API AlphaBoxBlur { +class GFX2D_API AlphaBoxBlur final { public: /** Constructs a box blur and computes the backing surface size. * diff --git a/gfx/2d/ConvolutionFilter.h b/gfx/2d/ConvolutionFilter.h index 6cb23c5bd8cd..2a03e8277b8a 100644 --- a/gfx/2d/ConvolutionFilter.h +++ b/gfx/2d/ConvolutionFilter.h @@ -14,7 +14,7 @@ class SkConvolutionFilter1D; namespace mozilla { namespace gfx { -class ConvolutionFilter { +class ConvolutionFilter final { public: ConvolutionFilter(); ~ConvolutionFilter(); diff --git a/gfx/2d/CriticalSection.h b/gfx/2d/CriticalSection.h index 1529ca67c1aa..4ecb9d26e85f 100644 --- a/gfx/2d/CriticalSection.h +++ b/gfx/2d/CriticalSection.h @@ -67,7 +67,7 @@ class CriticalSection { #endif /// RAII helper. -struct CriticalSectionAutoEnter { +struct CriticalSectionAutoEnter final { explicit CriticalSectionAutoEnter(CriticalSection* aSection) : mSection(aSection) { mSection->Enter(); diff --git a/gfx/2d/DataSourceSurfaceWrapper.h b/gfx/2d/DataSourceSurfaceWrapper.h index f6482b864805..63116256339e 100644 --- a/gfx/2d/DataSourceSurfaceWrapper.h +++ b/gfx/2d/DataSourceSurfaceWrapper.h @@ -25,15 +25,13 @@ class DataSourceSurfaceWrapper final : public DataSourceSurface { mSurface->Equals(aOther, aSymmetric); } - virtual SurfaceType GetType() const override { return SurfaceType::DATA; } + SurfaceType GetType() const override { return SurfaceType::DATA; } - virtual uint8_t *GetData() override { return mSurface->GetData(); } - virtual int32_t Stride() override { return mSurface->Stride(); } - virtual IntSize GetSize() const override { return mSurface->GetSize(); } - virtual SurfaceFormat GetFormat() const override { - return mSurface->GetFormat(); - } - virtual bool IsValid() const override { return mSurface->IsValid(); } + uint8_t *GetData() override { return mSurface->GetData(); } + int32_t Stride() override { return mSurface->Stride(); } + IntSize GetSize() const override { return mSurface->GetSize(); } + SurfaceFormat GetFormat() const override { return mSurface->GetFormat(); } + bool IsValid() const override { return mSurface->IsValid(); } bool Map(MapType aType, MappedSurface *aMappedSurface) override { return mSurface->Map(aType, aMappedSurface); diff --git a/gfx/2d/DrawCommand.h b/gfx/2d/DrawCommand.h index 7c2ef0a1de63..ec9f1e9bfc0a 100644 --- a/gfx/2d/DrawCommand.h +++ b/gfx/2d/DrawCommand.h @@ -52,7 +52,7 @@ enum class CommandType : int8_t { class DrawingCommand { public: - virtual ~DrawingCommand() {} + virtual ~DrawingCommand() = default; virtual CommandType GetType() const = 0; virtual void ExecuteOnDT(DrawTarget* aDT, diff --git a/gfx/2d/DrawCommands.h b/gfx/2d/DrawCommands.h index eca34a5fd210..eb7d1e8f1ecd 100644 --- a/gfx/2d/DrawCommands.h +++ b/gfx/2d/DrawCommands.h @@ -38,7 +38,7 @@ class StrokeOptionsCommand : public DrawingCommand { } } - virtual ~StrokeOptionsCommand() {} + virtual ~StrokeOptionsCommand() = default; protected: StrokeOptions mStrokeOptions; @@ -867,8 +867,7 @@ class SetTransformCommand : public DrawingCommand { CLONE_INTO(SetTransformCommand)(mTransform); } - virtual void ExecuteOnDT(DrawTarget* aDT, - const Matrix* aMatrix) const override { + void ExecuteOnDT(DrawTarget* aDT, const Matrix* aMatrix) const override { if (aMatrix) { aDT->SetTransform(mTransform * (*aMatrix)); } else { @@ -902,8 +901,7 @@ class SetPermitSubpixelAACommand : public DrawingCommand { CLONE_INTO(SetPermitSubpixelAACommand)(mPermitSubpixelAA); } - virtual void ExecuteOnDT(DrawTarget* aDT, - const Matrix* aMatrix) const override { + void ExecuteOnDT(DrawTarget* aDT, const Matrix* aMatrix) const override { aDT->SetPermitSubpixelAA(mPermitSubpixelAA); } @@ -921,7 +919,7 @@ class SetPermitSubpixelAACommand : public DrawingCommand { class FlushCommand : public DrawingCommand { public: - explicit FlushCommand() {} + FlushCommand() = default; CommandType GetType() const override { return FlushCommand::Type; } diff --git a/gfx/2d/DrawEventRecorder.h b/gfx/2d/DrawEventRecorder.h index 628eff084071..49bdfc97e99a 100644 --- a/gfx/2d/DrawEventRecorder.h +++ b/gfx/2d/DrawEventRecorder.h @@ -29,8 +29,8 @@ class DrawEventRecorderPrivate : public DrawEventRecorder { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorderPrivate, override) DrawEventRecorderPrivate(); - virtual ~DrawEventRecorderPrivate() {} - virtual bool Finish() override { + virtual ~DrawEventRecorderPrivate() = default; + bool Finish() override { ClearResources(); return true; } @@ -136,7 +136,7 @@ class DrawEventRecorderFile : public DrawEventRecorderPrivate { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawEventRecorderFile, override) explicit DrawEventRecorderFile(const char_type* aFilename); - ~DrawEventRecorderFile(); + virtual ~DrawEventRecorderFile(); void RecordEvent(const RecordedEvent& aEvent) override; @@ -211,7 +211,7 @@ class DrawEventRecorderMemory : public DrawEventRecorderPrivate { MemStream mIndex; protected: - ~DrawEventRecorderMemory(){}; + virtual ~DrawEventRecorderMemory(){}; private: SerializeResourcesFn mSerializeCallback; diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index e7a88a359ee3..124d1be02cc8 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -387,7 +387,7 @@ static cairo_surface_t* GetCairoSurfaceForSourceSurface( // An RAII class to temporarily clear any device offset set // on a surface. Note that this does not take a reference to the // surface. -class AutoClearDeviceOffset { +class AutoClearDeviceOffset final { public: explicit AutoClearDeviceOffset(SourceSurface* aSurface) : mSurface(nullptr), mX(0), mY(0) { diff --git a/gfx/2d/DrawTargetCairo.h b/gfx/2d/DrawTargetCairo.h index 0f4bc20c78e7..f23e44f94075 100644 --- a/gfx/2d/DrawTargetCairo.h +++ b/gfx/2d/DrawTargetCairo.h @@ -30,7 +30,7 @@ class GradientStopsCairo : public GradientStops { } } - virtual ~GradientStopsCairo() {} + virtual ~GradientStopsCairo() = default; const std::vector &GetStops() const { return mStops; } diff --git a/gfx/2d/DrawTargetCapture.h b/gfx/2d/DrawTargetCapture.h index c5467df794c0..d2f2757dff16 100644 --- a/gfx/2d/DrawTargetCapture.h +++ b/gfx/2d/DrawTargetCapture.h @@ -19,7 +19,7 @@ class DrawingCommand; class SourceSurfaceCapture; class AlphaBoxBlur; -class DrawTargetCaptureImpl : public DrawTargetCapture { +class DrawTargetCaptureImpl final : public DrawTargetCapture { friend class SourceSurfaceCapture; public: @@ -30,108 +30,104 @@ class DrawTargetCaptureImpl : public DrawTargetCapture { bool Init(const IntSize &aSize, DrawTarget *aRefDT); void InitForData(int32_t aStride, size_t aSurfaceAllocationSize); - virtual BackendType GetBackendType() const override { + BackendType GetBackendType() const override { return mRefDT->GetBackendType(); } - virtual DrawTargetType GetType() const override { return mRefDT->GetType(); } - virtual bool IsCaptureDT() const override { return true; } - virtual already_AddRefed Snapshot() override; - virtual already_AddRefed IntoLuminanceSource( + DrawTargetType GetType() const override { return mRefDT->GetType(); } + bool IsCaptureDT() const override { return true; } + already_AddRefed Snapshot() override; + already_AddRefed IntoLuminanceSource( LuminanceType aLuminanceType, float aOpacity) override; - virtual void SetPermitSubpixelAA(bool aPermitSubpixelAA) override; - virtual void DetachAllSnapshots() override; - virtual IntSize GetSize() const override { return mSize; } - virtual void Flush() override {} - virtual void DrawSurface(SourceSurface *aSurface, const Rect &aDest, - const Rect &aSource, - const DrawSurfaceOptions &aSurfOptions, - const DrawOptions &aOptions) override; - virtual void DrawFilter(FilterNode *aNode, const Rect &aSourceRect, - const Point &aDestPoint, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void DrawSurfaceWithShadow(SourceSurface *aSurface, - const Point &aDest, const Color &aColor, - const Point &aOffset, Float aSigma, - CompositionOp aOperator) override; + void SetPermitSubpixelAA(bool aPermitSubpixelAA) override; + void DetachAllSnapshots() override; + IntSize GetSize() const override { return mSize; } + void Flush() override {} + void DrawSurface(SourceSurface *aSurface, const Rect &aDest, + const Rect &aSource, const DrawSurfaceOptions &aSurfOptions, + const DrawOptions &aOptions) override; + void DrawFilter(FilterNode *aNode, const Rect &aSourceRect, + const Point &aDestPoint, + const DrawOptions &aOptions = DrawOptions()) override; + void DrawSurfaceWithShadow(SourceSurface *aSurface, const Point &aDest, + const Color &aColor, const Point &aOffset, + Float aSigma, CompositionOp aOperator) override; - virtual void ClearRect(const Rect &aRect) override; - virtual void MaskSurface( - const Pattern &aSource, SourceSurface *aMask, Point aOffset, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect, - const IntPoint &aDestination) override; - virtual void CopyRect(const IntRect &aSourceRect, - const IntPoint &aDestination) override; + void ClearRect(const Rect &aRect) override; + void MaskSurface(const Pattern &aSource, SourceSurface *aMask, Point aOffset, + const DrawOptions &aOptions = DrawOptions()) override; + void CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect, + const IntPoint &aDestination) override; + void CopyRect(const IntRect &aSourceRect, + const IntPoint &aDestination) override; - virtual void FillRect(const Rect &aRect, const Pattern &aPattern, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void FillRoundedRect( - const RoundedRect &aRect, const Pattern &aPattern, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void StrokeRect(const Rect &aRect, const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void StrokeLine(const Point &aStart, const Point &aEnd, - const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void Stroke(const Path *aPath, const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void Fill(const Path *aPath, const Pattern &aPattern, + void FillRect(const Rect &aRect, const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void FillRoundedRect(const RoundedRect &aRect, const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void StrokeRect(const Rect &aRect, const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) override; + void StrokeLine(const Point &aStart, const Point &aEnd, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) override; + void Stroke(const Path *aPath, const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) override; + void Fill(const Path *aPath, const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void StrokeGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), const DrawOptions &aOptions = DrawOptions()) override; - virtual void FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, - const Pattern &aPattern, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void StrokeGlyphs( - ScaledFont *aFont, const GlyphBuffer &aBuffer, const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void Mask(const Pattern &aSource, const Pattern &aMask, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void PushClip(const Path *aPath) override; - virtual void PushClipRect(const Rect &aRect) override; - virtual void PopClip() override; - virtual void PushLayer(bool aOpaque, Float aOpacity, SourceSurface *aMask, - const Matrix &aMaskTransform, const IntRect &aBounds, - bool aCopyBackground) override; - virtual void PopLayer() override; - virtual void Blur(const AlphaBoxBlur &aBlur) override; - virtual void PadEdges(const IntRegion &aRegion) override; + void Mask(const Pattern &aSource, const Pattern &aMask, + const DrawOptions &aOptions = DrawOptions()) override; + void PushClip(const Path *aPath) override; + void PushClipRect(const Rect &aRect) override; + void PopClip() override; + void PushLayer(bool aOpaque, Float aOpacity, SourceSurface *aMask, + const Matrix &aMaskTransform, const IntRect &aBounds, + bool aCopyBackground) override; + void PopLayer() override; + void Blur(const AlphaBoxBlur &aBlur) override; + void PadEdges(const IntRegion &aRegion) override; - virtual void SetTransform(const Matrix &aTransform) override; + void SetTransform(const Matrix &aTransform) override; - virtual bool SupportsRegionClipping() const override { + bool SupportsRegionClipping() const override { return mRefDT->SupportsRegionClipping(); } - virtual already_AddRefed CreateSourceSurfaceFromData( + already_AddRefed CreateSourceSurfaceFromData( unsigned char *aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat) const override { return mRefDT->CreateSourceSurfaceFromData(aData, aSize, aStride, aFormat); } - virtual already_AddRefed OptimizeSourceSurface( + already_AddRefed OptimizeSourceSurface( SourceSurface *aSurface) const override; - virtual already_AddRefed CreateSourceSurfaceFromNativeSurface( + already_AddRefed CreateSourceSurfaceFromNativeSurface( const NativeSurface &aSurface) const override { return mRefDT->CreateSourceSurfaceFromNativeSurface(aSurface); } - virtual already_AddRefed CreateSimilarDrawTarget( + already_AddRefed CreateSimilarDrawTarget( const IntSize &aSize, SurfaceFormat aFormat) const override; - virtual RefPtr CreateSimilarRasterTarget( + RefPtr CreateSimilarRasterTarget( const IntSize &aSize, SurfaceFormat aFormat) const override; - virtual already_AddRefed CreatePathBuilder( + already_AddRefed CreatePathBuilder( FillRule aFillRule = FillRule::FILL_WINDING) const override; - virtual already_AddRefed CreateGradientStops( + already_AddRefed CreateGradientStops( GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = ExtendMode::CLAMP) const override { return mRefDT->CreateGradientStops(aStops, aNumStops, aExtendMode); } - virtual already_AddRefed CreateFilter(FilterType aType) override; + already_AddRefed CreateFilter(FilterType aType) override; void ReplayToDrawTarget(DrawTarget *aDT, const Matrix &aTransform); diff --git a/gfx/2d/DrawTargetDual.cpp b/gfx/2d/DrawTargetDual.cpp index 1d84bf6a8ac7..a81eefa374bf 100644 --- a/gfx/2d/DrawTargetDual.cpp +++ b/gfx/2d/DrawTargetDual.cpp @@ -37,7 +37,7 @@ class DualSurface { * case can we be dealing with a 'dual' source (SourceSurfaceDual) and do * we need to pass separate patterns into our destination DrawTargets. */ -class DualPattern { +class DualPattern final { public: inline explicit DualPattern(const Pattern &aPattern) : mPatternsInitialized(false) { diff --git a/gfx/2d/DrawTargetRecording.cpp b/gfx/2d/DrawTargetRecording.cpp index e33474ab523b..f7e04a1fef0e 100644 --- a/gfx/2d/DrawTargetRecording.cpp +++ b/gfx/2d/DrawTargetRecording.cpp @@ -69,12 +69,10 @@ class SourceSurfaceRecording : public SourceSurface { RecordedSourceSurfaceDestruction(ReferencePtr(this))); } - virtual SurfaceType GetType() const override { - return SurfaceType::RECORDING; - } - virtual IntSize GetSize() const override { return mSize; } - virtual SurfaceFormat GetFormat() const override { return mFormat; } - virtual already_AddRefed GetDataSurface() override { + SurfaceType GetType() const override { return SurfaceType::RECORDING; } + IntSize GetSize() const override { return mSize; } + SurfaceFormat GetFormat() const override { return mFormat; } + already_AddRefed GetDataSurface() override { return nullptr; } @@ -109,13 +107,11 @@ class DataSourceSurfaceRecording : public DataSourceSurface { return nullptr; } - virtual SurfaceType GetType() const override { - return SurfaceType::RECORDING; - } - virtual IntSize GetSize() const override { return mSize; } - virtual int32_t Stride() override { return mStride; } - virtual SurfaceFormat GetFormat() const override { return mFormat; } - virtual uint8_t *GetData() override { return mData.get(); } + SurfaceType GetType() const override { return SurfaceType::RECORDING; } + IntSize GetSize() const override { return mSize; } + int32_t Stride() override { return mStride; } + SurfaceFormat GetFormat() const override { return mFormat; } + uint8_t *GetData() override { return mData.get(); } UniquePtr mData; IntSize mSize; @@ -132,15 +128,13 @@ class GradientStopsRecording : public GradientStops { mRecorder->AddStoredObject(this); } - ~GradientStopsRecording() { + virtual ~GradientStopsRecording() { mRecorder->RemoveStoredObject(this); mRecorder->RecordEvent( RecordedGradientStopsDestruction(ReferencePtr(this))); } - virtual BackendType GetBackendType() const override { - return BackendType::RECORDING; - } + BackendType GetBackendType() const override { return BackendType::RECORDING; } RefPtr mRecorder; }; @@ -155,27 +149,27 @@ class FilterNodeRecording : public FilterNode { mRecorder->AddStoredObject(this); } - ~FilterNodeRecording() { + virtual ~FilterNodeRecording() { mRecorder->RemoveStoredObject(this); mRecorder->RecordEvent(RecordedFilterNodeDestruction(ReferencePtr(this))); } - virtual void SetInput(uint32_t aIndex, SourceSurface *aSurface) override { + void SetInput(uint32_t aIndex, SourceSurface *aSurface) override { EnsureSurfaceStoredRecording(mRecorder, aSurface, "SetInput"); mRecorder->RecordEvent(RecordedFilterNodeSetInput(this, aIndex, aSurface)); } - virtual void SetInput(uint32_t aIndex, FilterNode *aFilter) override { + void SetInput(uint32_t aIndex, FilterNode *aFilter) override { MOZ_ASSERT(mRecorder->HasStoredObject(aFilter)); mRecorder->RecordEvent(RecordedFilterNodeSetInput(this, aIndex, aFilter)); } -#define FORWARD_SET_ATTRIBUTE(type, argtype) \ - virtual void SetAttribute(uint32_t aIndex, type aValue) override { \ - mRecorder->RecordEvent(RecordedFilterNodeSetAttribute( \ - this, aIndex, aValue, \ - RecordedFilterNodeSetAttribute::ARGTYPE_##argtype)); \ +#define FORWARD_SET_ATTRIBUTE(type, argtype) \ + void SetAttribute(uint32_t aIndex, type aValue) override { \ + mRecorder->RecordEvent(RecordedFilterNodeSetAttribute( \ + this, aIndex, aValue, \ + RecordedFilterNodeSetAttribute::ARGTYPE_##argtype)); \ } FORWARD_SET_ATTRIBUTE(bool, BOOL); @@ -194,15 +188,13 @@ class FilterNodeRecording : public FilterNode { #undef FORWARD_SET_ATTRIBUTE - virtual void SetAttribute(uint32_t aIndex, const Float *aFloat, - uint32_t aSize) override { + void SetAttribute(uint32_t aIndex, const Float *aFloat, + uint32_t aSize) override { mRecorder->RecordEvent( RecordedFilterNodeSetAttribute(this, aIndex, aFloat, aSize)); } - virtual FilterBackend GetBackendType() override { - return FILTER_BACKEND_RECORDING; - } + FilterBackend GetBackendType() override { return FILTER_BACKEND_RECORDING; } RefPtr mRecorder; }; diff --git a/gfx/2d/DrawTargetTiled.h b/gfx/2d/DrawTargetTiled.h index 6c06ac010ccd..5b6d80539fab 100644 --- a/gfx/2d/DrawTargetTiled.h +++ b/gfx/2d/DrawTargetTiled.h @@ -34,126 +34,124 @@ class DrawTargetTiled : public DrawTarget { bool Init(const TileSet &mTiles); - virtual bool IsTiledDrawTarget() const override { return true; } + bool IsTiledDrawTarget() const override { return true; } - virtual bool IsCaptureDT() const override { + bool IsCaptureDT() const override { return mTiles[0].mDrawTarget->IsCaptureDT(); } - virtual DrawTargetType GetType() const override { + DrawTargetType GetType() const override { return mTiles[0].mDrawTarget->GetType(); } - virtual BackendType GetBackendType() const override { + BackendType GetBackendType() const override { return mTiles[0].mDrawTarget->GetBackendType(); } - virtual already_AddRefed Snapshot() override; - virtual void DetachAllSnapshots() override; - virtual IntSize GetSize() const override { + already_AddRefed Snapshot() override; + void DetachAllSnapshots() override; + IntSize GetSize() const override { MOZ_ASSERT(mRect.Width() > 0 && mRect.Height() > 0); return IntSize(mRect.XMost(), mRect.YMost()); } - virtual IntRect GetRect() const override { return mRect; } + IntRect GetRect() const override { return mRect; } - virtual void Flush() override; - virtual void DrawSurface(SourceSurface *aSurface, const Rect &aDest, - const Rect &aSource, - const DrawSurfaceOptions &aSurfOptions, - const DrawOptions &aOptions) override; - virtual void DrawFilter(FilterNode *aNode, const Rect &aSourceRect, - const Point &aDestPoint, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void DrawSurfaceWithShadow( + void Flush() override; + void DrawSurface(SourceSurface *aSurface, const Rect &aDest, + const Rect &aSource, const DrawSurfaceOptions &aSurfOptions, + const DrawOptions &aOptions) override; + void DrawFilter(FilterNode *aNode, const Rect &aSourceRect, + const Point &aDestPoint, + const DrawOptions &aOptions = DrawOptions()) override; + void DrawSurfaceWithShadow( SourceSurface *aSurface, const Point &aDest, const Color &aColor, const Point &aOffset, Float aSigma, CompositionOp aOperator) override { /* Not implemented */ MOZ_CRASH("GFX: DrawSurfaceWithShadow"); } - virtual void ClearRect(const Rect &aRect) override; - virtual void MaskSurface( - const Pattern &aSource, SourceSurface *aMask, Point aOffset, - const DrawOptions &aOptions = DrawOptions()) override; + void ClearRect(const Rect &aRect) override; + void MaskSurface(const Pattern &aSource, SourceSurface *aMask, Point aOffset, + const DrawOptions &aOptions = DrawOptions()) override; - virtual void CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect, - const IntPoint &aDestination) override; + void CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect, + const IntPoint &aDestination) override; - virtual void FillRect(const Rect &aRect, const Pattern &aPattern, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void StrokeRect(const Rect &aRect, const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void StrokeLine(const Point &aStart, const Point &aEnd, - const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void Stroke(const Path *aPath, const Pattern &aPattern, - const StrokeOptions &aStrokeOptions = StrokeOptions(), - const DrawOptions &aOptions = DrawOptions()) override; - virtual void Fill(const Path *aPath, const Pattern &aPattern, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, - const Pattern &aPattern, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void Mask(const Pattern &aSource, const Pattern &aMask, - const DrawOptions &aOptions = DrawOptions()) override; - virtual void PushClip(const Path *aPath) override; - virtual void PushClipRect(const Rect &aRect) override; - virtual void PopClip() override; - virtual void PushLayer(bool aOpaque, Float aOpacity, SourceSurface *aMask, - const Matrix &aMaskTransform, - const IntRect &aBounds = IntRect(), - bool aCopyBackground = false) override; - virtual void PushLayerWithBlend( - bool aOpaque, Float aOpacity, SourceSurface *aMask, - const Matrix &aMaskTransform, const IntRect &aBounds = IntRect(), - bool aCopyBackground = false, - CompositionOp = CompositionOp::OP_OVER) override; - virtual void PopLayer() override; + void FillRect(const Rect &aRect, const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void StrokeRect(const Rect &aRect, const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) override; + void StrokeLine(const Point &aStart, const Point &aEnd, + const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) override; + void Stroke(const Path *aPath, const Pattern &aPattern, + const StrokeOptions &aStrokeOptions = StrokeOptions(), + const DrawOptions &aOptions = DrawOptions()) override; + void Fill(const Path *aPath, const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, + const Pattern &aPattern, + const DrawOptions &aOptions = DrawOptions()) override; + void Mask(const Pattern &aSource, const Pattern &aMask, + const DrawOptions &aOptions = DrawOptions()) override; + void PushClip(const Path *aPath) override; + void PushClipRect(const Rect &aRect) override; + void PopClip() override; + void PushLayer(bool aOpaque, Float aOpacity, SourceSurface *aMask, + const Matrix &aMaskTransform, + const IntRect &aBounds = IntRect(), + bool aCopyBackground = false) override; + void PushLayerWithBlend(bool aOpaque, Float aOpacity, SourceSurface *aMask, + const Matrix &aMaskTransform, + const IntRect &aBounds = IntRect(), + bool aCopyBackground = false, + CompositionOp = CompositionOp::OP_OVER) override; + void PopLayer() override; - virtual void PadEdges(const IntRegion &aRegion) override; + void PadEdges(const IntRegion &aRegion) override; - virtual void SetTransform(const Matrix &aTransform) override; + void SetTransform(const Matrix &aTransform) override; - virtual void SetPermitSubpixelAA(bool aPermitSubpixelAA) override; + void SetPermitSubpixelAA(bool aPermitSubpixelAA) override; - virtual already_AddRefed CreateSourceSurfaceFromData( + already_AddRefed CreateSourceSurfaceFromData( unsigned char *aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat) const override { return mTiles[0].mDrawTarget->CreateSourceSurfaceFromData(aData, aSize, aStride, aFormat); } - virtual already_AddRefed OptimizeSourceSurface( + already_AddRefed OptimizeSourceSurface( SourceSurface *aSurface) const override { return mTiles[0].mDrawTarget->OptimizeSourceSurface(aSurface); } - virtual already_AddRefed CreateSourceSurfaceFromNativeSurface( + already_AddRefed CreateSourceSurfaceFromNativeSurface( const NativeSurface &aSurface) const override { return mTiles[0].mDrawTarget->CreateSourceSurfaceFromNativeSurface( aSurface); } - virtual already_AddRefed CreateSimilarDrawTarget( + already_AddRefed CreateSimilarDrawTarget( const IntSize &aSize, SurfaceFormat aFormat) const override { return mTiles[0].mDrawTarget->CreateSimilarDrawTarget(aSize, aFormat); } - virtual bool CanCreateSimilarDrawTarget( - const IntSize &aSize, SurfaceFormat aFormat) const override { + bool CanCreateSimilarDrawTarget(const IntSize &aSize, + SurfaceFormat aFormat) const override { return mTiles[0].mDrawTarget->CanCreateSimilarDrawTarget(aSize, aFormat); } - virtual already_AddRefed CreatePathBuilder( + already_AddRefed CreatePathBuilder( FillRule aFillRule = FillRule::FILL_WINDING) const override { return mTiles[0].mDrawTarget->CreatePathBuilder(aFillRule); } - virtual already_AddRefed CreateGradientStops( + already_AddRefed CreateGradientStops( GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = ExtendMode::CLAMP) const override { return mTiles[0].mDrawTarget->CreateGradientStops(aStops, aNumStops, aExtendMode); } - virtual already_AddRefed CreateFilter(FilterType aType) override { + already_AddRefed CreateFilter(FilterType aType) override { return mTiles[0].mDrawTarget->CreateFilter(aType); } @@ -185,17 +183,17 @@ class SnapshotTiled : public SourceSurface { } } - virtual SurfaceType GetType() const override { return SurfaceType::TILED; } - virtual IntSize GetSize() const override { + SurfaceType GetType() const override { return SurfaceType::TILED; } + IntSize GetSize() const override { MOZ_ASSERT(mRect.Width() > 0 && mRect.Height() > 0); return IntSize(mRect.XMost(), mRect.YMost()); } - virtual IntRect GetRect() const override { return mRect; } - virtual SurfaceFormat GetFormat() const override { + IntRect GetRect() const override { return mRect; } + SurfaceFormat GetFormat() const override { return mSnapshots[0]->GetFormat(); } - virtual already_AddRefed GetDataSurface() override { + already_AddRefed GetDataSurface() override { RefPtr surf = Factory::CreateDataSourceSurface(mRect.Size(), GetFormat()); if (!surf) { diff --git a/gfx/2d/DrawTargetWrapAndRecord.cpp b/gfx/2d/DrawTargetWrapAndRecord.cpp index c44f566e683e..f44748231501 100644 --- a/gfx/2d/DrawTargetWrapAndRecord.cpp +++ b/gfx/2d/DrawTargetWrapAndRecord.cpp @@ -92,14 +92,12 @@ class SourceSurfaceWrapAndRecord : public SourceSurface { RecordedSourceSurfaceDestruction(ReferencePtr(this))); } - virtual SurfaceType GetType() const override { - return SurfaceType::RECORDING; - } - virtual IntSize GetSize() const override { return mFinalSurface->GetSize(); } - virtual SurfaceFormat GetFormat() const override { + SurfaceType GetType() const override { return SurfaceType::RECORDING; } + IntSize GetSize() const override { return mFinalSurface->GetSize(); } + SurfaceFormat GetFormat() const override { return mFinalSurface->GetFormat(); } - virtual already_AddRefed GetDataSurface() override { + already_AddRefed GetDataSurface() override { return mFinalSurface->GetDataSurface(); } @@ -123,9 +121,7 @@ class GradientStopsWrapAndRecord : public GradientStops { RecordedGradientStopsDestruction(ReferencePtr(this))); } - virtual BackendType GetBackendType() const override { - return BackendType::RECORDING; - } + BackendType GetBackendType() const override { return BackendType::RECORDING; } RefPtr mFinalGradientStops; RefPtr mRecorder; @@ -173,25 +169,25 @@ class FilterNodeWrapAndRecord : public FilterNode { return static_cast(aNode)->mFinalFilterNode; } - virtual void SetInput(uint32_t aIndex, SourceSurface *aSurface) override { + void SetInput(uint32_t aIndex, SourceSurface *aSurface) override { EnsureSurfaceStored(mRecorder, aSurface, "SetInput"); mRecorder->RecordEvent(RecordedFilterNodeSetInput(this, aIndex, aSurface)); mFinalFilterNode->SetInput(aIndex, GetSourceSurface(aSurface)); } - virtual void SetInput(uint32_t aIndex, FilterNode *aFilter) override { + void SetInput(uint32_t aIndex, FilterNode *aFilter) override { MOZ_ASSERT(mRecorder->HasStoredObject(aFilter)); mRecorder->RecordEvent(RecordedFilterNodeSetInput(this, aIndex, aFilter)); mFinalFilterNode->SetInput(aIndex, GetFilterNode(aFilter)); } -#define FORWARD_SET_ATTRIBUTE(type, argtype) \ - virtual void SetAttribute(uint32_t aIndex, type aValue) override { \ - mRecorder->RecordEvent(RecordedFilterNodeSetAttribute( \ - this, aIndex, aValue, \ - RecordedFilterNodeSetAttribute::ARGTYPE_##argtype)); \ - mFinalFilterNode->SetAttribute(aIndex, aValue); \ +#define FORWARD_SET_ATTRIBUTE(type, argtype) \ + void SetAttribute(uint32_t aIndex, type aValue) override { \ + mRecorder->RecordEvent(RecordedFilterNodeSetAttribute( \ + this, aIndex, aValue, \ + RecordedFilterNodeSetAttribute::ARGTYPE_##argtype)); \ + mFinalFilterNode->SetAttribute(aIndex, aValue); \ } FORWARD_SET_ATTRIBUTE(bool, BOOL); @@ -217,15 +213,13 @@ class FilterNodeWrapAndRecord : public FilterNode { mFinalFilterNode->SetAttribute(aIndex, aFloat, aSize); } - virtual FilterBackend GetBackendType() override { - return FILTER_BACKEND_RECORDING; - } + FilterBackend GetBackendType() override { return FILTER_BACKEND_RECORDING; } RefPtr mFinalFilterNode; RefPtr mRecorder; }; -struct AdjustedPattern { +struct AdjustedPattern final { explicit AdjustedPattern(const Pattern &aPattern) : mPattern(nullptr) { mOrigPattern = const_cast(&aPattern); } diff --git a/gfx/2d/DrawingJob.h b/gfx/2d/DrawingJob.h index 397eb177c9f8..ba5324c9058b 100644 --- a/gfx/2d/DrawingJob.h +++ b/gfx/2d/DrawingJob.h @@ -82,9 +82,9 @@ class CommandBufferBuilder { /// Stores multiple commands to be executed sequencially. class DrawingJob : public Job { public: - ~DrawingJob(); + virtual ~DrawingJob(); - virtual JobStatus Run() override; + JobStatus Run() override; protected: DrawingJob(DrawTarget* aTarget, IntPoint aOffset, SyncObject* aStart, @@ -107,7 +107,7 @@ class DrawingJob : public Job { /// /// The builder is a separate object to ensure that commands are not added to a /// submitted DrawingJob. -class DrawingJobBuilder { +class DrawingJobBuilder final { public: DrawingJobBuilder(); diff --git a/gfx/2d/FilterNodeCapture.h b/gfx/2d/FilterNodeCapture.h index 9e0bfe6eed61..491a214d1c4a 100644 --- a/gfx/2d/FilterNodeCapture.h +++ b/gfx/2d/FilterNodeCapture.h @@ -23,9 +23,7 @@ class FilterNodeCapture final : public FilterNode { explicit FilterNodeCapture(FilterType aType) : mType{aType}, mInputsChanged{true} {} - virtual FilterBackend GetBackendType() override { - return FILTER_BACKEND_CAPTURE; - } + FilterBackend GetBackendType() override { return FILTER_BACKEND_CAPTURE; } RefPtr Validate(DrawTarget *aDT); @@ -38,11 +36,11 @@ class FilterNodeCapture final : public FilterNode { } } - virtual void SetInput(uint32_t aIndex, SourceSurface *aSurface) override { + void SetInput(uint32_t aIndex, SourceSurface *aSurface) override { mInputsChanged = true; Replace(aIndex, RefPtr(aSurface), mInputs); } - virtual void SetInput(uint32_t aIndex, FilterNode *aFilter) override { + void SetInput(uint32_t aIndex, FilterNode *aFilter) override { mInputsChanged = true; Replace(aIndex, RefPtr(aFilter), mInputs); } @@ -51,45 +49,45 @@ class FilterNodeCapture final : public FilterNode { Variant, IntPoint, Matrix>; - virtual void SetAttribute(uint32_t aIndex, uint32_t aValue) override { + void SetAttribute(uint32_t aIndex, uint32_t aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, Float aValue) override { + void SetAttribute(uint32_t aIndex, Float aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Point &aValue) override { + void SetAttribute(uint32_t aIndex, const Point &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Matrix5x4 &aValue) override { + void SetAttribute(uint32_t aIndex, const Matrix5x4 &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Point3D &aValue) override { + void SetAttribute(uint32_t aIndex, const Point3D &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Size &aValue) override { + void SetAttribute(uint32_t aIndex, const Size &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const IntSize &aValue) override { + void SetAttribute(uint32_t aIndex, const IntSize &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Color &aValue) override { + void SetAttribute(uint32_t aIndex, const Color &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Rect &aValue) override { + void SetAttribute(uint32_t aIndex, const Rect &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const IntRect &aValue) override { + void SetAttribute(uint32_t aIndex, const IntRect &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, bool aValue) override { + void SetAttribute(uint32_t aIndex, bool aValue) override { Replace(aIndex, aValue, mAttributes); } virtual void SetAttribute(uint32_t aIndex, const Float *aValues, uint32_t aSize) override; - virtual void SetAttribute(uint32_t aIndex, const IntPoint &aValue) override { + void SetAttribute(uint32_t aIndex, const IntPoint &aValue) override { Replace(aIndex, aValue, mAttributes); } - virtual void SetAttribute(uint32_t aIndex, const Matrix &aValue) override { + void SetAttribute(uint32_t aIndex, const Matrix &aValue) override { Replace(aIndex, aValue, mAttributes); } diff --git a/gfx/2d/FilterNodeD2D1.h b/gfx/2d/FilterNodeD2D1.h index 0293f44ee553..089d37a2ed5a 100644 --- a/gfx/2d/FilterNodeD2D1.h +++ b/gfx/2d/FilterNodeD2D1.h @@ -81,14 +81,14 @@ class FilterNodeConvolveD2D1 : public FilterNodeD2D1 { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeConvolveD2D1, override) explicit FilterNodeConvolveD2D1(ID2D1DeviceContext *aDC); - virtual void SetInput(uint32_t aIndex, FilterNode *aFilter) override; + void SetInput(uint32_t aIndex, FilterNode *aFilter) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aValue) override; - virtual void SetAttribute(uint32_t aIndex, const IntSize &aValue) override; - virtual void SetAttribute(uint32_t aIndex, const IntPoint &aValue) override; - virtual void SetAttribute(uint32_t aIndex, const IntRect &aValue) override; + void SetAttribute(uint32_t aIndex, uint32_t aValue) override; + void SetAttribute(uint32_t aIndex, const IntSize &aValue) override; + void SetAttribute(uint32_t aIndex, const IntPoint &aValue) override; + void SetAttribute(uint32_t aIndex, const IntRect &aValue) override; - virtual ID2D1Effect *InputEffect() override; + ID2D1Effect *InputEffect() override; private: using FilterNode::SetAttribute; @@ -109,10 +109,10 @@ class FilterNodeConvolveD2D1 : public FilterNodeD2D1 { class FilterNodeOpacityD2D1 : public FilterNodeD2D1 { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeOpacityD2D1, override) - explicit FilterNodeOpacityD2D1(ID2D1Effect *aEffect, FilterType aType) + FilterNodeOpacityD2D1(ID2D1Effect *aEffect, FilterType aType) : FilterNodeD2D1(aEffect, aType) {} - virtual void SetAttribute(uint32_t aIndex, Float aValue) override; + void SetAttribute(uint32_t aIndex, Float aValue) override; }; class FilterNodeExtendInputAdapterD2D1 : public FilterNodeD2D1 { @@ -123,10 +123,8 @@ class FilterNodeExtendInputAdapterD2D1 : public FilterNodeD2D1 { FilterNodeD2D1 *aFilterNode, FilterType aType); - virtual ID2D1Effect *InputEffect() override { - return mExtendInputEffect.get(); - } - virtual ID2D1Effect *OutputEffect() override { + ID2D1Effect *InputEffect() override { return mExtendInputEffect.get(); } + ID2D1Effect *OutputEffect() override { return mWrappedFilterNode->OutputEffect(); } @@ -143,10 +141,8 @@ class FilterNodePremultiplyAdapterD2D1 : public FilterNodeD2D1 { FilterNodeD2D1 *aFilterNode, FilterType aType); - virtual ID2D1Effect *InputEffect() override { - return mPrePremultiplyEffect.get(); - } - virtual ID2D1Effect *OutputEffect() override { + ID2D1Effect *InputEffect() override { return mPrePremultiplyEffect.get(); } + ID2D1Effect *OutputEffect() override { return mPostUnpremultiplyEffect.get(); } diff --git a/gfx/2d/FilterNodeSoftware.h b/gfx/2d/FilterNodeSoftware.h index 4294b8ff9392..c0a49bd6887b 100644 --- a/gfx/2d/FilterNodeSoftware.h +++ b/gfx/2d/FilterNodeSoftware.h @@ -49,20 +49,17 @@ class FilterNodeSoftware : public FilterNode, void Draw(DrawTarget *aDrawTarget, const Rect &aSourceRect, const Point &aDestPoint, const DrawOptions &aOptions); - virtual FilterBackend GetBackendType() override { - return FILTER_BACKEND_SOFTWARE; - } - virtual void SetInput(uint32_t aIndex, SourceSurface *aSurface) override; - virtual void SetInput(uint32_t aIndex, FilterNode *aFilter) override; + FilterBackend GetBackendType() override { return FILTER_BACKEND_SOFTWARE; } + void SetInput(uint32_t aIndex, SourceSurface *aSurface) override; + void SetInput(uint32_t aIndex, FilterNode *aFilter) override; virtual const char *GetName() { return "Unknown"; } - virtual void AddInvalidationListener(FilterInvalidationListener *aListener); - virtual void RemoveInvalidationListener( - FilterInvalidationListener *aListener); + void AddInvalidationListener(FilterInvalidationListener *aListener); + void RemoveInvalidationListener(FilterInvalidationListener *aListener); // FilterInvalidationListener implementation - virtual void FilterInvalidated(FilterNodeSoftware *aFilter) override; + void FilterInvalidated(FilterNodeSoftware *aFilter) override; protected: // The following methods are intended to be overriden by subclasses. @@ -231,19 +228,18 @@ class FilterNodeTransformSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeTransformSoftware, override) FilterNodeTransformSoftware(); - virtual const char *GetName() override { return "Transform"; } + const char *GetName() override { return "Transform"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, uint32_t aGraphicsFilter) override; - virtual void SetAttribute(uint32_t aIndex, const Matrix &aMatrix) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, uint32_t aGraphicsFilter) override; + void SetAttribute(uint32_t aIndex, const Matrix &aMatrix) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; IntRect SourceRectForOutputRect(const IntRect &aRect); private: @@ -255,18 +251,17 @@ class FilterNodeBlendSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeBlendSoftware, override) FilterNodeBlendSoftware(); - virtual const char *GetName() override { return "Blend"; } + const char *GetName() override { return "Blend"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, uint32_t aBlendMode) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, uint32_t aBlendMode) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: BlendMode mBlendMode; @@ -277,17 +272,16 @@ class FilterNodeMorphologySoftware : public FilterNodeSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeMorphologySoftware, override) FilterNodeMorphologySoftware(); - virtual const char *GetName() override { return "Morphology"; } + const char *GetName() override { return "Morphology"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const IntSize &aRadii) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aOperator) override; + void SetAttribute(uint32_t aIndex, const IntSize &aRadii) override; + void SetAttribute(uint32_t aIndex, uint32_t aOperator) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: IntSize mRadii; @@ -298,19 +292,18 @@ class FilterNodeColorMatrixSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeColorMatrixSoftware, override) - virtual const char *GetName() override { return "ColorMatrix"; } + const char *GetName() override { return "ColorMatrix"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Matrix5x4 &aMatrix) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aAlphaMode) override; + void SetAttribute(uint32_t aIndex, const Matrix5x4 &aMatrix) override; + void SetAttribute(uint32_t aIndex, uint32_t aAlphaMode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; private: Matrix5x4 mMatrix; @@ -320,18 +313,16 @@ class FilterNodeColorMatrixSoftware : public FilterNodeSoftware { class FilterNodeFloodSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeFloodSoftware, override) - virtual const char *GetName() override { return "Flood"; } + const char *GetName() override { return "Flood"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Color &aColor) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, const Color &aColor) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed GetOutput( - const IntRect &aRect) override; - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; + already_AddRefed GetOutput(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; private: Color mColor; @@ -340,17 +331,15 @@ class FilterNodeFloodSoftware : public FilterNodeSoftware { class FilterNodeTileSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeTileSoftware, override) - virtual const char *GetName() override { return "Tile"; } + const char *GetName() override { return "Tile"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, - const IntRect &aSourceRect) override; + void SetAttribute(uint32_t aIndex, const IntRect &aSourceRect) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: IntRect mSourceRect; @@ -366,16 +355,15 @@ class FilterNodeComponentTransferSoftware : public FilterNodeSoftware { FilterNodeComponentTransferSoftware(); using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, bool aDisable) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, bool aDisable) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; virtual void GenerateLookupTable(ptrdiff_t aComponent, uint8_t aTables[4][256], bool aDisabled); virtual void FillLookupTable(ptrdiff_t aComponent, uint8_t aTable[256]) = 0; @@ -391,14 +379,13 @@ class FilterNodeTableTransferSoftware public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeTableTransferSoftware, override) - virtual const char *GetName() override { return "TableTransfer"; } + const char *GetName() override { return "TableTransfer"; } using FilterNodeComponentTransferSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Float *aFloat, - uint32_t aSize) override; + void SetAttribute(uint32_t aIndex, const Float *aFloat, + uint32_t aSize) override; protected: - virtual void FillLookupTable(ptrdiff_t aComponent, - uint8_t aTable[256]) override; + void FillLookupTable(ptrdiff_t aComponent, uint8_t aTable[256]) override; private: void FillLookupTableImpl(std::vector &aTableValues, @@ -415,14 +402,13 @@ class FilterNodeDiscreteTransferSoftware public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeDiscreteTransferSoftware, override) - virtual const char *GetName() override { return "DiscreteTransfer"; } + const char *GetName() override { return "DiscreteTransfer"; } using FilterNodeComponentTransferSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Float *aFloat, - uint32_t aSize) override; + void SetAttribute(uint32_t aIndex, const Float *aFloat, + uint32_t aSize) override; protected: - virtual void FillLookupTable(ptrdiff_t aComponent, - uint8_t aTable[256]) override; + void FillLookupTable(ptrdiff_t aComponent, uint8_t aTable[256]) override; private: void FillLookupTableImpl(std::vector &aTableValues, @@ -440,13 +426,12 @@ class FilterNodeLinearTransferSoftware MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeLinearTransformSoftware, override) FilterNodeLinearTransferSoftware(); - virtual const char *GetName() override { return "LinearTransfer"; } + const char *GetName() override { return "LinearTransfer"; } using FilterNodeComponentTransferSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float aValue) override; + void SetAttribute(uint32_t aIndex, Float aValue) override; protected: - virtual void FillLookupTable(ptrdiff_t aComponent, - uint8_t aTable[256]) override; + void FillLookupTable(ptrdiff_t aComponent, uint8_t aTable[256]) override; private: void FillLookupTableImpl(Float aSlope, Float aIntercept, uint8_t aTable[256]); @@ -467,13 +452,12 @@ class FilterNodeGammaTransferSoftware MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeGammaTransferSoftware, override) FilterNodeGammaTransferSoftware(); - virtual const char *GetName() override { return "GammaTransfer"; } + const char *GetName() override { return "GammaTransfer"; } using FilterNodeComponentTransferSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float aValue) override; + void SetAttribute(uint32_t aIndex, Float aValue) override; protected: - virtual void FillLookupTable(ptrdiff_t aComponent, - uint8_t aTable[256]) override; + void FillLookupTable(ptrdiff_t aComponent, uint8_t aTable[256]) override; private: void FillLookupTableImpl(Float aAmplitude, Float aExponent, Float aOffset, @@ -498,29 +482,25 @@ class FilterNodeConvolveMatrixSoftware : public FilterNodeSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeConvolveMatrixSoftware, override) FilterNodeConvolveMatrixSoftware(); - virtual const char *GetName() override { return "ConvolveMatrix"; } + const char *GetName() override { return "ConvolveMatrix"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, - const IntSize &aKernelSize) override; - virtual void SetAttribute(uint32_t aIndex, const Float *aMatrix, - uint32_t aSize) override; - virtual void SetAttribute(uint32_t aIndex, Float aValue) override; - virtual void SetAttribute(uint32_t aIndex, - const Size &aKernelUnitLength) override; - virtual void SetAttribute(uint32_t aIndex, - const IntRect &aSourceRect) override; - virtual void SetAttribute(uint32_t aIndex, const IntPoint &aTarget) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aEdgeMode) override; - virtual void SetAttribute(uint32_t aIndex, bool aPreserveAlpha) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, const IntSize &aKernelSize) override; + void SetAttribute(uint32_t aIndex, const Float *aMatrix, + uint32_t aSize) override; + void SetAttribute(uint32_t aIndex, Float aValue) override; + void SetAttribute(uint32_t aIndex, const Size &aKernelUnitLength) override; + void SetAttribute(uint32_t aIndex, const IntRect &aSourceRect) override; + void SetAttribute(uint32_t aIndex, const IntPoint &aTarget) override; + void SetAttribute(uint32_t aIndex, uint32_t aEdgeMode) override; + void SetAttribute(uint32_t aIndex, bool aPreserveAlpha) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: template @@ -547,19 +527,18 @@ class FilterNodeDisplacementMapSoftware : public FilterNodeSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeDisplacementMapSoftware, override) FilterNodeDisplacementMapSoftware(); - virtual const char *GetName() override { return "DisplacementMap"; } + const char *GetName() override { return "DisplacementMap"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float aScale) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aValue) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, Float aScale) override; + void SetAttribute(uint32_t aIndex, uint32_t aValue) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: IntRect InflatedSourceOrDestRect(const IntRect &aDestOrSourceRect); @@ -574,21 +553,19 @@ class FilterNodeTurbulenceSoftware : public FilterNodeSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeTurbulenceSoftware, override) FilterNodeTurbulenceSoftware(); - virtual const char *GetName() override { return "Turbulence"; } + const char *GetName() override { return "Turbulence"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Size &aSize) override; - virtual void SetAttribute(uint32_t aIndex, - const IntRect &aRenderRect) override; - virtual void SetAttribute(uint32_t aIndex, bool aStitchable) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aValue) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, const Size &aSize) override; + void SetAttribute(uint32_t aIndex, const IntRect &aRenderRect) override; + void SetAttribute(uint32_t aIndex, bool aStitchable) override; + void SetAttribute(uint32_t aIndex, uint32_t aValue) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; private: IntRect mRenderRect; @@ -604,19 +581,18 @@ class FilterNodeArithmeticCombineSoftware : public FilterNodeSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeArithmeticCombineSoftware, override) FilterNodeArithmeticCombineSoftware(); - virtual const char *GetName() override { return "ArithmeticCombine"; } + const char *GetName() override { return "ArithmeticCombine"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Float *aFloat, - uint32_t aSize) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, const Float *aFloat, + uint32_t aSize) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: Float mK1; @@ -629,18 +605,17 @@ class FilterNodeCompositeSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeCompositeSoftware, override) FilterNodeCompositeSoftware(); - virtual const char *GetName() override { return "Composite"; } + const char *GetName() override { return "Composite"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, uint32_t aOperator) override; + void SetAttribute(uint32_t aIndex, uint32_t aOperator) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; private: CompositeOperator mOperator; @@ -652,14 +627,13 @@ class FilterNodeBlurXYSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeBlurXYSoftware, override) protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; IntRect InflatedSourceOrDestRect(const IntRect &aDestRect); - virtual void RequestFromInputsForRect(const IntRect &aRect) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void RequestFromInputsForRect(const IntRect &aRect) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; // Implemented by subclasses. virtual Size StdDeviationXY() = 0; @@ -670,12 +644,12 @@ class FilterNodeGaussianBlurSoftware : public FilterNodeBlurXYSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeGaussianBlurSoftware, override) FilterNodeGaussianBlurSoftware(); - virtual const char *GetName() override { return "GaussianBlur"; } + const char *GetName() override { return "GaussianBlur"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float aStdDeviation) override; + void SetAttribute(uint32_t aIndex, Float aStdDeviation) override; protected: - virtual Size StdDeviationXY() override; + Size StdDeviationXY() override; private: Float mStdDeviation; @@ -686,13 +660,13 @@ class FilterNodeDirectionalBlurSoftware : public FilterNodeBlurXYSoftware { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeDirectionalBlurSoftware, override) FilterNodeDirectionalBlurSoftware(); - virtual const char *GetName() override { return "DirectionalBlur"; } + const char *GetName() override { return "DirectionalBlur"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float aStdDeviation) override; - virtual void SetAttribute(uint32_t aIndex, uint32_t aBlurDirection) override; + void SetAttribute(uint32_t aIndex, Float aStdDeviation) override; + void SetAttribute(uint32_t aIndex, uint32_t aBlurDirection) override; protected: - virtual Size StdDeviationXY() override; + Size StdDeviationXY() override; private: Float mStdDeviation; @@ -702,18 +676,17 @@ class FilterNodeDirectionalBlurSoftware : public FilterNodeBlurXYSoftware { class FilterNodeCropSoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeCropSoftware, override) - virtual const char *GetName() override { return "Crop"; } + const char *GetName() override { return "Crop"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, const Rect &aSourceRect) override; + void SetAttribute(uint32_t aIndex, const Rect &aSourceRect) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; private: IntRect mCropRect; @@ -723,49 +696,46 @@ class FilterNodePremultiplySoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodePremultiplySoftware, override) - virtual const char *GetName() override { return "Premultiply"; } + const char *GetName() override { return "Premultiply"; } protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; }; class FilterNodeUnpremultiplySoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeUnpremultiplySoftware, override) - virtual const char *GetName() override { return "Unpremultiply"; } + const char *GetName() override { return "Unpremultiply"; } protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; }; class FilterNodeOpacitySoftware : public FilterNodeSoftware { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeOpacitySoftware, override) - virtual const char *GetName() override { return "Opacity"; } + const char *GetName() override { return "Opacity"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float aValue) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, Float aValue) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; Float mValue = 1.0f; }; @@ -776,25 +746,24 @@ class FilterNodeLightingSoftware : public FilterNodeSoftware { #if defined(MOZILLA_INTERNAL_API) && \ (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING)) // Helpers for refcounted - virtual const char *typeName() const override { return mTypeName; } - virtual size_t typeSize() const override { return sizeof(*this); } + const char *typeName() const override { return mTypeName; } + size_t typeSize() const override { return sizeof(*this); } #endif explicit FilterNodeLightingSoftware(const char *aTypeName); - virtual const char *GetName() override { return "Lighting"; } + const char *GetName() override { return "Lighting"; } using FilterNodeSoftware::SetAttribute; - virtual void SetAttribute(uint32_t aIndex, Float) override; - virtual void SetAttribute(uint32_t aIndex, const Size &) override; - virtual void SetAttribute(uint32_t aIndex, const Point3D &) override; - virtual void SetAttribute(uint32_t aIndex, const Color &) override; - virtual IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, - FilterNode *aSourceNode) override; + void SetAttribute(uint32_t aIndex, Float) override; + void SetAttribute(uint32_t aIndex, const Size &) override; + void SetAttribute(uint32_t aIndex, const Point3D &) override; + void SetAttribute(uint32_t aIndex, const Color &) override; + IntRect MapRectToSource(const IntRect &aRect, const IntRect &aMax, + FilterNode *aSourceNode) override; protected: - virtual already_AddRefed Render( - const IntRect &aRect) override; - virtual IntRect GetOutputRectInRect(const IntRect &aRect) override; - virtual int32_t InputIndex(uint32_t aInputEnumIndex) override; - virtual void RequestFromInputsForRect(const IntRect &aRect) override; + already_AddRefed Render(const IntRect &aRect) override; + IntRect GetOutputRectInRect(const IntRect &aRect) override; + int32_t InputIndex(uint32_t aInputEnumIndex) override; + void RequestFromInputsForRect(const IntRect &aRect) override; private: template diff --git a/gfx/2d/Filters.h b/gfx/2d/Filters.h index 543b8b1b7612..367bcc85d52c 100644 --- a/gfx/2d/Filters.h +++ b/gfx/2d/Filters.h @@ -370,7 +370,7 @@ enum OpacityInputs { IN_OPACITY_IN = 0 }; class FilterNode : public external::AtomicRefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNode) - virtual ~FilterNode() {} + virtual ~FilterNode() = default; virtual FilterBackend GetBackendType() = 0; diff --git a/gfx/2d/Helpers.h b/gfx/2d/Helpers.h index 0fcb9ae6c271..66f421c0e4cd 100644 --- a/gfx/2d/Helpers.h +++ b/gfx/2d/Helpers.h @@ -12,9 +12,9 @@ namespace mozilla { namespace gfx { -class AutoRestoreTransform { +class AutoRestoreTransform final { public: - AutoRestoreTransform() {} + AutoRestoreTransform() = default; explicit AutoRestoreTransform(DrawTarget *aTarget) : mDrawTarget(aTarget), mOldTransform(aTarget->GetTransform()) {} @@ -38,7 +38,7 @@ class AutoRestoreTransform { Matrix mOldTransform; }; -class AutoPopClips { +class AutoPopClips final { public: explicit AutoPopClips(DrawTarget *aTarget) : mDrawTarget(aTarget), mPushCount(0) { diff --git a/gfx/2d/HelpersD2D.h b/gfx/2d/HelpersD2D.h index 64924ab73db1..aac4817642b1 100644 --- a/gfx/2d/HelpersD2D.h +++ b/gfx/2d/HelpersD2D.h @@ -867,7 +867,7 @@ class DCCommandSink : public ID2D1CommandSink { ID2D1DeviceContext *mCtx; }; -class MOZ_STACK_CLASS AutoRestoreFP { +class MOZ_STACK_CLASS AutoRestoreFP final { public: AutoRestoreFP() { // save the current floating point control word diff --git a/gfx/2d/JobScheduler.h b/gfx/2d/JobScheduler.h index 70d0f67e8565..f16a45e7382d 100644 --- a/gfx/2d/JobScheduler.h +++ b/gfx/2d/JobScheduler.h @@ -142,7 +142,7 @@ class SetEventJob : public Job { SyncObject* aCompletion = nullptr, WorkerThread* aPinToWorker = nullptr); - ~SetEventJob(); + virtual ~SetEventJob(); JobStatus Run() override; @@ -179,7 +179,7 @@ class SyncObject final : public external::AtomicRefCounted { /// using muteces. explicit SyncObject(uint32_t aNumPrerequisites = 1); - ~SyncObject(); + virtual ~SyncObject(); /// Attempt to register a task. /// @@ -237,7 +237,7 @@ class WorkerThread { public: static WorkerThread* Create(MultiThreadedJobQueue* aJobQueue); - virtual ~WorkerThread() {} + virtual ~WorkerThread() = default; void Run(); diff --git a/gfx/2d/JobScheduler_posix.cpp b/gfx/2d/JobScheduler_posix.cpp index 65e4083db29d..3cde96b4aafe 100644 --- a/gfx/2d/JobScheduler_posix.cpp +++ b/gfx/2d/JobScheduler_posix.cpp @@ -22,7 +22,7 @@ class WorkerThreadPosix : public WorkerThread { static_cast(this)); } - ~WorkerThreadPosix() override { pthread_join(mThread, nullptr); } + virtual ~WorkerThreadPosix() { pthread_join(mThread, nullptr); } void SetName(const char*) override { // XXX - temporarily disabled, see bug 1209039 diff --git a/gfx/2d/JobScheduler_win32.cpp b/gfx/2d/JobScheduler_win32.cpp index 1d319be4f259..8c6d6547f636 100644 --- a/gfx/2d/JobScheduler_win32.cpp +++ b/gfx/2d/JobScheduler_win32.cpp @@ -22,7 +22,7 @@ class WorkerThreadWin32 : public WorkerThread { static_cast(this), 0, nullptr); } - ~WorkerThreadWin32() { + virtual ~WorkerThreadWin32() { ::WaitForSingleObject(mThread, INFINITE); ::CloseHandle(mThread); } diff --git a/gfx/2d/Logging.h b/gfx/2d/Logging.h index 28704f98c113..3a6e76f446d1 100644 --- a/gfx/2d/Logging.h +++ b/gfx/2d/Logging.h @@ -212,7 +212,7 @@ typedef mozilla::Tuple LoggingRecordEntry; typedef std::vector LoggingRecord; class LogForwarder { public: - virtual ~LogForwarder() {} + virtual ~LogForwarder() = default; virtual void Log(const std::string& aString) = 0; virtual void CrashAction(LogReason aReason) = 0; virtual bool UpdateStringsVector(const std::string& aString) = 0; @@ -257,7 +257,7 @@ void LogWStr(const wchar_t* aStr, std::stringstream& aOut); #endif template -class Log { +class Log final { public: // The default is to have the prefix, have the new line, and for critical // logs assert on each call. @@ -931,7 +931,7 @@ class TreeLog { }; template -class TreeAutoIndent { +class TreeAutoIndent final { public: explicit TreeAutoIndent(TreeLog& aTreeLog) : mTreeLog(aTreeLog) { mTreeLog.IncreaseIndent(); diff --git a/gfx/2d/NativeFontResourceGDI.h b/gfx/2d/NativeFontResourceGDI.h index bd319663ae14..6d247a1a1acb 100644 --- a/gfx/2d/NativeFontResourceGDI.h +++ b/gfx/2d/NativeFontResourceGDI.h @@ -31,7 +31,7 @@ class NativeFontResourceGDI final : public NativeFontResource { static already_AddRefed Create(uint8_t* aFontData, uint32_t aDataLength); - ~NativeFontResourceGDI(); + virtual ~NativeFontResourceGDI(); already_AddRefed CreateUnscaledFont( uint32_t aIndex, const uint8_t* aInstanceData, diff --git a/gfx/2d/PathCairo.h b/gfx/2d/PathCairo.h index f0072bf7463f..24949dc334c5 100644 --- a/gfx/2d/PathCairo.h +++ b/gfx/2d/PathCairo.h @@ -22,20 +22,18 @@ class PathBuilderCairo : public PathBuilder { explicit PathBuilderCairo(FillRule aFillRule); - virtual void MoveTo(const Point &aPoint) override; - virtual void LineTo(const Point &aPoint) override; - virtual void BezierTo(const Point &aCP1, const Point &aCP2, - const Point &aCP3) override; - virtual void QuadraticBezierTo(const Point &aCP1, const Point &aCP2) override; - virtual void Close() override; - virtual void Arc(const Point &aOrigin, float aRadius, float aStartAngle, - float aEndAngle, bool aAntiClockwise = false) override; - virtual Point CurrentPoint() const override; - virtual already_AddRefed Finish() override; + void MoveTo(const Point &aPoint) override; + void LineTo(const Point &aPoint) override; + void BezierTo(const Point &aCP1, const Point &aCP2, + const Point &aCP3) override; + void QuadraticBezierTo(const Point &aCP1, const Point &aCP2) override; + void Close() override; + void Arc(const Point &aOrigin, float aRadius, float aStartAngle, + float aEndAngle, bool aAntiClockwise = false) override; + Point CurrentPoint() const override; + already_AddRefed Finish() override; - virtual BackendType GetBackendType() const override { - return BackendType::CAIRO; - } + BackendType GetBackendType() const override { return BackendType::CAIRO; } private: // data friend class PathCairo; @@ -55,33 +53,30 @@ class PathCairo : public Path { PathCairo(FillRule aFillRule, std::vector &aPathData, const Point &aCurrentPoint); explicit PathCairo(cairo_t *aContext); - ~PathCairo(); + virtual ~PathCairo(); - virtual BackendType GetBackendType() const override { - return BackendType::CAIRO; - } + BackendType GetBackendType() const override { return BackendType::CAIRO; } - virtual already_AddRefed CopyToBuilder( + already_AddRefed CopyToBuilder( FillRule aFillRule) const override; - virtual already_AddRefed TransformedCopyToBuilder( + already_AddRefed TransformedCopyToBuilder( const Matrix &aTransform, FillRule aFillRule) const override; - virtual bool ContainsPoint(const Point &aPoint, - const Matrix &aTransform) const override; + bool ContainsPoint(const Point &aPoint, + const Matrix &aTransform) const override; - virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions, - const Point &aPoint, - const Matrix &aTransform) const override; + bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions, + const Point &aPoint, + const Matrix &aTransform) const override; - virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const override; + Rect GetBounds(const Matrix &aTransform = Matrix()) const override; - virtual Rect GetStrokedBounds( - const StrokeOptions &aStrokeOptions, - const Matrix &aTransform = Matrix()) const override; + Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions, + const Matrix &aTransform = Matrix()) const override; - virtual void StreamToSink(PathSink *aSink) const override; + void StreamToSink(PathSink *aSink) const override; - virtual FillRule GetFillRule() const override { return mFillRule; } + FillRule GetFillRule() const override { return mFillRule; } void SetPathOnContext(cairo_t *aContext) const; diff --git a/gfx/2d/PathSkia.h b/gfx/2d/PathSkia.h index 6531c940c0ff..d0efe6fbb581 100644 --- a/gfx/2d/PathSkia.h +++ b/gfx/2d/PathSkia.h @@ -23,22 +23,20 @@ class PathBuilderSkia : public PathBuilder { FillRule aFillRule); explicit PathBuilderSkia(FillRule aFillRule); - virtual void MoveTo(const Point &aPoint) override; - virtual void LineTo(const Point &aPoint) override; - virtual void BezierTo(const Point &aCP1, const Point &aCP2, - const Point &aCP3) override; - virtual void QuadraticBezierTo(const Point &aCP1, const Point &aCP2) override; - virtual void Close() override; - virtual void Arc(const Point &aOrigin, float aRadius, float aStartAngle, - float aEndAngle, bool aAntiClockwise = false) override; - virtual Point CurrentPoint() const override; - virtual already_AddRefed Finish() override; + void MoveTo(const Point &aPoint) override; + void LineTo(const Point &aPoint) override; + void BezierTo(const Point &aCP1, const Point &aCP2, + const Point &aCP3) override; + void QuadraticBezierTo(const Point &aCP1, const Point &aCP2) override; + void Close() override; + void Arc(const Point &aOrigin, float aRadius, float aStartAngle, + float aEndAngle, bool aAntiClockwise = false) override; + Point CurrentPoint() const override; + already_AddRefed Finish() override; void AppendPath(const SkPath &aPath); - virtual BackendType GetBackendType() const override { - return BackendType::SKIA; - } + BackendType GetBackendType() const override { return BackendType::SKIA; } private: void SetFillRule(FillRule aFillRule); @@ -55,31 +53,28 @@ class PathSkia : public Path { mPath.swap(aPath); } - virtual BackendType GetBackendType() const override { - return BackendType::SKIA; - } + BackendType GetBackendType() const override { return BackendType::SKIA; } - virtual already_AddRefed CopyToBuilder( + already_AddRefed CopyToBuilder( FillRule aFillRule) const override; - virtual already_AddRefed TransformedCopyToBuilder( + already_AddRefed TransformedCopyToBuilder( const Matrix &aTransform, FillRule aFillRule) const override; - virtual bool ContainsPoint(const Point &aPoint, - const Matrix &aTransform) const override; + bool ContainsPoint(const Point &aPoint, + const Matrix &aTransform) const override; - virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions, - const Point &aPoint, - const Matrix &aTransform) const override; + bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions, + const Point &aPoint, + const Matrix &aTransform) const override; - virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const override; + Rect GetBounds(const Matrix &aTransform = Matrix()) const override; - virtual Rect GetStrokedBounds( - const StrokeOptions &aStrokeOptions, - const Matrix &aTransform = Matrix()) const override; + Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions, + const Matrix &aTransform = Matrix()) const override; - virtual void StreamToSink(PathSink *aSink) const override; + void StreamToSink(PathSink *aSink) const override; - virtual FillRule GetFillRule() const override { return mFillRule; } + FillRule GetFillRule() const override { return mFillRule; } const SkPath &GetPath() const { return mPath; } diff --git a/gfx/2d/PatternHelpers.h b/gfx/2d/PatternHelpers.h index 706c2ab1853a..6e08577843ba 100644 --- a/gfx/2d/PatternHelpers.h +++ b/gfx/2d/PatternHelpers.h @@ -25,11 +25,11 @@ namespace gfx { * particularly desirable to avoid the overhead of allocating on the * free-store. */ -class GeneralPattern { +class GeneralPattern final { public: - explicit GeneralPattern() : mPattern(nullptr) {} + explicit GeneralPattern() = default; - GeneralPattern(const GeneralPattern &aOther) : mPattern(nullptr) {} + GeneralPattern(const GeneralPattern &aOther) {} ~GeneralPattern() { if (mPattern) { @@ -115,7 +115,7 @@ class GeneralPattern { AlignedStorage2 mRadialGradientPattern; AlignedStorage2 mSurfacePattern; }; - Pattern *mPattern; + Pattern *mPattern = nullptr; }; } // namespace gfx diff --git a/gfx/2d/Polygon.h b/gfx/2d/Polygon.h index f7a50bdd7099..04aa05b24909 100644 --- a/gfx/2d/Polygon.h +++ b/gfx/2d/Polygon.h @@ -157,7 +157,7 @@ class PolygonTyped { typedef Point4DTyped Point4DType; public: - PolygonTyped() {} + PolygonTyped() = default; explicit PolygonTyped(const nsTArray& aPoints, const Point4DType& aNormal = DefaultNormal()) diff --git a/gfx/2d/RecordedEvent.h b/gfx/2d/RecordedEvent.h index 28e7cd8a4b48..dbfe365e8e54 100644 --- a/gfx/2d/RecordedEvent.h +++ b/gfx/2d/RecordedEvent.h @@ -71,7 +71,7 @@ inline std::string StringFromPtr(ReferencePtr aPtr) { class Translator { public: - virtual ~Translator() {} + virtual ~Translator() = default; virtual DrawTarget *LookupDrawTarget(ReferencePtr aRefPtr) = 0; virtual Path *LookupPath(ReferencePtr aRefPtr) = 0; @@ -253,7 +253,7 @@ class RecordedEvent { static const uint32_t kTotalEventTypes = RecordedEvent::FILTERNODESETINPUT + 1; - virtual ~RecordedEvent() {} + virtual ~RecordedEvent() = default; static std::string GetEventName(EventType aType); diff --git a/gfx/2d/RecordedEventImpl.h b/gfx/2d/RecordedEventImpl.h index 869319d31529..8285dde600cc 100644 --- a/gfx/2d/RecordedEventImpl.h +++ b/gfx/2d/RecordedEventImpl.h @@ -43,7 +43,7 @@ class RecordedEventDerived : public RecordedEvent { template class RecordedDrawingEvent : public RecordedEventDerived { public: - virtual ReferencePtr GetDestinedDT() override { return mDT; } + ReferencePtr GetDestinedDT() override { return mDT; } protected: RecordedDrawingEvent(RecordedEvent::EventType aType, DrawTarget *aTarget) @@ -54,7 +54,7 @@ class RecordedDrawingEvent : public RecordedEventDerived { template void Record(S &aStream) const; - virtual ReferencePtr GetObjectRef() const override; + ReferencePtr GetObjectRef() const override; ReferencePtr mDT; }; @@ -74,15 +74,15 @@ class RecordedDrawTargetCreation mHasExistingData(aHasExistingData), mExistingData(aExistingData) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; virtual void OutputSimpleEventInfo( std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "DrawTarget Creation"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "DrawTarget Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } ReferencePtr mRefPtr; BackendType mBackendType; @@ -106,17 +106,14 @@ class RecordedDrawTargetDestruction mRefPtr(aRefPtr), mBackendType(BackendType::NONE) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "DrawTarget Destruction"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "DrawTarget Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } ReferencePtr mRefPtr; @@ -139,17 +136,15 @@ class RecordedCreateSimilarDrawTarget mSize(aSize), mFormat(aFormat) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; virtual void OutputSimpleEventInfo( std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "CreateSimilarDrawTarget"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "CreateSimilarDrawTarget"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } ReferencePtr mRefPtr; IntSize mSize; @@ -174,17 +169,15 @@ class RecordedCreateClippedDrawTarget mTransform(aTransform), mFormat(aFormat) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; virtual void OutputSimpleEventInfo( std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "CreateClippedDrawTarget"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "CreateClippedDrawTarget"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } ReferencePtr mRefPtr; IntSize mMaxSize; @@ -216,17 +209,17 @@ class RecordedCreateDrawTargetForFilter mSourceRect(aSourceRect), mDestPoint(aDestPoint) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; virtual void OutputSimpleEventInfo( std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { + std::string GetName() const override { return "CreateSimilarDrawTargetForFilter"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } ReferencePtr mRefPtr; IntSize mMaxSize; @@ -254,14 +247,13 @@ class RecordedFillRect : public RecordedDrawingEvent { StorePattern(mPattern, aPattern); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "FillRect"; } + std::string GetName() const override { return "FillRect"; } private: friend class RecordedEvent; @@ -288,14 +280,13 @@ class RecordedStrokeRect : public RecordedDrawingEvent { StorePattern(mPattern, aPattern); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "StrokeRect"; } + std::string GetName() const override { return "StrokeRect"; } private: friend class RecordedEvent; @@ -324,14 +315,13 @@ class RecordedStrokeLine : public RecordedDrawingEvent { StorePattern(mPattern, aPattern); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "StrokeLine"; } + std::string GetName() const override { return "StrokeLine"; } private: friend class RecordedEvent; @@ -357,14 +347,13 @@ class RecordedFill : public RecordedDrawingEvent { StorePattern(mPattern, aPattern); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Fill"; } + std::string GetName() const override { return "Fill"; } private: friend class RecordedEvent; @@ -393,14 +382,13 @@ class RecordedFillGlyphs : public RecordedDrawingEvent { } virtual ~RecordedFillGlyphs(); - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "FillGlyphs"; } + std::string GetName() const override { return "FillGlyphs"; } private: friend class RecordedEvent; @@ -427,14 +415,13 @@ class RecordedMask : public RecordedDrawingEvent { StorePattern(mMask, aMask); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Mask"; } + std::string GetName() const override { return "Mask"; } private: friend class RecordedEvent; @@ -460,14 +447,14 @@ class RecordedStroke : public RecordedDrawingEvent { StorePattern(mPattern, aPattern); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; virtual void OutputSimpleEventInfo( std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Stroke"; } + std::string GetName() const override { return "Stroke"; } private: friend class RecordedEvent; @@ -486,14 +473,13 @@ class RecordedClearRect : public RecordedDrawingEvent { RecordedClearRect(DrawTarget *aDT, const Rect &aRect) : RecordedDrawingEvent(CLEARRECT, aDT), mRect(aRect) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "ClearRect"; } + std::string GetName() const override { return "ClearRect"; } private: friend class RecordedEvent; @@ -513,14 +499,13 @@ class RecordedCopySurface : public RecordedDrawingEvent { mSourceRect(aSourceRect), mDest(aDest) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "CopySurface"; } + std::string GetName() const override { return "CopySurface"; } private: friend class RecordedEvent; @@ -538,14 +523,13 @@ class RecordedPushClip : public RecordedDrawingEvent { RecordedPushClip(DrawTarget *aDT, ReferencePtr aPath) : RecordedDrawingEvent(PUSHCLIP, aDT), mPath(aPath) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "PushClip"; } + std::string GetName() const override { return "PushClip"; } private: friend class RecordedEvent; @@ -561,14 +545,13 @@ class RecordedPushClipRect : public RecordedDrawingEvent { RecordedPushClipRect(DrawTarget *aDT, const Rect &aRect) : RecordedDrawingEvent(PUSHCLIPRECT, aDT), mRect(aRect) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "PushClipRect"; } + std::string GetName() const override { return "PushClipRect"; } private: friend class RecordedEvent; @@ -584,14 +567,13 @@ class RecordedPopClip : public RecordedDrawingEvent { MOZ_IMPLICIT RecordedPopClip(DrawTarget *aDT) : RecordedDrawingEvent(POPCLIP, aDT) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "PopClip"; } + std::string GetName() const override { return "PopClip"; } private: friend class RecordedEvent; @@ -613,14 +595,13 @@ class RecordedPushLayer : public RecordedDrawingEvent { mBounds(aBounds), mCopyBackground(aCopyBackground) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "PushLayer"; } + std::string GetName() const override { return "PushLayer"; } private: friend class RecordedEvent; @@ -652,14 +633,14 @@ class RecordedPushLayerWithBlend mCopyBackground(aCopyBackground), mCompositionOp(aCompositionOp) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; virtual void OutputSimpleEventInfo( std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "PushLayerWithBlend"; } + std::string GetName() const override { return "PushLayerWithBlend"; } private: friend class RecordedEvent; @@ -681,14 +662,13 @@ class RecordedPopLayer : public RecordedDrawingEvent { MOZ_IMPLICIT RecordedPopLayer(DrawTarget *aDT) : RecordedDrawingEvent(POPLAYER, aDT) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "PopLayer"; } + std::string GetName() const override { return "PopLayer"; } private: friend class RecordedEvent; @@ -702,14 +682,13 @@ class RecordedSetTransform : public RecordedDrawingEvent { RecordedSetTransform(DrawTarget *aDT, const Matrix &aTransform) : RecordedDrawingEvent(SETTRANSFORM, aDT), mTransform(aTransform) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "SetTransform"; } + std::string GetName() const override { return "SetTransform"; } Matrix mTransform; @@ -733,14 +712,13 @@ class RecordedDrawSurface : public RecordedDrawingEvent { mDSOptions(aDSOptions), mOptions(aOptions) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "DrawSurface"; } + std::string GetName() const override { return "DrawSurface"; } private: friend class RecordedEvent; @@ -767,16 +745,13 @@ class RecordedDrawDependentSurface mDSOptions(aDSOptions), mOptions(aOptions) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "DrawDependentSurface"; - } + std::string GetName() const override { return "DrawDependentSurface"; } private: friend class RecordedEvent; @@ -805,16 +780,13 @@ class RecordedDrawSurfaceWithShadow mSigma(aSigma), mOp(aOp) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "DrawSurfaceWithShadow"; - } + std::string GetName() const override { return "DrawSurfaceWithShadow"; } private: friend class RecordedEvent; @@ -841,14 +813,13 @@ class RecordedDrawFilter : public RecordedDrawingEvent { mDestPoint(aDestPoint), mOptions(aOptions) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "DrawFilter"; } + std::string GetName() const override { return "DrawFilter"; } private: friend class RecordedEvent; @@ -867,15 +838,14 @@ class RecordedPathCreation : public RecordedEventDerived { MOZ_IMPLICIT RecordedPathCreation(PathRecording *aPath); ~RecordedPathCreation(); - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Path Creation"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "Path Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -894,15 +864,14 @@ class RecordedPathDestruction MOZ_IMPLICIT RecordedPathDestruction(PathRecording *aPath) : RecordedEventDerived(PATHDESTRUCTION), mRefPtr(aPath) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Path Destruction"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "Path Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -929,17 +898,14 @@ class RecordedSourceSurfaceCreation ~RecordedSourceSurfaceCreation(); - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "SourceSurface Creation"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "SourceSurface Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -961,17 +927,14 @@ class RecordedSourceSurfaceDestruction MOZ_IMPLICIT RecordedSourceSurfaceDestruction(ReferencePtr aRefPtr) : RecordedEventDerived(SOURCESURFACEDESTRUCTION), mRefPtr(aRefPtr) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "SourceSurface Destruction"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "SourceSurface Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1023,15 +986,14 @@ class RecordedFilterNodeCreation ~RecordedFilterNodeCreation(); - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "FilterNode Creation"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "FilterNode Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1049,17 +1011,14 @@ class RecordedFilterNodeDestruction MOZ_IMPLICIT RecordedFilterNodeDestruction(ReferencePtr aRefPtr) : RecordedEventDerived(FILTERNODEDESTRUCTION), mRefPtr(aRefPtr) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "FilterNode Destruction"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "FilterNode Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1084,17 +1043,14 @@ class RecordedGradientStopsCreation ~RecordedGradientStopsCreation(); - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "GradientStops Creation"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "GradientStops Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1115,17 +1071,14 @@ class RecordedGradientStopsDestruction MOZ_IMPLICIT RecordedGradientStopsDestruction(ReferencePtr aRefPtr) : RecordedEventDerived(GRADIENTSTOPSDESTRUCTION), mRefPtr(aRefPtr) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "GradientStops Destruction"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "GradientStops Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1141,15 +1094,14 @@ class RecordedSnapshot : public RecordedEventDerived { RecordedSnapshot(ReferencePtr aRefPtr, DrawTarget *aDT) : RecordedEventDerived(SNAPSHOT), mRefPtr(aRefPtr), mDT(aDT) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Snapshot"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "Snapshot"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1172,15 +1124,14 @@ class RecordedIntoLuminanceSource mLuminanceType(aLuminanceType), mOpacity(aOpacity) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "IntoLuminanceSource"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "IntoLuminanceSource"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1211,19 +1162,18 @@ class RecordedFontData : public RecordedEventDerived { aUnscaledFont->GetFontFileData(&FontDataProc, this) && mData; } - ~RecordedFontData(); + virtual ~RecordedFontData(); bool IsValid() const { return mGetFontFileDataSucceeded; } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Font Data"; } - virtual ReferencePtr GetObjectRef() const override { return nullptr; }; + std::string GetName() const override { return "Font Data"; } + ReferencePtr GetObjectRef() const override { return nullptr; }; void SetFontData(const uint8_t *aData, uint32_t aSize, uint32_t aIndex); @@ -1259,19 +1209,18 @@ class RecordedFontDescriptor mHasDesc = aUnscaledFont->GetFontDescriptor(FontDescCb, this); } - ~RecordedFontDescriptor(); + virtual ~RecordedFontDescriptor(); bool IsValid() const { return mHasDesc; } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "Font Desc"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "Font Desc"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1308,17 +1257,14 @@ class RecordedUnscaledFontCreation aUnscaledFont->GetFontInstanceData(FontInstanceDataProc, this); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "UnscaledFont Creation"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "UnscaledFont Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } void SetFontInstanceData(const uint8_t *aData, uint32_t aSize); @@ -1340,16 +1286,13 @@ class RecordedUnscaledFontDestruction MOZ_IMPLICIT RecordedUnscaledFontDestruction(ReferencePtr aRefPtr) : RecordedEventDerived(UNSCALEDFONTDESTRUCTION), mRefPtr(aRefPtr) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "UnscaledFont Destruction"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "UnscaledFont Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1381,15 +1324,14 @@ class RecordedScaledFontCreation aScaledFont->GetFontInstanceData(FontInstanceDataProc, this); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "ScaledFont Creation"; } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "ScaledFont Creation"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } void SetFontInstanceData(const uint8_t *aData, uint32_t aSize, const FontVariation *aVariations, @@ -1414,17 +1356,14 @@ class RecordedScaledFontDestruction MOZ_IMPLICIT RecordedScaledFontDestruction(ReferencePtr aRefPtr) : RecordedEventDerived(SCALEDFONTDESTRUCTION), mRefPtr(aRefPtr) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { - return "ScaledFont Destruction"; - } - virtual ReferencePtr GetObjectRef() const override { return mRefPtr; } + std::string GetName() const override { return "ScaledFont Destruction"; } + ReferencePtr GetObjectRef() const override { return mRefPtr; } private: friend class RecordedEvent; @@ -1448,14 +1387,13 @@ class RecordedMaskSurface : public RecordedDrawingEvent { StorePattern(mPattern, aPattern); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "MaskSurface"; } + std::string GetName() const override { return "MaskSurface"; } private: friend class RecordedEvent; @@ -1510,14 +1448,13 @@ class RecordedFilterNodeSetAttribute memcpy(&mPayload.front(), aFloat, sizeof(Float) * aSize); } - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "SetAttribute"; } - virtual ReferencePtr GetObjectRef() const override { return mNode; } + std::string GetName() const override { return "SetAttribute"; } + ReferencePtr GetObjectRef() const override { return mNode; } private: friend class RecordedEvent; @@ -1551,14 +1488,13 @@ class RecordedFilterNodeSetInput mInputFilter(nullptr), mInputSurface(aInputSurface) {} - virtual bool PlayEvent(Translator *aTranslator) const override; + bool PlayEvent(Translator *aTranslator) const override; template void Record(S &aStream) const; - virtual void OutputSimpleEventInfo( - std::stringstream &aStringStream) const override; + void OutputSimpleEventInfo(std::stringstream &aStringStream) const override; - virtual std::string GetName() const override { return "SetInput"; } - virtual ReferencePtr GetObjectRef() const override { return mNode; } + std::string GetName() const override { return "SetInput"; } + ReferencePtr GetObjectRef() const override { return mNode; } private: friend class RecordedEvent; diff --git a/gfx/2d/Rect.h b/gfx/2d/Rect.h index 76c400c229b8..be8990432cc5 100644 --- a/gfx/2d/Rect.h +++ b/gfx/2d/Rect.h @@ -358,16 +358,16 @@ Maybe UnionMaybeRects(const Maybe& a, const Maybe& b) { } } -struct RectCornerRadii { +struct RectCornerRadii final { Size radii[eCornerCount]; - RectCornerRadii() {} + RectCornerRadii() = default; explicit RectCornerRadii(Float radius) { NS_FOR_CSS_FULL_CORNERS(i) { radii[i].SizeTo(radius, radius); } } - explicit RectCornerRadii(Float radiusX, Float radiusY) { + RectCornerRadii(Float radiusX, Float radiusY) { NS_FOR_CSS_FULL_CORNERS(i) { radii[i].SizeTo(radiusX, radiusY); } } diff --git a/gfx/2d/ScaledFontMac.cpp b/gfx/2d/ScaledFontMac.cpp index 5d772210c0f5..8bcbdce3f789 100644 --- a/gfx/2d/ScaledFontMac.cpp +++ b/gfx/2d/ScaledFontMac.cpp @@ -40,7 +40,7 @@ namespace gfx { // Simple helper class to automatically release a CFObject when it goes out // of scope. template -class AutoRelease { +class AutoRelease final { public: explicit AutoRelease(T aObject) : mObject(aObject) {} @@ -230,7 +230,7 @@ static int maxPow2LessThan(int a) { return shift; } -struct writeBuf { +struct writeBuf final { explicit writeBuf(int size) { this->data = new unsigned char[size]; this->offset = 0; diff --git a/gfx/2d/SourceSurfaceCairo.h b/gfx/2d/SourceSurfaceCairo.h index 5dd49fd91df7..4fcdfa2de8e7 100644 --- a/gfx/2d/SourceSurfaceCairo.h +++ b/gfx/2d/SourceSurfaceCairo.h @@ -28,10 +28,10 @@ class SourceSurfaceCairo : public SourceSurface { DrawTargetCairo* aDrawTarget = nullptr); virtual ~SourceSurfaceCairo(); - virtual SurfaceType GetType() const override { return SurfaceType::CAIRO; } - virtual IntSize GetSize() const override; - virtual SurfaceFormat GetFormat() const override; - virtual already_AddRefed GetDataSurface() override; + SurfaceType GetType() const override { return SurfaceType::CAIRO; } + IntSize GetSize() const override; + SurfaceFormat GetFormat() const override; + already_AddRefed GetDataSurface() override; cairo_surface_t* GetSurface() const; @@ -52,14 +52,12 @@ class DataSourceSurfaceCairo : public DataSourceSurface { explicit DataSourceSurfaceCairo(cairo_surface_t* imageSurf); virtual ~DataSourceSurfaceCairo(); - virtual unsigned char* GetData() override; - virtual int32_t Stride() override; + unsigned char* GetData() override; + int32_t Stride() override; - virtual SurfaceType GetType() const override { - return SurfaceType::CAIRO_IMAGE; - } - virtual IntSize GetSize() const override; - virtual SurfaceFormat GetFormat() const override; + SurfaceType GetType() const override { return SurfaceType::CAIRO_IMAGE; } + IntSize GetSize() const override; + SurfaceFormat GetFormat() const override; cairo_surface_t* GetSurface() const; diff --git a/gfx/2d/SourceSurfaceCapture.h b/gfx/2d/SourceSurfaceCapture.h index b04f63adc4a3..50d6e65564b3 100644 --- a/gfx/2d/SourceSurfaceCapture.h +++ b/gfx/2d/SourceSurfaceCapture.h @@ -23,11 +23,11 @@ class SourceSurfaceCapture : public SourceSurface { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceCapture, override) explicit SourceSurfaceCapture(DrawTargetCaptureImpl* aOwner); - explicit SourceSurfaceCapture(DrawTargetCaptureImpl* aOwner, - LuminanceType aLuminanceType, float aOpacity); - explicit SourceSurfaceCapture(DrawTargetCaptureImpl* aOwner, - SourceSurface* aSurfToOptimize); - ~SourceSurfaceCapture(); + SourceSurfaceCapture(DrawTargetCaptureImpl* aOwner, + LuminanceType aLuminanceType, float aOpacity); + SourceSurfaceCapture(DrawTargetCaptureImpl* aOwner, + SourceSurface* aSurfToOptimize); + virtual ~SourceSurfaceCapture(); SurfaceType GetType() const override { return SurfaceType::CAPTURE; } IntSize GetSize() const override { return mSize; } diff --git a/gfx/2d/SourceSurfaceD2D1.h b/gfx/2d/SourceSurfaceD2D1.h index f204a5b49b52..56642268e164 100644 --- a/gfx/2d/SourceSurfaceD2D1.h +++ b/gfx/2d/SourceSurfaceD2D1.h @@ -27,13 +27,11 @@ class SourceSurfaceD2D1 : public SourceSurface { DrawTargetD2D1 *aDT = nullptr); ~SourceSurfaceD2D1(); - virtual SurfaceType GetType() const override { - return SurfaceType::D2D1_1_IMAGE; - } - virtual IntSize GetSize() const override { return mSize; } - virtual SurfaceFormat GetFormat() const override { return mFormat; } - virtual bool IsValid() const override; - virtual already_AddRefed GetDataSurface() override; + SurfaceType GetType() const override { return SurfaceType::D2D1_1_IMAGE; } + IntSize GetSize() const override { return mSize; } + SurfaceFormat GetFormat() const override { return mFormat; } + bool IsValid() const override; + already_AddRefed GetDataSurface() override; ID2D1Image *GetImage() { return mImage; } @@ -77,14 +75,14 @@ class DataSourceSurfaceD2D1 : public DataSourceSurface { DataSourceSurfaceD2D1(ID2D1Bitmap1 *aMappableBitmap, SurfaceFormat aFormat); ~DataSourceSurfaceD2D1(); - virtual SurfaceType GetType() const override { return SurfaceType::DATA; } - virtual IntSize GetSize() const override; - virtual SurfaceFormat GetFormat() const override { return mFormat; } - virtual bool IsValid() const override { return !!mBitmap; } - virtual uint8_t *GetData() override; - virtual int32_t Stride() override; - virtual bool Map(MapType, MappedSurface *aMappedSurface) override; - virtual void Unmap() override; + SurfaceType GetType() const override { return SurfaceType::DATA; } + IntSize GetSize() const override; + SurfaceFormat GetFormat() const override { return mFormat; } + bool IsValid() const override { return !!mBitmap; } + uint8_t *GetData() override; + int32_t Stride() override; + bool Map(MapType, MappedSurface *aMappedSurface) override; + void Unmap() override; private: friend class SourceSurfaceD2DTarget; diff --git a/gfx/2d/SourceSurfaceSkia.h b/gfx/2d/SourceSurfaceSkia.h index 24eee29fd24b..fb5eb4864fa2 100644 --- a/gfx/2d/SourceSurfaceSkia.h +++ b/gfx/2d/SourceSurfaceSkia.h @@ -25,11 +25,11 @@ class SourceSurfaceSkia : public DataSourceSurface { MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DataSourceSurfaceSkia, override) SourceSurfaceSkia(); - ~SourceSurfaceSkia(); + virtual ~SourceSurfaceSkia(); - virtual SurfaceType GetType() const override { return SurfaceType::SKIA; } - virtual IntSize GetSize() const override; - virtual SurfaceFormat GetFormat() const override; + SurfaceType GetType() const override { return SurfaceType::SKIA; } + IntSize GetSize() const override; + SurfaceFormat GetFormat() const override; // This is only ever called by the DT destructor, which can only ever happen // from one place at a time. Therefore it doesn't need to hold the ChangeMutex @@ -49,16 +49,16 @@ class SourceSurfaceSkia : public DataSourceSurface { SurfaceFormat aFormat = SurfaceFormat::UNKNOWN, DrawTargetSkia* aOwner = nullptr); - virtual uint8_t* GetData() override; + uint8_t* GetData() override; /** * The caller is responsible for ensuring aMappedSurface is not null. */ - virtual bool Map(MapType, MappedSurface* aMappedSurface) override; + bool Map(MapType, MappedSurface* aMappedSurface) override; - virtual void Unmap() override; + void Unmap() override; - virtual int32_t Stride() override { return mStride; } + int32_t Stride() override { return mStride; } private: friend class DrawTargetSkia; diff --git a/gfx/2d/StackArray.h b/gfx/2d/StackArray.h index 89bdcaf7fa0a..165d45cb12ad 100644 --- a/gfx/2d/StackArray.h +++ b/gfx/2d/StackArray.h @@ -9,7 +9,7 @@ */ template -class StackArray { +class StackArray final { public: explicit StackArray(size_t count) { if (count > size) { diff --git a/gfx/2d/Tools.h b/gfx/2d/Tools.h index 16a7753c943e..c58e9c1a3612 100644 --- a/gfx/2d/Tools.h +++ b/gfx/2d/Tools.h @@ -76,7 +76,7 @@ static inline Float Distance(Point aA, Point aB) { } template -struct AlignedArray { +struct AlignedArray final { typedef T value_type; AlignedArray() : mPtr(nullptr), mStorage(nullptr), mCount(0) {} diff --git a/gfx/2d/UnscaledFontFreeType.h b/gfx/2d/UnscaledFontFreeType.h index e2d5fb81d50b..06a4235fd346 100644 --- a/gfx/2d/UnscaledFontFreeType.h +++ b/gfx/2d/UnscaledFontFreeType.h @@ -34,7 +34,7 @@ class UnscaledFontFreeType : public UnscaledFont { mOwnsFace(false), mIndex(0), mNativeFontResource(aNativeFontResource) {} - ~UnscaledFontFreeType() { + virtual ~UnscaledFontFreeType() { if (mOwnsFace) { Factory::ReleaseFTFace(mFace); } diff --git a/gfx/2d/UnscaledFontMac.h b/gfx/2d/UnscaledFontMac.h index 0f0568d912cc..703e3ee58b01 100644 --- a/gfx/2d/UnscaledFontMac.h +++ b/gfx/2d/UnscaledFontMac.h @@ -27,7 +27,7 @@ class UnscaledFontMac final : public UnscaledFont { : mFont(aFont), mIsDataFont(aIsDataFont), mNeedsCairo(aNeedsCairo) { CFRetain(mFont); } - ~UnscaledFontMac() { CFRelease(mFont); } + virtual ~UnscaledFontMac() { CFRelease(mFont); } FontType GetType() const override { return FontType::MAC; } diff --git a/gfx/gl/AndroidNativeWindow.h b/gfx/gl/AndroidNativeWindow.h index dafb1da1ffe5..a32aa4697986 100644 --- a/gfx/gl/AndroidNativeWindow.h +++ b/gfx/gl/AndroidNativeWindow.h @@ -17,7 +17,7 @@ namespace mozilla { namespace gl { -class AndroidNativeWindow { +class AndroidNativeWindow final { public: AndroidNativeWindow() : mNativeWindow(nullptr) {} diff --git a/gfx/gl/AndroidSurfaceTexture.cpp b/gfx/gl/AndroidSurfaceTexture.cpp index dbbc23fd6dd3..b222232000f3 100644 --- a/gfx/gl/AndroidSurfaceTexture.cpp +++ b/gfx/gl/AndroidSurfaceTexture.cpp @@ -35,7 +35,7 @@ void AndroidSurfaceTexture::GetTransformMatrix( env->ReleaseFloatArrayElements(jarray.Get(), array, 0); } -class SharedGL { +class SharedGL final { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedGL); diff --git a/gfx/gl/GLContextGLX.h b/gfx/gl/GLContextGLX.h index 89b607957468..47112b977572 100644 --- a/gfx/gl/GLContextGLX.h +++ b/gfx/gl/GLContextGLX.h @@ -33,11 +33,9 @@ class GLContextGLX : public GLContext { ScopedXFree* const out_scopedConfigArr, GLXFBConfig* const out_config, int* const out_visid, bool aWebRender); - ~GLContextGLX() override; + virtual ~GLContextGLX(); - virtual GLContextType GetContextType() const override { - return GLContextType::GLX; - } + GLContextType GetContextType() const override { return GLContextType::GLX; } static GLContextGLX* Cast(GLContext* gl) { MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX); @@ -46,17 +44,17 @@ class GLContextGLX : public GLContext { bool Init() override; - virtual bool MakeCurrentImpl() const override; + bool MakeCurrentImpl() const override; - virtual bool IsCurrentImpl() const override; + bool IsCurrentImpl() const override; Maybe GetSymbolLoader() const override; - virtual bool IsDoubleBuffered() const override; + bool IsDoubleBuffered() const override; - virtual bool SwapBuffers() override; + bool SwapBuffers() override; - virtual void GetWSIInfo(nsCString* const out) const override; + void GetWSIInfo(nsCString* const out) const override; // Overrides the current GLXDrawable backing the context and makes the // context current. diff --git a/gfx/gl/GLTextureImage.h b/gfx/gl/GLTextureImage.h index 88064af5b825..9c6d1a0b0b76 100644 --- a/gfx/gl/GLTextureImage.h +++ b/gfx/gl/GLTextureImage.h @@ -177,16 +177,15 @@ class BasicTextureImage : public TextureImage { GLContext* aContext, TextureImage::Flags aFlags = TextureImage::NoFlags); - virtual void BindTexture(GLenum aTextureUnit) override; + void BindTexture(GLenum aTextureUnit) override; - virtual bool DirectUpdate( - gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, - const gfx::IntPoint& aFrom = gfx::IntPoint(0, 0)) override; - virtual GLuint GetTextureID() override { return mTexture; } + bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, + const gfx::IntPoint& aFrom = gfx::IntPoint(0, 0)) override; + GLuint GetTextureID() override { return mTexture; } - virtual void MarkValid() override { mTextureState = Valid; } + void MarkValid() override { mTextureState = Valid; } - virtual void Resize(const gfx::IntSize& aSize) override; + void Resize(const gfx::IntSize& aSize) override; protected: GLuint mTexture; @@ -205,25 +204,24 @@ class TiledTextureImage final : public TextureImage { GLContext* aGL, gfx::IntSize aSize, TextureImage::ContentType, TextureImage::Flags aFlags = TextureImage::NoFlags, TextureImage::ImageFormat aImageFormat = gfx::SurfaceFormat::UNKNOWN); - ~TiledTextureImage(); + virtual ~TiledTextureImage(); void DumpDiv(); - virtual void Resize(const gfx::IntSize& aSize) override; - virtual uint32_t GetTileCount() override; - virtual void BeginBigImageIteration() override; - virtual bool NextTile() override; - virtual void SetIterationCallback(BigImageIterationCallback aCallback, - void* aCallbackData) override; - virtual gfx::IntRect GetTileRect() override; - virtual GLuint GetTextureID() override { + void Resize(const gfx::IntSize& aSize) override; + uint32_t GetTileCount() override; + void BeginBigImageIteration() override; + bool NextTile() override; + void SetIterationCallback(BigImageIterationCallback aCallback, + void* aCallbackData) override; + gfx::IntRect GetTileRect() override; + GLuint GetTextureID() override { return mImages[mCurrentImage]->GetTextureID(); } - virtual bool DirectUpdate( - gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, - const gfx::IntPoint& aFrom = gfx::IntPoint(0, 0)) override; - virtual void BindTexture(GLenum) override; + bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, + const gfx::IntPoint& aFrom = gfx::IntPoint(0, 0)) override; + void BindTexture(GLenum) override; protected: - virtual gfx::IntRect GetSrcTileRect() override; + gfx::IntRect GetSrcTileRect() override; unsigned int mCurrentImage; BigImageIterationCallback mIterationCallback; diff --git a/gfx/gl/SharedSurface.h b/gfx/gl/SharedSurface.h index 49007c0056b2..2797bdc29bed 100644 --- a/gfx/gl/SharedSurface.h +++ b/gfx/gl/SharedSurface.h @@ -288,7 +288,7 @@ class SurfaceFactory : public SupportsWeakPtr { bool Recycle(layers::SharedSurfaceTextureClient* texClient); }; -class ScopedReadbackFB { +class ScopedReadbackFB final { GLContext* const mGL; ScopedBindFramebuffer mAutoFB; GLuint mTempFB = 0; diff --git a/gfx/gl/SharedSurfaceD3D11Interop.h b/gfx/gl/SharedSurfaceD3D11Interop.h index 79d5a42081e3..d922bcbefdf0 100644 --- a/gfx/gl/SharedSurfaceD3D11Interop.h +++ b/gfx/gl/SharedSurfaceD3D11Interop.h @@ -49,25 +49,25 @@ class SharedSurface_D3D11Interop : public SharedSurface { HANDLE dxgiHandle); public: - virtual ~SharedSurface_D3D11Interop() override; + virtual ~SharedSurface_D3D11Interop(); - virtual void LockProdImpl() override {} - virtual void UnlockProdImpl() override {} + void LockProdImpl() override {} + void UnlockProdImpl() override {} - virtual void ProducerAcquireImpl() override; - virtual void ProducerReleaseImpl() override; + void ProducerAcquireImpl() override; + void ProducerReleaseImpl() override; - virtual GLuint ProdRenderbuffer() override { + GLuint ProdRenderbuffer() override { MOZ_ASSERT(!mProdTex); return mInteropRB; } - virtual GLuint ProdTexture() override { + GLuint ProdTexture() override { MOZ_ASSERT(mProdTex); return mProdTex; } - virtual bool ToSurfaceDescriptor( + bool ToSurfaceDescriptor( layers::SurfaceDescriptor* const out_descriptor) override; }; @@ -86,11 +86,10 @@ class SurfaceFactory_D3D11Interop : public SurfaceFactory { DXInterop2Device* interop); public: - virtual ~SurfaceFactory_D3D11Interop() override; + virtual ~SurfaceFactory_D3D11Interop(); protected: - virtual UniquePtr CreateShared( - const gfx::IntSize& size) override { + UniquePtr CreateShared(const gfx::IntSize& size) override { bool hasAlpha = mReadCaps.alpha; return SharedSurface_D3D11Interop::Create(mInterop, mGL, size, hasAlpha); } diff --git a/gfx/ipc/CompositorOptions.h b/gfx/ipc/CompositorOptions.h index 797780cde56b..4794ef4fb7bb 100644 --- a/gfx/ipc/CompositorOptions.h +++ b/gfx/ipc/CompositorOptions.h @@ -35,7 +35,7 @@ class CompositorOptions { mUseAdvancedLayers(false), mInitiallyPaused(false) {} - explicit CompositorOptions(bool aUseAPZ, bool aUseWebRender) + CompositorOptions(bool aUseAPZ, bool aUseWebRender) : mUseAPZ(aUseAPZ), mUseWebRender(aUseWebRender), mUseAdvancedLayers(false), diff --git a/gfx/ipc/CrossProcessPaint.h b/gfx/ipc/CrossProcessPaint.h index a9ee846ed276..0b24192846e8 100644 --- a/gfx/ipc/CrossProcessPaint.h +++ b/gfx/ipc/CrossProcessPaint.h @@ -30,7 +30,7 @@ class CrossProcessPaint; /** * A fragment of a paint of a cross process document tree. */ -class PaintFragment { +class PaintFragment final { public: /// Initializes an empty PaintFragment PaintFragment() = default; @@ -74,7 +74,7 @@ class PaintFragment { /** * An object for painting a cross process document tree. */ -class CrossProcessPaint { +class CrossProcessPaint final { NS_INLINE_DECL_REFCOUNTING(CrossProcessPaint); public: diff --git a/gfx/ipc/GPUChild.h b/gfx/ipc/GPUChild.h index db9f52000f75..451e449aa519 100644 --- a/gfx/ipc/GPUChild.h +++ b/gfx/ipc/GPUChild.h @@ -28,7 +28,7 @@ class GPUChild final : public PGPUChild, public gfxVarReceiver { public: explicit GPUChild(GPUProcessHost* aHost); - ~GPUChild(); + virtual ~GPUChild(); void Init(); diff --git a/gfx/ipc/GPUProcessImpl.h b/gfx/ipc/GPUProcessImpl.h index a205e2b2333b..6ea353fe5613 100644 --- a/gfx/ipc/GPUProcessImpl.h +++ b/gfx/ipc/GPUProcessImpl.h @@ -21,7 +21,7 @@ namespace gfx { class GPUProcessImpl final : public ipc::ProcessChild { public: explicit GPUProcessImpl(ProcessId aParentPid); - ~GPUProcessImpl(); + virtual ~GPUProcessImpl(); bool Init(int aArgc, char* aArgv[]) override; void CleanUp() override; diff --git a/gfx/ipc/GPUProcessListener.h b/gfx/ipc/GPUProcessListener.h index ebe19b20bb7b..a54c890ba0ef 100644 --- a/gfx/ipc/GPUProcessListener.h +++ b/gfx/ipc/GPUProcessListener.h @@ -11,7 +11,7 @@ namespace gfx { class GPUProcessListener { public: - virtual ~GPUProcessListener() {} + virtual ~GPUProcessListener() = default; // Called when the compositor has died and the rendering stack must be // recreated. diff --git a/gfx/ipc/GPUProcessManager.h b/gfx/ipc/GPUProcessManager.h index 67d65d10eec9..b8429c4b4e7b 100644 --- a/gfx/ipc/GPUProcessManager.h +++ b/gfx/ipc/GPUProcessManager.h @@ -248,7 +248,7 @@ class GPUProcessManager final : public GPUProcessHost::Listener { explicit Observer(GPUProcessManager* aManager); protected: - ~Observer() {} + virtual ~Observer() = default; GPUProcessManager* mManager; }; diff --git a/gfx/ipc/RemoteCompositorSession.h b/gfx/ipc/RemoteCompositorSession.h index 3ef4b4aea1d8..00cda03c272e 100644 --- a/gfx/ipc/RemoteCompositorSession.h +++ b/gfx/ipc/RemoteCompositorSession.h @@ -19,7 +19,7 @@ class RemoteCompositorSession final : public CompositorSession { CompositorWidgetDelegate* aWidgetDelegate, APZCTreeManagerChild* aAPZ, const LayersId& aRootLayerTreeId); - ~RemoteCompositorSession() override; + virtual ~RemoteCompositorSession(); CompositorBridgeParent* GetInProcessBridge() const override; void SetContentController(GeckoContentController* aController) override; diff --git a/gfx/ipc/VsyncBridgeChild.h b/gfx/ipc/VsyncBridgeChild.h index 9e25a45db496..74abdccdc167 100644 --- a/gfx/ipc/VsyncBridgeChild.h +++ b/gfx/ipc/VsyncBridgeChild.h @@ -32,11 +32,11 @@ class VsyncBridgeChild final : public PVsyncBridgeChild { void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId); - virtual void HandleFatalError(const char* aMsg) const override; + void HandleFatalError(const char* aMsg) const override; private: VsyncBridgeChild(RefPtr, const uint64_t& aProcessToken); - ~VsyncBridgeChild(); + virtual ~VsyncBridgeChild(); void Open(Endpoint&& aEndpoint); diff --git a/gfx/layers/AnimationHelper.h b/gfx/layers/AnimationHelper.h index fa63cf548883..3b08de0a4f39 100644 --- a/gfx/layers/AnimationHelper.h +++ b/gfx/layers/AnimationHelper.h @@ -87,7 +87,7 @@ struct AnimationTransform { TransformData mData; }; -struct AnimatedValue { +struct AnimatedValue final { enum { TRANSFORM, OPACITY, COLOR, NONE } mType{NONE}; union { @@ -110,6 +110,9 @@ struct AnimatedValue { explicit AnimatedValue(nscolor aValue) : mType(AnimatedValue::COLOR), mColor(aValue) {} + // Can't use = default as AnimatedValue contains a union and has a variant + // member with non-trivial destructor. + // Otherwise a Deleted implicitly-declared destructor error will occur. ~AnimatedValue() {} private: diff --git a/gfx/layers/AxisPhysicsMSDModel.h b/gfx/layers/AxisPhysicsMSDModel.h index 7bb6adbc1ca0..9bc784bf55fd 100644 --- a/gfx/layers/AxisPhysicsMSDModel.h +++ b/gfx/layers/AxisPhysicsMSDModel.h @@ -22,7 +22,7 @@ class AxisPhysicsMSDModel : public AxisPhysicsModel { double aInitialVelocity, double aSpringConstant, double aDampingRatio); - ~AxisPhysicsMSDModel(); + virtual ~AxisPhysicsMSDModel(); /** * Gets the raw destination of this axis at this moment. @@ -41,7 +41,7 @@ class AxisPhysicsMSDModel : public AxisPhysicsModel { bool IsFinished(double aSmallestVisibleIncrement); protected: - virtual double Acceleration(const State &aState) override; + double Acceleration(const State &aState) override; private: /** diff --git a/gfx/layers/AxisPhysicsModel.h b/gfx/layers/AxisPhysicsModel.h index 113129e08fd1..cfb77fb57e3d 100644 --- a/gfx/layers/AxisPhysicsModel.h +++ b/gfx/layers/AxisPhysicsModel.h @@ -25,7 +25,7 @@ namespace layers { class AxisPhysicsModel { public: AxisPhysicsModel(double aInitialPosition, double aInitialVelocity); - ~AxisPhysicsModel(); + virtual ~AxisPhysicsModel(); /** * Advance the physics simulation. diff --git a/gfx/layers/BSPTree.h b/gfx/layers/BSPTree.h index 94a418a726ec..a4dd584040d1 100644 --- a/gfx/layers/BSPTree.h +++ b/gfx/layers/BSPTree.h @@ -88,7 +88,7 @@ struct BSPTreeNode { * https://en.wikipedia.org/wiki/Binary_space_partitioning * ftp://ftp.sgi.com/other/bspfaq/faq/bspfaq.html */ -class BSPTree { +class BSPTree final { public: /** * The constructor modifies layers in the given list. diff --git a/gfx/layers/BufferTexture.h b/gfx/layers/BufferTexture.h index d906bc2c2499..1c564aea3e51 100644 --- a/gfx/layers/BufferTexture.h +++ b/gfx/layers/BufferTexture.h @@ -36,22 +36,22 @@ class BufferTextureData : public TextureData { gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace, TextureFlags aTextureFlags); - virtual bool Lock(OpenMode aMode) override { return true; } + bool Lock(OpenMode aMode) override { return true; } - virtual void Unlock() override {} + void Unlock() override {} - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual already_AddRefed BorrowDrawTarget() override; + already_AddRefed BorrowDrawTarget() override; - virtual bool BorrowMappedData(MappedTextureData& aMap) override; + bool BorrowMappedData(MappedTextureData& aMap) override; - virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData& aMap) override; + bool BorrowMappedYCbCrData(MappedYCbCrTextureData& aMap) override; // use TextureClient's default implementation - virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; + bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; - virtual BufferTextureData* AsBufferTextureData() override { return this; } + BufferTextureData* AsBufferTextureData() override { return this; } // Don't use this. void SetDescriptor(BufferDescriptor&& aDesc); diff --git a/gfx/layers/CompositionRecorder.h b/gfx/layers/CompositionRecorder.h index 018c77829218..07ce949cfc61 100644 --- a/gfx/layers/CompositionRecorder.h +++ b/gfx/layers/CompositionRecorder.h @@ -30,7 +30,7 @@ class RecordedFrame { TimeStamp GetTimeStamp() { return mTimeStamp; } protected: - virtual ~RecordedFrame() {} + virtual ~RecordedFrame() = default; RecordedFrame(const TimeStamp& aTimeStamp) : mTimeStamp(aTimeStamp) {} private: diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index a44e167463fd..ead071c1fb60 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -186,7 +186,7 @@ class Compositor : public TextureSourceProvider { CompositorBridgeParent* aParent = nullptr); virtual bool Initialize(nsCString* const out_failureReason) = 0; - virtual void Destroy() override; + void Destroy() override; bool IsDestroyed() const { return mIsDestroyed; } virtual void DetachWidget() { mWidget = nullptr; } @@ -471,7 +471,7 @@ class Compositor : public TextureSourceProvider { virtual CompositorD3D11* AsCompositorD3D11() { return nullptr; } virtual BasicCompositor* AsBasicCompositor() { return nullptr; } - virtual Compositor* AsCompositor() override { return this; } + Compositor* AsCompositor() override { return this; } TimeStamp GetLastCompositionEndTime() const override { return mLastCompositionEndTime; @@ -518,7 +518,7 @@ class Compositor : public TextureSourceProvider { // A stale Compositor has no CompositorBridgeParent; it will not process // frames and should not be used. void SetInvalid(); - virtual bool IsValid() const override; + bool IsValid() const override; CompositorBridgeParent* GetCompositorBridgeParent() const { return mParent; } protected: @@ -636,7 +636,7 @@ class AsyncReadbackBuffer { protected: explicit AsyncReadbackBuffer(const gfx::IntSize& aSize) : mSize(aSize) {} - virtual ~AsyncReadbackBuffer() {} + virtual ~AsyncReadbackBuffer() = default; gfx::IntSize mSize; }; diff --git a/gfx/layers/D3D11ShareHandleImage.h b/gfx/layers/D3D11ShareHandleImage.h index fc7cb3f36ee6..96fba6004818 100644 --- a/gfx/layers/D3D11ShareHandleImage.h +++ b/gfx/layers/D3D11ShareHandleImage.h @@ -19,15 +19,14 @@ namespace layers { class D3D11RecycleAllocator : public TextureClientRecycleAllocator { public: - explicit D3D11RecycleAllocator(KnowsCompositor* aAllocator, - ID3D11Device* aDevice) + D3D11RecycleAllocator(KnowsCompositor* aAllocator, ID3D11Device* aDevice) : TextureClientRecycleAllocator(aAllocator), mDevice(aDevice) {} already_AddRefed CreateOrRecycleClient( gfx::SurfaceFormat aFormat, const gfx::IntSize& aSize); protected: - virtual already_AddRefed Allocate( + already_AddRefed Allocate( gfx::SurfaceFormat aFormat, gfx::IntSize aSize, BackendSelector aSelector, TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags) override; @@ -46,7 +45,7 @@ class D3D11ShareHandleImage final : public Image { public: D3D11ShareHandleImage(const gfx::IntSize& aSize, const gfx::IntRect& aRect, const GUID& aSourceFormat); - virtual ~D3D11ShareHandleImage() {} + virtual ~D3D11ShareHandleImage() = default; bool AllocateTexture(D3D11RecycleAllocator* aAllocator, ID3D11Device* aDevice); diff --git a/gfx/layers/D3D11YCbCrImage.cpp b/gfx/layers/D3D11YCbCrImage.cpp index aaf14a12a082..619f55462eb3 100644 --- a/gfx/layers/D3D11YCbCrImage.cpp +++ b/gfx/layers/D3D11YCbCrImage.cpp @@ -270,7 +270,7 @@ already_AddRefed D3D11YCbCrImage::GetAsSourceSurface() { return surface.forget(); } -class AutoCheckLockD3D11Texture { +class AutoCheckLockD3D11Texture final { public: explicit AutoCheckLockD3D11Texture(ID3D11Texture2D* aTexture) : mIsLocked(false) { diff --git a/gfx/layers/D3D9SurfaceImage.h b/gfx/layers/D3D9SurfaceImage.h index 09b077afe02c..09d0aeddf753 100644 --- a/gfx/layers/D3D9SurfaceImage.h +++ b/gfx/layers/D3D9SurfaceImage.h @@ -19,15 +19,14 @@ class TextureClient; class D3D9RecycleAllocator : public TextureClientRecycleAllocator { public: - explicit D3D9RecycleAllocator(KnowsCompositor* aAllocator, - IDirect3DDevice9* aDevice) + D3D9RecycleAllocator(KnowsCompositor* aAllocator, IDirect3DDevice9* aDevice) : TextureClientRecycleAllocator(aAllocator), mDevice(aDevice) {} already_AddRefed CreateOrRecycleClient( gfx::SurfaceFormat aFormat, const gfx::IntSize& aSize); protected: - virtual already_AddRefed Allocate( + already_AddRefed Allocate( gfx::SurfaceFormat aFormat, gfx::IntSize aSize, BackendSelector aSelector, TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags) override; @@ -46,17 +45,17 @@ class DXGID3D9TextureData : public TextureData { TextureFlags aFlags, IDirect3DDevice9* aDevice); - ~DXGID3D9TextureData(); + virtual ~DXGID3D9TextureData(); - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual bool Lock(OpenMode) override { return true; } + bool Lock(OpenMode) override { return true; } - virtual void Unlock() override {} + void Unlock() override {} - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - virtual void Deallocate(LayersIPCChannel* aAllocator) override {} + void Deallocate(LayersIPCChannel* aAllocator) override {} IDirect3DDevice9* GetD3D9Device() { return mDevice; } IDirect3DTexture9* GetD3D9Texture() { return mTexture; } diff --git a/gfx/layers/Effects.h b/gfx/layers/Effects.h index 45ea2bec6318..62f18c37fddc 100644 --- a/gfx/layers/Effects.h +++ b/gfx/layers/Effects.h @@ -53,7 +53,7 @@ struct Effect { virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) = 0; protected: - virtual ~Effect() {} + virtual ~Effect() = default; }; // Render from a texture @@ -66,10 +66,9 @@ struct TexturedEffect : public Effect { mPremultiplied(aPremultiplied), mSamplingFilter(aSamplingFilter) {} - virtual TexturedEffect* AsTexturedEffect() override { return this; } + TexturedEffect* AsTexturedEffect() override { return this; } virtual const char* Name() = 0; - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; gfx::Rect mTextureCoords; TextureSource* mTexture; @@ -86,8 +85,7 @@ struct EffectMask : public Effect { mSize(aSize), mMaskTransform(aMaskTransform) {} - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; TextureSource* mMaskTexture; gfx::IntSize mSize; @@ -99,8 +97,7 @@ struct EffectBlendMode : public Effect { : Effect(EffectTypes::BLEND_MODE), mBlendMode(aBlendMode) {} virtual const char* Name() { return "EffectBlendMode"; } - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; gfx::CompositionOp mBlendMode; }; @@ -112,9 +109,8 @@ struct EffectRenderTarget : public TexturedEffect { gfx::SamplingFilter::LINEAR), mRenderTarget(aRenderTarget) {} - virtual const char* Name() override { return "EffectRenderTarget"; } - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + const char* Name() override { return "EffectRenderTarget"; } + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; RefPtr mRenderTarget; @@ -129,9 +125,7 @@ struct EffectColorMatrix : public Effect { explicit EffectColorMatrix(gfx::Matrix5x4 aMatrix) : Effect(EffectTypes::COLOR_MATRIX), mColorMatrix(aMatrix) {} - virtual const char* Name() { return "EffectColorMatrix"; } - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; const gfx::Matrix5x4 mColorMatrix; }; @@ -141,7 +135,7 @@ struct EffectRGB : public TexturedEffect { : TexturedEffect(EffectTypes::RGB, aTexture, aPremultiplied, aSamplingFilter) {} - virtual const char* Name() override { return "EffectRGB"; } + const char* Name() override { return "EffectRGB"; } }; struct EffectYCbCr : public TexturedEffect { @@ -151,7 +145,7 @@ struct EffectYCbCr : public TexturedEffect { mYUVColorSpace(aYUVColorSpace), mColorDepth(aColorDepth) {} - virtual const char* Name() override { return "EffectYCbCr"; } + const char* Name() override { return "EffectYCbCr"; } gfx::YUVColorSpace mYUVColorSpace; gfx::ColorDepth mColorDepth; @@ -164,7 +158,7 @@ struct EffectNV12 : public EffectYCbCr { mType = EffectTypes::NV12; } - virtual const char* Name() override { return "EffectNV12"; } + const char* Name() override { return "EffectNV12"; } }; struct EffectComponentAlpha : public TexturedEffect { @@ -175,7 +169,7 @@ struct EffectComponentAlpha : public TexturedEffect { mOnBlack(aOnBlack), mOnWhite(aOnWhite) {} - virtual const char* Name() override { return "EffectComponentAlpha"; } + const char* Name() override { return "EffectComponentAlpha"; } TextureSource* mOnBlack; TextureSource* mOnWhite; @@ -185,8 +179,7 @@ struct EffectSolidColor : public Effect { explicit EffectSolidColor(const gfx::Color& aColor) : Effect(EffectTypes::SOLID_COLOR), mColor(aColor) {} - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; gfx::Color mColor; }; diff --git a/gfx/layers/GPUVideoImage.h b/gfx/layers/GPUVideoImage.h index 1be277926d8c..e5097c1b020f 100644 --- a/gfx/layers/GPUVideoImage.h +++ b/gfx/layers/GPUVideoImage.h @@ -43,7 +43,7 @@ class GPUVideoImage final : public Image { ImageBridgeChild::GetSingleton().get()); } - virtual ~GPUVideoImage() {} + virtual ~GPUVideoImage() = default; gfx::IntSize GetSize() const override { return mSize; } diff --git a/gfx/layers/IPDLActor.h b/gfx/layers/IPDLActor.h index 63858015beca..b5eb04d0dcea 100644 --- a/gfx/layers/IPDLActor.h +++ b/gfx/layers/IPDLActor.h @@ -39,7 +39,7 @@ class ParentActor : public Protocol { typedef ipc::IProtocol::ActorDestroyReason Why; - virtual void ActorDestroy(Why) override { DestroyIfNeeded(); } + void ActorDestroy(Why) override { DestroyIfNeeded(); } protected: void DestroyIfNeeded() { diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index 0840a45b0296..5b310f4e2cd7 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -161,7 +161,7 @@ class D3D11YCbCrRecycleAllocator; class SurfaceDescriptorBuffer; struct ImageBackendData { - virtual ~ImageBackendData() {} + virtual ~ImageBackendData() = default; protected: ImageBackendData() {} @@ -244,7 +244,7 @@ class Image { : mImplData(aImplData), mSerial(++sSerialCounter), mFormat(aFormat) {} // Protected destructor, to discourage deletion outside of Release(): - virtual ~Image() {} + virtual ~Image() = default; mozilla::EnumeratedArray CreatePlanarYCbCrImage( const gfx::IntSize& aScaleHint, BufferRecycleBin* aRecycleBin); @@ -802,7 +802,7 @@ class PlanarYCbCrImage : public Image { enum { MAX_DIMENSION = 16384 }; - virtual ~PlanarYCbCrImage() {} + virtual ~PlanarYCbCrImage() = default; /** * This makes a copy of the data buffers, in order to support functioning diff --git a/gfx/layers/ImageLayers.h b/gfx/layers/ImageLayers.h index fd2c185c8a8a..22e17a500f4a 100644 --- a/gfx/layers/ImageLayers.h +++ b/gfx/layers/ImageLayers.h @@ -66,23 +66,21 @@ class ImageLayer : public Layer { MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE) - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override; - virtual const gfx::Matrix4x4& GetEffectiveTransformForBuffer() - const override { + const gfx::Matrix4x4& GetEffectiveTransformForBuffer() const override { return mEffectiveTransformForBuffer; } - virtual ImageLayer* AsImageLayer() override { return this; } + ImageLayer* AsImageLayer() override { return this; } protected: ImageLayer(LayerManager* aManager, void* aImplData); - ~ImageLayer(); - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; - virtual void DumpPacket(layerscope::LayersPacket* aPacket, - const void* aParent) override; + virtual ~ImageLayer(); + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; + void DumpPacket(layerscope::LayersPacket* aPacket, + const void* aParent) override; RefPtr mContainer; gfx::SamplingFilter mSamplingFilter; diff --git a/gfx/layers/LayerMetricsWrapper.h b/gfx/layers/LayerMetricsWrapper.h index 53e868349a80..91ebe8e0ba32 100644 --- a/gfx/layers/LayerMetricsWrapper.h +++ b/gfx/layers/LayerMetricsWrapper.h @@ -120,7 +120,7 @@ namespace layers { * alternative of making mIndex a int32_t that can store -1, but then having * to cast to uint32_t all over the place. */ -class MOZ_STACK_CLASS LayerMetricsWrapper { +class MOZ_STACK_CLASS LayerMetricsWrapper final { public: enum StartAt { TOP, diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index bd76b27721b3..f76bb9a0ae03 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -147,7 +147,7 @@ class LayerScopeWebSocketManager { } private: - virtual ~SocketListener() {} + virtual ~SocketListener() = default; }; /* @@ -380,7 +380,7 @@ class DebugGLData : public LinkedListElement { public: explicit DebugGLData(Packet::DataType aDataType) : mDataType(aDataType) {} - virtual ~DebugGLData() {} + virtual ~DebugGLData() = default; virtual bool Write() = 0; @@ -405,7 +405,7 @@ class DebugGLFrameStatusData final : public DebugGLData { explicit DebugGLFrameStatusData(Packet::DataType aDataType) : DebugGLData(aDataType), mFrameStamp(0) {} - virtual bool Write() override { + bool Write() override { Packet packet; packet.set_type(mDataType); @@ -441,7 +441,7 @@ class DebugGLTextureData final : public DebugGLData { pack(img); } - virtual bool Write() override { return WriteToStream(*mPacket); } + bool Write() override { return WriteToStream(*mPacket); } private: void pack(DataSourceSurface* aImage) { @@ -507,7 +507,7 @@ class DebugGLColorData final : public DebugGLData { mColor(color.ToABGR()), mSize(width, height) {} - virtual bool Write() override { + bool Write() override { Packet packet; packet.set_type(mDataType); @@ -531,7 +531,7 @@ class DebugGLLayersData final : public DebugGLData { explicit DebugGLLayersData(UniquePtr aPacket) : DebugGLData(Packet::LAYERS), mPacket(std::move(aPacket)) {} - virtual bool Write() override { + bool Write() override { mPacket->set_type(mDataType); return WriteToStream(*mPacket); } @@ -548,7 +548,7 @@ class DebugGLMetaData final : public DebugGLData { explicit DebugGLMetaData(Packet::DataType aDataType) : DebugGLData(aDataType), mComposedByHwc(false) {} - virtual bool Write() override { + bool Write() override { Packet packet; packet.set_type(mDataType); @@ -581,7 +581,7 @@ class DebugGLDrawData final : public DebugGLData { } } - virtual bool Write() override { + bool Write() override { Packet packet; packet.set_type(mDataType); @@ -640,7 +640,7 @@ class DebugDataSender { } private: - virtual ~AppendTask() {} + virtual ~AppendTask() = default; DebugGLData* mData; // Keep a strong reference to DebugDataSender to prevent this object @@ -661,7 +661,7 @@ class DebugDataSender { } private: - virtual ~ClearTask() {} + virtual ~ClearTask() = default; RefPtr mHost; }; @@ -691,7 +691,7 @@ class DebugDataSender { } private: - virtual ~SendTask() {} + virtual ~SendTask() = default; RefPtr mHost; }; @@ -707,7 +707,7 @@ class DebugDataSender { void Send() { mThread->Dispatch(new SendTask(this), NS_DISPATCH_NORMAL); } protected: - virtual ~DebugDataSender() {} + virtual ~DebugDataSender() = default; void RemoveData() { MOZ_ASSERT(mThread->SerialEventTarget()->IsOnCurrentThread()); if (mList.isEmpty()) return; diff --git a/gfx/layers/LayerScope.h b/gfx/layers/LayerScope.h index e8ac98584429..89c09d46a2ac 100644 --- a/gfx/layers/LayerScope.h +++ b/gfx/layers/LayerScope.h @@ -52,7 +52,7 @@ class LayerScope { }; // Perform BeginFrame and EndFrame automatically -class LayerScopeAutoFrame { +class LayerScopeAutoFrame final { public: explicit LayerScopeAutoFrame(int64_t aFrameStamp); ~LayerScopeAutoFrame(); diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index 3bf0a177b012..66536c54d76b 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -173,7 +173,7 @@ struct LayerPropertiesBase : public LayerProperties { mUseClipRect(false) { MOZ_COUNT_CTOR(LayerPropertiesBase); } - ~LayerPropertiesBase() override { MOZ_COUNT_DTOR(LayerPropertiesBase); } + virtual ~LayerPropertiesBase() { MOZ_COUNT_DTOR(LayerPropertiesBase); } protected: LayerPropertiesBase(const LayerPropertiesBase& a) = delete; diff --git a/gfx/layers/LayerTreeInvalidation.h b/gfx/layers/LayerTreeInvalidation.h index 8b3205cbbc1b..1c26e2ce9ce1 100644 --- a/gfx/layers/LayerTreeInvalidation.h +++ b/gfx/layers/LayerTreeInvalidation.h @@ -33,13 +33,13 @@ typedef void (*NotifySubDocInvalidationFunc)(ContainerLayer* aLayer, */ struct LayerProperties { protected: - LayerProperties() {} + LayerProperties() = default; LayerProperties(const LayerProperties& a) = delete; LayerProperties& operator=(const LayerProperties& a) = delete; public: - virtual ~LayerProperties() {} + virtual ~LayerProperties() = default; /** * Copies the current layer tree properties into diff --git a/gfx/layers/LayerUserData.h b/gfx/layers/LayerUserData.h index 2b011de203e7..206fefc99813 100644 --- a/gfx/layers/LayerUserData.h +++ b/gfx/layers/LayerUserData.h @@ -19,7 +19,7 @@ namespace layers { */ class LayerUserData { public: - virtual ~LayerUserData() {} + virtual ~LayerUserData() = default; }; } // namespace layers diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index a77a5b687234..790bbbd5e954 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -112,9 +112,9 @@ namespace layerscope { class LayersPacket; } // namespace layerscope -#define MOZ_LAYER_DECL_NAME(n, e) \ - virtual const char* Name() const override { return n; } \ - virtual LayerType GetType() const override { return e; } \ +#define MOZ_LAYER_DECL_NAME(n, e) \ + const char* Name() const override { return n; } \ + LayerType GetType() const override { return e; } \ static LayerType Type() { return e; } // Defined in LayerUserData.h; please include that file instead. @@ -754,7 +754,7 @@ class LayerManager : public FrameRecorder { nsIntRegion mRegionToClear; // Protected destructor, to discourage deletion outside of Release(): - virtual ~LayerManager() {} + virtual ~LayerManager() = default; // Print interesting information about this into aStreamo. Internally // used to implement Dump*() and Log*(). @@ -2059,11 +2059,11 @@ class PaintedLayer : public Layer { mInvalidRegion.SetEmpty(); } - virtual PaintedLayer* AsPaintedLayer() override { return this; } + PaintedLayer* AsPaintedLayer() override { return this; } MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_PAINTED) - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface; gfx::Matrix residual; @@ -2128,11 +2128,10 @@ class PaintedLayer : public Layer { mUsedForReadback(false), mAllowResidualTranslation(false) {} - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void DumpPacket(layerscope::LayersPacket* aPacket, - const void* aParent) override; + void DumpPacket(layerscope::LayersPacket* aPacket, + const void* aParent) override; /** * ComputeEffectiveTransforms snaps the ideal transform to get @@ -2192,7 +2191,7 @@ class PaintedLayer : public Layer { */ class ContainerLayer : public Layer { public: - ~ContainerLayer(); + virtual ~ContainerLayer(); /** * CONSTRUCTION PHASE ONLY @@ -2251,7 +2250,7 @@ class ContainerLayer : public Layer { Mutated(); } - virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override; + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override; enum class SortMode { WITH_GEOMETRY, @@ -2260,14 +2259,12 @@ class ContainerLayer : public Layer { nsTArray SortChildrenBy3DZOrder(SortMode aSortMode); - virtual ContainerLayer* AsContainerLayer() override { return this; } - virtual const ContainerLayer* AsContainerLayer() const override { - return this; - } + ContainerLayer* AsContainerLayer() override { return this; } + const ContainerLayer* AsContainerLayer() const override { return this; } // These getters can be used anytime. - virtual Layer* GetFirstChild() const override { return mFirstChild; } - virtual Layer* GetLastChild() const override { return mLastChild; } + Layer* GetFirstChild() const override { return mFirstChild; } + Layer* GetLastChild() const override { return mLastChild; } float GetPreXScale() const { return mPreXScale; } float GetPreYScale() const { return mPreYScale; } float GetInheritedXScale() const { return mInheritedXScale; } @@ -2282,7 +2279,7 @@ class ContainerLayer : public Layer { * container is backend-specific. ComputeEffectiveTransforms must also set * mUseIntermediateSurface. */ - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override = 0; /** @@ -2427,7 +2424,7 @@ class ContainerLayer : public Layer { */ class ColorLayer : public Layer { public: - virtual ColorLayer* AsColorLayer() override { return this; } + ColorLayer* AsColorLayer() override { return this; } /** * CONSTRUCTION PHASE ONLY @@ -2455,7 +2452,7 @@ class ColorLayer : public Layer { MOZ_LAYER_DECL_NAME("ColorLayer", TYPE_COLOR) - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface; mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr); @@ -2466,11 +2463,10 @@ class ColorLayer : public Layer { ColorLayer(LayerManager* aManager, void* aImplData) : Layer(aManager, aImplData), mColor() {} - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void DumpPacket(layerscope::LayersPacket* aPacket, - const void* aParent) override; + void DumpPacket(layerscope::LayersPacket* aPacket, + const void* aParent) override; gfx::IntRect mBounds; gfx::Color mColor; @@ -2490,7 +2486,7 @@ class CanvasLayer : public Layer { public: void SetBounds(gfx::IntRect aBounds) { mBounds = aBounds; } - virtual CanvasLayer* AsCanvasLayer() override { return this; } + CanvasLayer* AsCanvasLayer() override { return this; } /** * Notify this CanvasLayer that the canvas surface contents have @@ -2540,7 +2536,7 @@ class CanvasLayer : public Layer { MOZ_LAYER_DECL_NAME("CanvasLayer", TYPE_CANVAS) - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { // Snap our local transform first, and snap the inherited transform as well. // This makes our snapping equivalent to what would happen if our content @@ -2558,11 +2554,10 @@ class CanvasLayer : public Layer { CanvasLayer(LayerManager* aManager, void* aImplData); virtual ~CanvasLayer(); - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void DumpPacket(layerscope::LayersPacket* aPacket, - const void* aParent) override; + void DumpPacket(layerscope::LayersPacket* aPacket, + const void* aParent) override; virtual CanvasRenderer* CreateCanvasRendererInternal() = 0; @@ -2596,17 +2591,17 @@ class RefLayer : public ContainerLayer { friend class LayerManager; private: - virtual bool InsertAfter(Layer* aChild, Layer* aAfter) override { + bool InsertAfter(Layer* aChild, Layer* aAfter) override { MOZ_CRASH("GFX: RefLayer"); return false; } - virtual bool RemoveChild(Layer* aChild) override { + bool RemoveChild(Layer* aChild) override { MOZ_CRASH("GFX: RefLayer"); return false; } - virtual bool RepositionChild(Layer* aChild, Layer* aAfter) override { + bool RepositionChild(Layer* aChild, Layer* aAfter) override { MOZ_CRASH("GFX: RefLayer"); return false; } @@ -2677,14 +2672,14 @@ class RefLayer : public ContainerLayer { } // These getters can be used anytime. - virtual RefLayer* AsRefLayer() override { return this; } + RefLayer* AsRefLayer() override { return this; } virtual LayersId GetReferentId() { return mId; } /** * DRAWING PHASE ONLY */ - virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override; + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override; MOZ_LAYER_DECL_NAME("RefLayer", TYPE_REF) @@ -2694,11 +2689,10 @@ class RefLayer : public ContainerLayer { mId{0}, mEventRegionsOverride(EventRegionsOverride::NoOverride) {} - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void DumpPacket(layerscope::LayersPacket* aPacket, - const void* aParent) override; + void DumpPacket(layerscope::LayersPacket* aPacket, + const void* aParent) override; // 0 is a special value that means "no ID". LayersId mId; diff --git a/gfx/layers/LayersTypes.h b/gfx/layers/LayersTypes.h index 50808d2cce18..89455266759c 100644 --- a/gfx/layers/LayersTypes.h +++ b/gfx/layers/LayersTypes.h @@ -365,7 +365,7 @@ typedef Maybe MaybeLayerRect; // This is used to communicate Layers across IPC channels. The Handle is valid // for layers in the same PLayerTransaction. Handles are created by // ClientLayerManager, and are cached in LayerTransactionParent on first use. -class LayerHandle { +class LayerHandle final { friend struct IPC::ParamTraits; public: @@ -387,7 +387,7 @@ class LayerHandle { // valid for layers in the same PLayerTransaction or PImageBridge. Handles are // created by ClientLayerManager or ImageBridgeChild, and are cached in the // parent side on first use. -class CompositableHandle { +class CompositableHandle final { friend struct IPC::ParamTraits; public: diff --git a/gfx/layers/PersistentBufferProvider.h b/gfx/layers/PersistentBufferProvider.h index 4bfcde6e571c..1a0b88f38ba1 100644 --- a/gfx/layers/PersistentBufferProvider.h +++ b/gfx/layers/PersistentBufferProvider.h @@ -38,7 +38,7 @@ class PersistentBufferProvider : public RefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PersistentBufferProvider) - virtual ~PersistentBufferProvider() {} + virtual ~PersistentBufferProvider() = default; virtual LayersBackend GetType() { return LayersBackend::LAYERS_NONE; } @@ -95,29 +95,26 @@ class PersistentBufferProviderBasic : public PersistentBufferProvider { explicit PersistentBufferProviderBasic(gfx::DrawTarget* aTarget); - virtual LayersBackend GetType() override { - return LayersBackend::LAYERS_BASIC; - } + LayersBackend GetType() override { return LayersBackend::LAYERS_BASIC; } - virtual already_AddRefed BorrowDrawTarget( + already_AddRefed BorrowDrawTarget( const gfx::IntRect& aPersistedRect) override; - virtual bool ReturnDrawTarget(already_AddRefed aDT) override; + bool ReturnDrawTarget(already_AddRefed aDT) override; - virtual already_AddRefed BorrowSnapshot() override; + already_AddRefed BorrowSnapshot() override; - virtual void ReturnSnapshot( - already_AddRefed aSnapshot) override; + void ReturnSnapshot(already_AddRefed aSnapshot) override; - virtual bool PreservesDrawingState() const override { return true; } + bool PreservesDrawingState() const override { return true; } - virtual void OnShutdown() override { Destroy(); } + void OnShutdown() override { Destroy(); } protected: void Destroy(); private: - ~PersistentBufferProviderBasic(); + virtual ~PersistentBufferProviderBasic(); RefPtr mDrawTarget; RefPtr mSnapshot; @@ -137,29 +134,28 @@ class PersistentBufferProviderShared : public PersistentBufferProvider, gfx::IntSize aSize, gfx::SurfaceFormat aFormat, KnowsCompositor* aKnowsCompositor); - virtual LayersBackend GetType() override; + LayersBackend GetType() override; - virtual already_AddRefed BorrowDrawTarget( + already_AddRefed BorrowDrawTarget( const gfx::IntRect& aPersistedRect) override; - virtual bool ReturnDrawTarget(already_AddRefed aDT) override; + bool ReturnDrawTarget(already_AddRefed aDT) override; - virtual already_AddRefed BorrowSnapshot() override; + already_AddRefed BorrowSnapshot() override; - virtual void ReturnSnapshot( - already_AddRefed aSnapshot) override; + void ReturnSnapshot(already_AddRefed aSnapshot) override; - virtual TextureClient* GetTextureClient() override; + TextureClient* GetTextureClient() override; - virtual void NotifyInactive() override; + void NotifyInactive() override; - virtual void OnShutdown() override { Destroy(); } + void OnShutdown() override { Destroy(); } - virtual bool SetKnowsCompositor(KnowsCompositor* aKnowsCompositor) override; + bool SetKnowsCompositor(KnowsCompositor* aKnowsCompositor) override; - virtual void ClearCachedResources() override; + void ClearCachedResources() override; - virtual bool PreservesDrawingState() const override { return false; } + bool PreservesDrawingState() const override { return false; } protected: PersistentBufferProviderShared(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, @@ -186,7 +182,7 @@ class PersistentBufferProviderShared : public PersistentBufferProvider, RefPtr mSnapshot; }; -struct AutoReturnSnapshot { +struct AutoReturnSnapshot final { PersistentBufferProvider* mBufferProvider; RefPtr* mSnapshot; diff --git a/gfx/layers/ReadbackLayer.h b/gfx/layers/ReadbackLayer.h index b67f812d2418..a26372eee17e 100644 --- a/gfx/layers/ReadbackLayer.h +++ b/gfx/layers/ReadbackLayer.h @@ -37,7 +37,7 @@ class LayersPacket; class ReadbackSink { public: ReadbackSink() {} - virtual ~ReadbackSink() {} + virtual ~ReadbackSink() = default; /** * Sends an update to indicate that the background is currently unknown. diff --git a/gfx/layers/SourceSurfaceSharedData.h b/gfx/layers/SourceSurfaceSharedData.h index 6ddb9a82a9e1..cf04a27171ec 100644 --- a/gfx/layers/SourceSurfaceSharedData.h +++ b/gfx/layers/SourceSurfaceSharedData.h @@ -279,7 +279,7 @@ class SourceSurfaceSharedData final : public DataSourceSurface { private: friend class SourceSurfaceSharedDataWrapper; - ~SourceSurfaceSharedData() override {} + virtual ~SourceSurfaceSharedData() = default; void LockHandle() { MutexAutoLock lock(mMutex); diff --git a/gfx/layers/SourceSurfaceVolatileData.h b/gfx/layers/SourceSurfaceVolatileData.h index b7d45de2d56f..2363362c93d8 100644 --- a/gfx/layers/SourceSurfaceVolatileData.h +++ b/gfx/layers/SourceSurfaceVolatileData.h @@ -84,7 +84,7 @@ class SourceSurfaceVolatileData : public DataSourceSurface { } private: - ~SourceSurfaceVolatileData() override {} + virtual ~SourceSurfaceVolatileData() = default; Mutex mMutex; int32_t mStride; diff --git a/gfx/layers/SyncObject.h b/gfx/layers/SyncObject.h index 9ed67769e908..deb9170dab0a 100644 --- a/gfx/layers/SyncObject.h +++ b/gfx/layers/SyncObject.h @@ -23,7 +23,7 @@ typedef uintptr_t SyncHandle; class SyncObjectHost : public RefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SyncObjectHost) - virtual ~SyncObjectHost() {} + virtual ~SyncObjectHost() = default; static already_AddRefed CreateSyncObjectHost( #ifdef XP_WIN @@ -45,7 +45,7 @@ class SyncObjectHost : public RefCounted { class SyncObjectClient : public external::AtomicRefCounted { public: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SyncObjectClient) - virtual ~SyncObjectClient() {} + virtual ~SyncObjectClient() = default; static already_AddRefed CreateSyncObjectClient( SyncHandle aHandle diff --git a/gfx/layers/TextureDIB.h b/gfx/layers/TextureDIB.h index 045a8f1ac176..707cd9ae3e57 100644 --- a/gfx/layers/TextureDIB.h +++ b/gfx/layers/TextureDIB.h @@ -18,13 +18,13 @@ namespace layers { class DIBTextureData : public TextureData { public: - virtual bool Lock(OpenMode) override { return true; } + bool Lock(OpenMode) override { return true; } - virtual void Unlock() override {} + void Unlock() override {} - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual already_AddRefed BorrowDrawTarget() override; + already_AddRefed BorrowDrawTarget() override; static DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, LayersIPCChannel* aAllocator); @@ -52,25 +52,22 @@ class TextureHostDirectUpload : public TextureHost { gfx::IntSize aSize) : TextureHost(aFlags), mFormat(aFormat), mSize(aSize), mIsLocked(false) {} - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; } + gfx::SurfaceFormat GetFormat() const override { return mFormat; } - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual bool HasIntermediateBuffer() const { return true; } + bool HasIntermediateBuffer() const { return true; } - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override; - virtual bool AcquireTextureSource( - CompositableTextureSourceRef& aTexture) override; + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; + bool AcquireTextureSource(CompositableTextureSourceRef& aTexture) override; protected: RefPtr mProvider; @@ -84,12 +81,12 @@ class DIBTextureHost : public TextureHostDirectUpload { public: DIBTextureHost(TextureFlags aFlags, const SurfaceDescriptorDIB& aDescriptor); - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; // TODO: cf bug 872568 } protected: - virtual void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; + void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; RefPtr mSurface; }; @@ -100,7 +97,7 @@ class TextureHostFileMapping : public TextureHostDirectUpload { const SurfaceDescriptorFileMapping& aDescriptor); ~TextureHostFileMapping(); - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { MOZ_CRASH("GFX: TextureHostFileMapping::GetAsSurface not implemented"); // Not implemented! It would be tricky to keep track of the // scope of the file mapping. We could do this through UserData @@ -108,7 +105,7 @@ class TextureHostFileMapping : public TextureHostDirectUpload { } protected: - virtual void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; + void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; HANDLE mFileMapping; }; diff --git a/gfx/layers/TextureSourceProvider.h b/gfx/layers/TextureSourceProvider.h index 99c763fa7f8f..4fc66dc34b5c 100644 --- a/gfx/layers/TextureSourceProvider.h +++ b/gfx/layers/TextureSourceProvider.h @@ -105,7 +105,7 @@ class TextureSourceProvider { virtual bool IsValid() const = 0; public: - class MOZ_STACK_CLASS AutoReadUnlockTextures { + class MOZ_STACK_CLASS AutoReadUnlockTextures final { public: explicit AutoReadUnlockTextures(TextureSourceProvider* aProvider) : mProvider(aProvider) {} diff --git a/gfx/layers/TransactionIdAllocator.h b/gfx/layers/TransactionIdAllocator.h index a63655dd0ec0..c9f545470f3e 100644 --- a/gfx/layers/TransactionIdAllocator.h +++ b/gfx/layers/TransactionIdAllocator.h @@ -17,7 +17,7 @@ namespace layers { class TransactionIdAllocator { protected: - virtual ~TransactionIdAllocator() {} + virtual ~TransactionIdAllocator() = default; public: NS_INLINE_DECL_REFCOUNTING(TransactionIdAllocator) diff --git a/gfx/layers/apz/public/APZInputBridge.h b/gfx/layers/apz/public/APZInputBridge.h index df17206becf3..8da3354b721f 100644 --- a/gfx/layers/apz/public/APZInputBridge.h +++ b/gfx/layers/apz/public/APZInputBridge.h @@ -111,7 +111,7 @@ class APZInputBridge { virtual void UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint, EventMessage aEventMessage) = 0; - virtual ~APZInputBridge() {} + virtual ~APZInputBridge() = default; }; } // namespace layers diff --git a/gfx/layers/apz/public/CompositorController.h b/gfx/layers/apz/public/CompositorController.h index 30c510e394c6..25ed2d0053dd 100644 --- a/gfx/layers/apz/public/CompositorController.h +++ b/gfx/layers/apz/public/CompositorController.h @@ -24,7 +24,7 @@ class CompositorController { virtual void ScheduleShowAllPluginWindows() = 0; protected: - virtual ~CompositorController() {} + virtual ~CompositorController() = default; }; } // namespace layers diff --git a/gfx/layers/apz/public/GeckoContentController.h b/gfx/layers/apz/public/GeckoContentController.h index 68ffabebe8d6..c55055f707ac 100644 --- a/gfx/layers/apz/public/GeckoContentController.h +++ b/gfx/layers/apz/public/GeckoContentController.h @@ -209,7 +209,7 @@ class GeckoContentController { protected: // Protected destructor, to discourage deletion outside of Release(): - virtual ~GeckoContentController() {} + virtual ~GeckoContentController() = default; }; } // namespace layers diff --git a/gfx/layers/apz/public/IAPZCTreeManager.h b/gfx/layers/apz/public/IAPZCTreeManager.h index fbadb7535018..e0a55d6af2ac 100644 --- a/gfx/layers/apz/public/IAPZCTreeManager.h +++ b/gfx/layers/apz/public/IAPZCTreeManager.h @@ -135,7 +135,7 @@ class IAPZCTreeManager { protected: // Discourage destruction outside of decref - virtual ~IAPZCTreeManager() {} + virtual ~IAPZCTreeManager() = default; }; } // namespace layers diff --git a/gfx/layers/apz/public/MetricsSharingController.h b/gfx/layers/apz/public/MetricsSharingController.h index c0951fd465fe..869f2e2346e8 100644 --- a/gfx/layers/apz/public/MetricsSharingController.h +++ b/gfx/layers/apz/public/MetricsSharingController.h @@ -28,7 +28,7 @@ class MetricsSharingController { uint32_t aApzcId) = 0; protected: - virtual ~MetricsSharingController() {} + virtual ~MetricsSharingController() = default; }; } // namespace layers diff --git a/gfx/layers/apz/src/APZUtils.h b/gfx/layers/apz/src/APZUtils.h index 34557033fdd8..037bee030b90 100644 --- a/gfx/layers/apz/src/APZUtils.h +++ b/gfx/layers/apz/src/APZUtils.h @@ -106,7 +106,7 @@ inline AsyncTransformMatrix CompleteAsyncTransform( aMatrix, PixelCastJustification::MultipleAsyncTransforms); } -struct TargetConfirmationFlags { +struct TargetConfirmationFlags final { explicit TargetConfirmationFlags(bool aTargetConfirmed) : mTargetConfirmed(aTargetConfirmed), mRequiresTargetConfirmation(false) {} diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index b90de1aacd99..a3935cbb5eab 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -548,7 +548,7 @@ TimeStamp AsyncPanZoomController::GetFrameTime() const { return treeManagerLocal ? treeManagerLocal->GetFrameTime() : TimeStamp::Now(); } -class MOZ_STACK_CLASS StateChangeNotificationBlocker { +class MOZ_STACK_CLASS StateChangeNotificationBlocker final { public: explicit StateChangeNotificationBlocker(AsyncPanZoomController* aApzc) : mApzc(aApzc) { @@ -581,7 +581,7 @@ class MOZ_STACK_CLASS StateChangeNotificationBlocker { * the async layout viewport offset, since modifying the async scroll offset * may result in the layout viewport moving as well). */ -class MOZ_RAII AutoApplyAsyncTestAttributes { +class MOZ_RAII AutoApplyAsyncTestAttributes final { public: explicit AutoApplyAsyncTestAttributes(const AsyncPanZoomController*); ~AutoApplyAsyncTestAttributes(); diff --git a/gfx/layers/apz/src/AutoDirWheelDeltaAdjuster.h b/gfx/layers/apz/src/AutoDirWheelDeltaAdjuster.h index 791773a5c193..187641514a93 100644 --- a/gfx/layers/apz/src/AutoDirWheelDeltaAdjuster.h +++ b/gfx/layers/apz/src/AutoDirWheelDeltaAdjuster.h @@ -47,10 +47,9 @@ class MOZ_STACK_CLASS APZAutoDirWheelDeltaAdjuster final * IsHorizontalContentRightToLeft() in * the base class AutoDirWheelDeltaAdjuster. */ - explicit APZAutoDirWheelDeltaAdjuster(double& aDeltaX, double& aDeltaY, - const AxisX& aAxisX, - const AxisY& aAxisY, - bool aIsHorizontalContentRightToLeft) + APZAutoDirWheelDeltaAdjuster(double& aDeltaX, double& aDeltaY, + const AxisX& aAxisX, const AxisY& aAxisY, + bool aIsHorizontalContentRightToLeft) : AutoDirWheelDeltaAdjuster(aDeltaX, aDeltaY), mAxisX(aAxisX), mAxisY(aAxisY), diff --git a/gfx/layers/apz/src/Axis.h b/gfx/layers/apz/src/Axis.h index afd33ae6eaaf..1ee690967419 100644 --- a/gfx/layers/apz/src/Axis.h +++ b/gfx/layers/apz/src/Axis.h @@ -344,39 +344,35 @@ class Axis { class AxisX : public Axis { public: explicit AxisX(AsyncPanZoomController* mAsyncPanZoomController); - virtual ParentLayerCoord GetPointOffset( + ParentLayerCoord GetPointOffset( const ParentLayerPoint& aPoint) const override; - virtual ParentLayerCoord GetRectLength( - const ParentLayerRect& aRect) const override; - virtual ParentLayerCoord GetRectOffset( - const ParentLayerRect& aRect) const override; - virtual CSSToParentLayerScale GetScaleForAxis( + ParentLayerCoord GetRectLength(const ParentLayerRect& aRect) const override; + ParentLayerCoord GetRectOffset(const ParentLayerRect& aRect) const override; + CSSToParentLayerScale GetScaleForAxis( const CSSToParentLayerScale2D& aScale) const override; - virtual ScreenPoint MakePoint(ScreenCoord aCoord) const override; - virtual const char* Name() const override; + ScreenPoint MakePoint(ScreenCoord aCoord) const override; + const char* Name() const override; bool CanScrollTo(Side aSide) const; private: - virtual OverscrollBehavior GetOverscrollBehavior() const override; + OverscrollBehavior GetOverscrollBehavior() const override; }; class AxisY : public Axis { public: explicit AxisY(AsyncPanZoomController* mAsyncPanZoomController); - virtual ParentLayerCoord GetPointOffset( + ParentLayerCoord GetPointOffset( const ParentLayerPoint& aPoint) const override; - virtual ParentLayerCoord GetRectLength( - const ParentLayerRect& aRect) const override; - virtual ParentLayerCoord GetRectOffset( - const ParentLayerRect& aRect) const override; - virtual CSSToParentLayerScale GetScaleForAxis( + ParentLayerCoord GetRectLength(const ParentLayerRect& aRect) const override; + ParentLayerCoord GetRectOffset(const ParentLayerRect& aRect) const override; + CSSToParentLayerScale GetScaleForAxis( const CSSToParentLayerScale2D& aScale) const override; - virtual ScreenPoint MakePoint(ScreenCoord aCoord) const override; - virtual const char* Name() const override; + ScreenPoint MakePoint(ScreenCoord aCoord) const override; + const char* Name() const override; bool CanScrollTo(Side aSide) const; private: - virtual OverscrollBehavior GetOverscrollBehavior() const override; + OverscrollBehavior GetOverscrollBehavior() const override; }; } // namespace layers diff --git a/gfx/layers/apz/src/CheckerboardEvent.h b/gfx/layers/apz/src/CheckerboardEvent.h index b5660bcf501e..ac7775026413 100644 --- a/gfx/layers/apz/src/CheckerboardEvent.h +++ b/gfx/layers/apz/src/CheckerboardEvent.h @@ -25,7 +25,7 @@ namespace layers { * information about the severity of the checkerboarding so as to allow * prioritizing the debugging of some checkerboarding events over others. */ -class CheckerboardEvent { +class CheckerboardEvent final { public: // clang-format off MOZ_DEFINE_ENUM_AT_CLASS_SCOPE( diff --git a/gfx/layers/apz/src/HitTestingTreeNode.h b/gfx/layers/apz/src/HitTestingTreeNode.h index a25f0a51f27d..e3d21fe1087b 100644 --- a/gfx/layers/apz/src/HitTestingTreeNode.h +++ b/gfx/layers/apz/src/HitTestingTreeNode.h @@ -221,7 +221,7 @@ class HitTestingTreeNode { * Clear() being called, it unlocks the underlying node at which point it can * be recycled or freed. */ -class MOZ_RAII HitTestingTreeNodeAutoLock { +class MOZ_RAII HitTestingTreeNodeAutoLock final { public: HitTestingTreeNodeAutoLock(); HitTestingTreeNodeAutoLock(const HitTestingTreeNodeAutoLock&) = delete; diff --git a/gfx/layers/apz/src/InputBlockState.h b/gfx/layers/apz/src/InputBlockState.h index 53272390d088..44847956e72b 100644 --- a/gfx/layers/apz/src/InputBlockState.h +++ b/gfx/layers/apz/src/InputBlockState.h @@ -49,8 +49,8 @@ class InputBlockState : public RefCounted { eConfirmed }; - explicit InputBlockState(const RefPtr& aTargetApzc, - TargetConfirmationFlags aFlags); + InputBlockState(const RefPtr& aTargetApzc, + TargetConfirmationFlags aFlags); virtual ~InputBlockState() = default; virtual CancelableBlockState* AsCancelableBlock() { return nullptr; } diff --git a/gfx/layers/apz/src/InputQueue.h b/gfx/layers/apz/src/InputQueue.h index 3e252f116b31..793237e65ef8 100644 --- a/gfx/layers/apz/src/InputQueue.h +++ b/gfx/layers/apz/src/InputQueue.h @@ -144,7 +144,7 @@ class InputQueue { // RAII class for automatically running a timeout task that may // need to be run immediately after an event has been queued. - class AutoRunImmediateTimeout { + class AutoRunImmediateTimeout final { public: explicit AutoRunImmediateTimeout(InputQueue* aQueue); ~AutoRunImmediateTimeout(); diff --git a/gfx/layers/apz/src/Overscroll.h b/gfx/layers/apz/src/Overscroll.h index 4f47512593e8..4a0460b680e5 100644 --- a/gfx/layers/apz/src/Overscroll.h +++ b/gfx/layers/apz/src/Overscroll.h @@ -18,13 +18,13 @@ namespace layers { // Animation used by GenericOverscrollEffect. class OverscrollAnimation : public AsyncPanZoomAnimation { public: - explicit OverscrollAnimation(AsyncPanZoomController& aApzc, - const ParentLayerPoint& aVelocity) + OverscrollAnimation(AsyncPanZoomController& aApzc, + const ParentLayerPoint& aVelocity) : mApzc(aApzc) { mApzc.mX.StartOverscrollAnimation(aVelocity.x); mApzc.mY.StartOverscrollAnimation(aVelocity.y); } - ~OverscrollAnimation() { + virtual ~OverscrollAnimation() { mApzc.mX.EndOverscrollAnimation(); mApzc.mY.EndOverscrollAnimation(); } diff --git a/gfx/layers/apz/util/APZEventState.h b/gfx/layers/apz/util/APZEventState.h index c7e7f437eb44..1d83438486b7 100644 --- a/gfx/layers/apz/util/APZEventState.h +++ b/gfx/layers/apz/util/APZEventState.h @@ -41,7 +41,7 @@ typedef std::function class GenericNamedTimerCallback final : public GenericNamedTimerCallbackBase { public: - explicit GenericNamedTimerCallback(const Function& aFunction, - const char* aName) + GenericNamedTimerCallback(const Function& aFunction, const char* aName) : mFunction(aFunction), mName(aName) {} NS_IMETHOD Notify(nsITimer*) override { diff --git a/gfx/layers/apz/util/ActiveElementManager.h b/gfx/layers/apz/util/ActiveElementManager.h index 9455fe49ffd6..b78365996229 100644 --- a/gfx/layers/apz/util/ActiveElementManager.h +++ b/gfx/layers/apz/util/ActiveElementManager.h @@ -25,7 +25,7 @@ namespace layers { * Manages setting and clearing the ':active' CSS pseudostate in the presence * of touch input. */ -class ActiveElementManager { +class ActiveElementManager final { ~ActiveElementManager(); public: diff --git a/gfx/layers/apz/util/CheckerboardReportService.h b/gfx/layers/apz/util/CheckerboardReportService.h index 92fb9a18bdcd..c7e4cc2e0acb 100644 --- a/gfx/layers/apz/util/CheckerboardReportService.h +++ b/gfx/layers/apz/util/CheckerboardReportService.h @@ -51,7 +51,7 @@ class CheckerboardEventStorage { private: /* Stuff for refcounted singleton */ CheckerboardEventStorage() {} - virtual ~CheckerboardEventStorage() {} + virtual ~CheckerboardEventStorage() = default; static StaticRefPtr sInstance; @@ -127,7 +127,7 @@ class CheckerboardReportService : public nsWrapperCache { void FlushActiveReports(); private: - virtual ~CheckerboardReportService() {} + virtual ~CheckerboardReportService() = default; nsCOMPtr mParent; }; diff --git a/gfx/layers/apz/util/ChromeProcessController.h b/gfx/layers/apz/util/ChromeProcessController.h index 28af0430a200..0236f0856a5f 100644 --- a/gfx/layers/apz/util/ChromeProcessController.h +++ b/gfx/layers/apz/util/ChromeProcessController.h @@ -46,41 +46,37 @@ class ChromeProcessController : public mozilla::layers::GeckoContentController { explicit ChromeProcessController(nsIWidget* aWidget, APZEventState* aAPZEventState, IAPZCTreeManager* aAPZCTreeManager); - ~ChromeProcessController(); - virtual void Destroy() override; + virtual ~ChromeProcessController(); + void Destroy() override; // GeckoContentController interface - virtual void NotifyLayerTransforms( + void NotifyLayerTransforms( const nsTArray& aTransforms) override; - virtual void RequestContentRepaint(const RepaintRequest& aRequest) override; - virtual void PostDelayedTask(already_AddRefed aTask, - int aDelayMs) override; - virtual bool IsRepaintThread() override; - virtual void DispatchToRepaintThread( - already_AddRefed aTask) override; + void RequestContentRepaint(const RepaintRequest& aRequest) override; + void PostDelayedTask(already_AddRefed aTask, int aDelayMs) override; + bool IsRepaintThread() override; + void DispatchToRepaintThread(already_AddRefed aTask) override; MOZ_CAN_RUN_SCRIPT - virtual void HandleTap(TapType aType, - const mozilla::LayoutDevicePoint& aPoint, - Modifiers aModifiers, const ScrollableLayerGuid& aGuid, - uint64_t aInputBlockId) override; - virtual void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType, - const ScrollableLayerGuid& aGuid, - LayoutDeviceCoord aSpanChange, - Modifiers aModifiers) override; - virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, - APZStateChange aChange, int aArg) override; - virtual void NotifyMozMouseScrollEvent( - const ScrollableLayerGuid::ViewID& aScrollId, - const nsString& aEvent) override; - virtual void NotifyFlushComplete() override; - virtual void NotifyAsyncScrollbarDragInitiated( + void HandleTap(TapType aType, const mozilla::LayoutDevicePoint& aPoint, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid, + uint64_t aInputBlockId) override; + void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType, + const ScrollableLayerGuid& aGuid, + LayoutDeviceCoord aSpanChange, + Modifiers aModifiers) override; + void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, + APZStateChange aChange, int aArg) override; + void NotifyMozMouseScrollEvent(const ScrollableLayerGuid::ViewID& aScrollId, + const nsString& aEvent) override; + void NotifyFlushComplete() override; + void NotifyAsyncScrollbarDragInitiated( uint64_t aDragBlockId, const ScrollableLayerGuid::ViewID& aScrollId, ScrollDirection aDirection) override; - virtual void NotifyAsyncScrollbarDragRejected( + void NotifyAsyncScrollbarDragRejected( const ScrollableLayerGuid::ViewID& aScrollId) override; - virtual void NotifyAsyncAutoscrollRejected( + void NotifyAsyncAutoscrollRejected( const ScrollableLayerGuid::ViewID& aScrollId) override; - virtual void CancelAutoscroll(const ScrollableLayerGuid& aGuid) override; + void CancelAutoscroll(const ScrollableLayerGuid& aGuid) override; private: nsCOMPtr mWidget; diff --git a/gfx/layers/apz/util/ScrollLinkedEffectDetector.h b/gfx/layers/apz/util/ScrollLinkedEffectDetector.h index ed0c31f9f2c7..d059d1b101fc 100644 --- a/gfx/layers/apz/util/ScrollLinkedEffectDetector.h +++ b/gfx/layers/apz/util/ScrollLinkedEffectDetector.h @@ -20,7 +20,7 @@ namespace layers { // or work improperly with APZ enabled. This class helps us detect such an // effect so that we can warn the author and/or take other preventative // measures. -class MOZ_STACK_CLASS ScrollLinkedEffectDetector { +class MOZ_STACK_CLASS ScrollLinkedEffectDetector final { private: static uint32_t sDepth; static bool sFoundScrollLinkedEffect; diff --git a/gfx/layers/basic/BasicCanvasLayer.h b/gfx/layers/basic/BasicCanvasLayer.h index 38d900e5359e..5f3dae79c9c4 100644 --- a/gfx/layers/basic/BasicCanvasLayer.h +++ b/gfx/layers/basic/BasicCanvasLayer.h @@ -21,14 +21,14 @@ class BasicCanvasLayer : public CanvasLayer, public BasicImplData { explicit BasicCanvasLayer(BasicLayerManager* aLayerManager) : CanvasLayer(aLayerManager, static_cast(this)) {} - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); CanvasLayer::SetVisibleRegion(aRegion); } - virtual void Paint(gfx::DrawTarget* aDT, const gfx::Point& aDeviceOffset, - Layer* aMaskLayer) override; + void Paint(gfx::DrawTarget* aDT, const gfx::Point& aDeviceOffset, + Layer* aMaskLayer) override; protected: BasicLayerManager* BasicManager() { diff --git a/gfx/layers/basic/BasicColorLayer.cpp b/gfx/layers/basic/BasicColorLayer.cpp index 2378a0e69249..f998789d2f06 100644 --- a/gfx/layers/basic/BasicColorLayer.cpp +++ b/gfx/layers/basic/BasicColorLayer.cpp @@ -35,14 +35,14 @@ class BasicColorLayer : public ColorLayer, public BasicImplData { virtual ~BasicColorLayer() { MOZ_COUNT_DTOR(BasicColorLayer); } public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); ColorLayer::SetVisibleRegion(aRegion); } - virtual void Paint(DrawTarget* aDT, const gfx::Point& aDeviceOffset, - Layer* aMaskLayer) override { + void Paint(DrawTarget* aDT, const gfx::Point& aDeviceOffset, + Layer* aMaskLayer) override { if (IsHidden()) { return; } diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 91e160211ed9..61517b8b421f 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -34,20 +34,20 @@ namespace layers { class DataTextureSourceBasic : public DataTextureSource, public TextureSourceBasic { public: - virtual const char* Name() const override { return "DataTextureSourceBasic"; } + const char* Name() const override { return "DataTextureSourceBasic"; } explicit DataTextureSourceBasic(DataSourceSurface* aSurface) : mSurface(aSurface), mWrappingExistingData(!!aSurface) {} - virtual DataTextureSource* AsDataTextureSource() override { + DataTextureSource* AsDataTextureSource() override { // If the texture wraps someone else's memory we'd rather not use it as // a DataTextureSource per say (that is call Update on it). return mWrappingExistingData ? nullptr : this; } - virtual TextureSourceBasic* AsSourceBasic() override { return this; } + TextureSourceBasic* AsSourceBasic() override { return this; } - virtual gfx::SourceSurface* GetSurface(DrawTarget* aTarget) override { + gfx::SourceSurface* GetSurface(DrawTarget* aTarget) override { return mSurface; } @@ -55,13 +55,13 @@ class DataTextureSourceBasic : public DataTextureSource, return mSurface ? mSurface->GetFormat() : gfx::SurfaceFormat::UNKNOWN; } - virtual IntSize GetSize() const override { + IntSize GetSize() const override { return mSurface ? mSurface->GetSize() : gfx::IntSize(0, 0); } - virtual bool Update(gfx::DataSourceSurface* aSurface, - nsIntRegion* aDestRegion = nullptr, - gfx::IntPoint* aSrcOffset = nullptr) override { + bool Update(gfx::DataSourceSurface* aSurface, + nsIntRegion* aDestRegion = nullptr, + gfx::IntPoint* aSrcOffset = nullptr) override { MOZ_ASSERT(!mWrappingExistingData); if (mWrappingExistingData) { return false; @@ -70,7 +70,7 @@ class DataTextureSourceBasic : public DataTextureSource, return true; } - virtual void DeallocateDeviceData() override { + void DeallocateDeviceData() override { mSurface = nullptr; SetUpdateSerial(0); } @@ -87,7 +87,7 @@ class DataTextureSourceBasic : public DataTextureSource, class WrappingTextureSourceYCbCrBasic : public DataTextureSource, public TextureSourceBasic { public: - virtual const char* Name() const override { + const char* Name() const override { return "WrappingTextureSourceYCbCrBasic"; } @@ -96,16 +96,16 @@ class WrappingTextureSourceYCbCrBasic : public DataTextureSource, mFromYCBCR = true; } - virtual DataTextureSource* AsDataTextureSource() override { return this; } + DataTextureSource* AsDataTextureSource() override { return this; } - virtual TextureSourceBasic* AsSourceBasic() override { return this; } + TextureSourceBasic* AsSourceBasic() override { return this; } - virtual WrappingTextureSourceYCbCrBasic* AsWrappingTextureSourceYCbCrBasic() + WrappingTextureSourceYCbCrBasic* AsWrappingTextureSourceYCbCrBasic() override { return this; } - virtual gfx::SourceSurface* GetSurface(DrawTarget* aTarget) override { + gfx::SourceSurface* GetSurface(DrawTarget* aTarget) override { if (mSurface && !mNeedsUpdate) { return mSurface; } @@ -136,7 +136,7 @@ class WrappingTextureSourceYCbCrBasic : public DataTextureSource, return gfx::SurfaceFormat::B8G8R8X8; } - virtual IntSize GetSize() const override { return mSize; } + IntSize GetSize() const override { return mSize; } virtual bool Update(gfx::DataSourceSurface* aSurface, nsIntRegion* aDestRegion = nullptr, @@ -144,13 +144,13 @@ class WrappingTextureSourceYCbCrBasic : public DataTextureSource, return false; } - virtual void DeallocateDeviceData() override { + void DeallocateDeviceData() override { mTexture = nullptr; mSurface = nullptr; SetUpdateSerial(0); } - virtual void Unbind() override { mNeedsUpdate = true; } + void Unbind() override { mNeedsUpdate = true; } void SetBufferTextureHost(BufferTextureHost* aTexture) override { mTexture = aTexture; diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h index f63657ad58c7..14badadb8b8b 100644 --- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -24,15 +24,13 @@ class BasicCompositingRenderTarget : public CompositingRenderTarget { mDrawTarget(aDrawTarget), mSize(aRect.Size()) {} - virtual const char* Name() const override { - return "BasicCompositingRenderTarget"; - } + const char* Name() const override { return "BasicCompositingRenderTarget"; } - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } void BindRenderTarget(); - virtual gfx::SurfaceFormat GetFormat() const override { + gfx::SurfaceFormat GetFormat() const override { return mDrawTarget ? mDrawTarget->GetFormat() : gfx::SurfaceFormat(gfx::SurfaceFormat::UNKNOWN); } @@ -43,112 +41,109 @@ class BasicCompositingRenderTarget : public CompositingRenderTarget { class BasicCompositor : public Compositor { public: - explicit BasicCompositor(CompositorBridgeParent* aParent, - widget::CompositorWidget* aWidget); + BasicCompositor(CompositorBridgeParent* aParent, + widget::CompositorWidget* aWidget); protected: virtual ~BasicCompositor(); public: - virtual BasicCompositor* AsBasicCompositor() override { return this; } + BasicCompositor* AsBasicCompositor() override { return this; } - virtual bool Initialize(nsCString* const out_failureReason) override; + bool Initialize(nsCString* const out_failureReason) override; - virtual void DetachWidget() override; + void DetachWidget() override; - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override; + TextureFactoryIdentifier GetTextureFactoryIdentifier() override; - virtual already_AddRefed CreateRenderTarget( + already_AddRefed CreateRenderTarget( const gfx::IntRect& aRect, SurfaceInitMode aInit) override; - virtual already_AddRefed - CreateRenderTargetFromSource(const gfx::IntRect& aRect, - const CompositingRenderTarget* aSource, - const gfx::IntPoint& aSourcePoint) override; + already_AddRefed CreateRenderTargetFromSource( + const gfx::IntRect& aRect, const CompositingRenderTarget* aSource, + const gfx::IntPoint& aSourcePoint) override; virtual already_AddRefed CreateRenderTargetForWindow( const LayoutDeviceIntRect& aRect, const LayoutDeviceIntRect& aClearRect, BufferMode aBufferMode); - virtual already_AddRefed CreateDataTextureSource( + already_AddRefed CreateDataTextureSource( TextureFlags aFlags = TextureFlags::NO_FLAGS) override; - virtual already_AddRefed CreateDataTextureSourceAround( + already_AddRefed CreateDataTextureSourceAround( gfx::DataSourceSurface* aSurface) override; - virtual already_AddRefed - CreateDataTextureSourceAroundYCbCr(TextureHost* aTexture) override; + already_AddRefed CreateDataTextureSourceAroundYCbCr( + TextureHost* aTexture) override; - virtual bool SupportsEffect(EffectTypes aEffect) override; + bool SupportsEffect(EffectTypes aEffect) override; bool SupportsLayerGeometry() const override; - virtual bool ReadbackRenderTarget(CompositingRenderTarget* aSource, - AsyncReadbackBuffer* aDest) override; + bool ReadbackRenderTarget(CompositingRenderTarget* aSource, + AsyncReadbackBuffer* aDest) override; - virtual already_AddRefed CreateAsyncReadbackBuffer( + already_AddRefed CreateAsyncReadbackBuffer( const gfx::IntSize& aSize) override; - virtual bool BlitRenderTarget(CompositingRenderTarget* aSource, - const gfx::IntSize& aSourceSize, - const gfx::IntSize& aDestSize) override; + bool BlitRenderTarget(CompositingRenderTarget* aSource, + const gfx::IntSize& aSourceSize, + const gfx::IntSize& aDestSize) override; - virtual void SetRenderTarget(CompositingRenderTarget* aSource) override { + void SetRenderTarget(CompositingRenderTarget* aSource) override { mRenderTarget = static_cast(aSource); mRenderTarget->BindRenderTarget(); } - virtual already_AddRefed GetWindowRenderTarget() + already_AddRefed GetWindowRenderTarget() const override { return do_AddRef(mFullWindowRenderTarget); } - virtual already_AddRefed GetCurrentRenderTarget() + already_AddRefed GetCurrentRenderTarget() const override { return do_AddRef(mRenderTarget); } - virtual void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect, - const EffectChain& aEffectChain, gfx::Float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::Rect& aVisibleRect) override; + void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect, + const EffectChain& aEffectChain, gfx::Float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::Rect& aVisibleRect) override; - virtual void ClearRect(const gfx::Rect& aRect) override; + void ClearRect(const gfx::Rect& aRect) override; - virtual void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, - const gfx::IntRect& aRenderBounds, - const nsIntRegion& aOpaqueRegion, - gfx::IntRect* aClipRectOut = nullptr, - gfx::IntRect* aRenderBoundsOut = nullptr) override; - virtual void EndFrame() override; + void BeginFrame(const nsIntRegion& aInvalidRegion, + const gfx::IntRect* aClipRectIn, + const gfx::IntRect& aRenderBounds, + const nsIntRegion& aOpaqueRegion, + gfx::IntRect* aClipRectOut = nullptr, + gfx::IntRect* aRenderBoundsOut = nullptr) override; + void EndFrame() override; - virtual bool SupportsPartialTextureUpdate() override { return true; } - virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override { + bool SupportsPartialTextureUpdate() override { return true; } + bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override { return true; } - virtual int32_t GetMaxTextureSize() const override; - virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override {} + int32_t GetMaxTextureSize() const override; + void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override {} - virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) override {} + void SetScreenRenderOffset(const ScreenPoint& aOffset) override {} - virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) override {} + void MakeCurrent(MakeCurrentFlags aFlags = 0) override {} #ifdef MOZ_DUMP_PAINTING - virtual const char* Name() const override { return "Basic"; } + const char* Name() const override { return "Basic"; } #endif // MOZ_DUMP_PAINTING - virtual LayersBackend GetBackendType() const override { + LayersBackend GetBackendType() const override { return LayersBackend::LAYERS_BASIC; } gfx::DrawTarget* GetDrawTarget() { return mDrawTarget; } - virtual bool IsPendingComposite() override { - return mIsPendingEndRemoteDrawing; - } + bool IsPendingComposite() override { return mIsPendingEndRemoteDrawing; } - virtual void FinishPendingComposite() override; + void FinishPendingComposite() override; private: template @@ -158,11 +153,11 @@ class BasicCompositor : public Compositor { const gfx::Matrix4x4& aTransform, const gfx::Rect& aVisibleRect, const bool aEnableAA); - virtual void DrawPolygon(const gfx::Polygon& aPolygon, const gfx::Rect& aRect, - const gfx::IntRect& aClipRect, - const EffectChain& aEffectChain, gfx::Float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::Rect& aVisibleRect) override; + void DrawPolygon(const gfx::Polygon& aPolygon, const gfx::Rect& aRect, + const gfx::IntRect& aClipRect, + const EffectChain& aEffectChain, gfx::Float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::Rect& aVisibleRect) override; void TryToEndRemoteDrawing(bool aForceToEnd = false); diff --git a/gfx/layers/basic/BasicContainerLayer.h b/gfx/layers/basic/BasicContainerLayer.h index 72c44cc5a92b..07a3183a5428 100644 --- a/gfx/layers/basic/BasicContainerLayer.h +++ b/gfx/layers/basic/BasicContainerLayer.h @@ -30,12 +30,12 @@ class BasicContainerLayer : public ContainerLayer, public BasicImplData { virtual ~BasicContainerLayer(); public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); ContainerLayer::SetVisibleRegion(aRegion); } - virtual bool InsertAfter(Layer* aChild, Layer* aAfter) override { + bool InsertAfter(Layer* aChild, Layer* aAfter) override { if (!BasicManager()->InConstruction()) { NS_ERROR("Can only set properties in construction phase"); return false; @@ -43,7 +43,7 @@ class BasicContainerLayer : public ContainerLayer, public BasicImplData { return ContainerLayer::InsertAfter(aChild, aAfter); } - virtual bool RemoveChild(Layer* aChild) override { + bool RemoveChild(Layer* aChild) override { if (!BasicManager()->InConstruction()) { NS_ERROR("Can only set properties in construction phase"); return false; @@ -51,7 +51,7 @@ class BasicContainerLayer : public ContainerLayer, public BasicImplData { return ContainerLayer::RemoveChild(aChild); } - virtual bool RepositionChild(Layer* aChild, Layer* aAfter) override { + bool RepositionChild(Layer* aChild, Layer* aAfter) override { if (!BasicManager()->InConstruction()) { NS_ERROR("Can only set properties in construction phase"); return false; @@ -59,7 +59,7 @@ class BasicContainerLayer : public ContainerLayer, public BasicImplData { return ContainerLayer::RepositionChild(aChild, aAfter); } - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override; /** @@ -82,15 +82,14 @@ class BasicContainerLayer : public ContainerLayer, public BasicImplData { mSupportsComponentAlphaChildren = aSupports; } - virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback, - void* aCallbackData, - ReadbackProcessor* aReadback) override; + void Validate(LayerManager::DrawPaintedLayerCallback aCallback, + void* aCallbackData, ReadbackProcessor* aReadback) override; /** * We don't really have a hard restriction for max layer size, but we pick * 4096 to avoid excessive memory usage. */ - virtual int32_t GetMaxLayerSize() override { return 4096; } + int32_t GetMaxLayerSize() override { return 4096; } protected: BasicLayerManager* BasicManager() { diff --git a/gfx/layers/basic/BasicImageLayer.cpp b/gfx/layers/basic/BasicImageLayer.cpp index 67ea85c0070a..736663fd1e76 100644 --- a/gfx/layers/basic/BasicImageLayer.cpp +++ b/gfx/layers/basic/BasicImageLayer.cpp @@ -32,7 +32,7 @@ class BasicImageLayer : public ImageLayer, public BasicImplData { } protected: - ~BasicImageLayer() override { MOZ_COUNT_DTOR(BasicImageLayer); } + virtual ~BasicImageLayer() { MOZ_COUNT_DTOR(BasicImageLayer); } public: void SetVisibleRegion(const LayerIntRegion& aRegion) override { diff --git a/gfx/layers/basic/BasicLayersImpl.h b/gfx/layers/basic/BasicLayersImpl.h index 24b5e77935cd..610c1c4e4894 100644 --- a/gfx/layers/basic/BasicLayersImpl.h +++ b/gfx/layers/basic/BasicLayersImpl.h @@ -58,7 +58,7 @@ class BasicReadbackLayer : public ReadbackLayer, public BasicImplData { virtual ~BasicReadbackLayer() { MOZ_COUNT_DTOR(BasicReadbackLayer); } public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); ReadbackLayer::SetVisibleRegion(aRegion); diff --git a/gfx/layers/basic/BasicPaintedLayer.h b/gfx/layers/basic/BasicPaintedLayer.h index 476ad5e0448a..9b293a97ec44 100644 --- a/gfx/layers/basic/BasicPaintedLayer.h +++ b/gfx/layers/basic/BasicPaintedLayer.h @@ -31,8 +31,7 @@ class BasicPaintedLayer : public PaintedLayer, public BasicImplData { typedef ContentClient::PaintState PaintState; typedef ContentClient::ContentType ContentType; - explicit BasicPaintedLayer(BasicLayerManager* aLayerManager, - gfx::BackendType aBackend) + BasicPaintedLayer(BasicLayerManager* aLayerManager, gfx::BackendType aBackend) : PaintedLayer(aLayerManager, static_cast(this)), mContentClient(nullptr), mBackend(aBackend) { @@ -43,34 +42,33 @@ class BasicPaintedLayer : public PaintedLayer, public BasicImplData { virtual ~BasicPaintedLayer() { MOZ_COUNT_DTOR(BasicPaintedLayer); } public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); PaintedLayer::SetVisibleRegion(aRegion); } - virtual void InvalidateRegion(const nsIntRegion& aRegion) override { + void InvalidateRegion(const nsIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); mInvalidRegion.Add(aRegion); UpdateValidRegionAfterInvalidRegionChanged(); } - virtual void PaintThebes(gfxContext* aContext, Layer* aMaskLayer, - LayerManager::DrawPaintedLayerCallback aCallback, - void* aCallbackData) override; + void PaintThebes(gfxContext* aContext, Layer* aMaskLayer, + LayerManager::DrawPaintedLayerCallback aCallback, + void* aCallbackData) override; - virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback, - void* aCallbackData, - ReadbackProcessor* aReadback) override; + void Validate(LayerManager::DrawPaintedLayerCallback aCallback, + void* aCallbackData, ReadbackProcessor* aReadback) override; - virtual void ClearCachedResources() override { + void ClearCachedResources() override { if (mContentClient) { mContentClient->Clear(); } ClearValidRegion(); } - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { if (!BasicManager()->IsRetained()) { // Don't do any snapping of our transform, since we're just going to diff --git a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h index d58d0effa0db..5d4730f7ba08 100644 --- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h +++ b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h @@ -29,17 +29,15 @@ class MacIOSurfaceTextureSourceBasic : public TextureSourceBasic, explicit MacIOSurfaceTextureSourceBasic(MacIOSurface* aSurface); virtual ~MacIOSurfaceTextureSourceBasic(); - virtual const char* Name() const override { - return "MacIOSurfaceTextureSourceBasic"; - } + const char* Name() const override { return "MacIOSurfaceTextureSourceBasic"; } - virtual TextureSourceBasic* AsSourceBasic() override { return this; } + TextureSourceBasic* AsSourceBasic() override { return this; } - virtual gfx::IntSize GetSize() const override; - virtual gfx::SurfaceFormat GetFormat() const override; - virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override; + gfx::IntSize GetSize() const override; + gfx::SurfaceFormat GetFormat() const override; + gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override; - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} protected: RefPtr mSurface; @@ -59,9 +57,9 @@ class MacIOSurfaceTextureHostBasic : public TextureHost { virtual void SetTextureSourceProvider( TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; virtual bool BindTextureSource( CompositableTextureSourceRef& aTexture) override { @@ -69,15 +67,15 @@ class MacIOSurfaceTextureHostBasic : public TextureHost { return !!aTexture; } - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) } - virtual gfx::IntSize GetSize() const override; - virtual MacIOSurface* GetMacIOSurface() override { return mSurface; } + gfx::IntSize GetSize() const override; + MacIOSurface* GetMacIOSurface() override { return mSurface; } #ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "MacIOSurfaceTextureHostBasic"; } + const char* Name() override { return "MacIOSurfaceTextureHostBasic"; } #endif protected: diff --git a/gfx/layers/basic/TextureHostBasic.h b/gfx/layers/basic/TextureHostBasic.h index 97b18e72d1ee..f48bc89c9779 100644 --- a/gfx/layers/basic/TextureHostBasic.h +++ b/gfx/layers/basic/TextureHostBasic.h @@ -25,7 +25,7 @@ already_AddRefed CreateTextureHostBasic( class TextureSourceBasic { public: TextureSourceBasic() : mFromYCBCR(false) {} - virtual ~TextureSourceBasic() {} + virtual ~TextureSourceBasic() = default; virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) = 0; virtual void SetBufferTextureHost(BufferTextureHost* aTexture) {} bool mFromYCBCR; // we to track sources from YCBCR so we can use a less diff --git a/gfx/layers/basic/X11BasicCompositor.h b/gfx/layers/basic/X11BasicCompositor.h index 96d239f0b404..dbbcf55e447f 100644 --- a/gfx/layers/basic/X11BasicCompositor.h +++ b/gfx/layers/basic/X11BasicCompositor.h @@ -22,23 +22,21 @@ class X11DataTextureSourceBasic : public DataTextureSource, public: X11DataTextureSourceBasic(){}; - virtual const char* Name() const override { - return "X11DataTextureSourceBasic"; - } + const char* Name() const override { return "X11DataTextureSourceBasic"; } - virtual bool Update(gfx::DataSourceSurface* aSurface, - nsIntRegion* aDestRegion = nullptr, - gfx::IntPoint* aSrcOffset = nullptr) override; + bool Update(gfx::DataSourceSurface* aSurface, + nsIntRegion* aDestRegion = nullptr, + gfx::IntPoint* aSrcOffset = nullptr) override; - virtual TextureSourceBasic* AsSourceBasic() override; + TextureSourceBasic* AsSourceBasic() override; - virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override; + gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override; - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; private: // We are going to buffer layer content on this xlib draw target @@ -51,15 +49,15 @@ class X11BasicCompositor : public BasicCompositor { widget::CompositorWidget* aWidget) : BasicCompositor(aParent, aWidget) {} - virtual already_AddRefed CreateDataTextureSource( + already_AddRefed CreateDataTextureSource( TextureFlags aFlags = TextureFlags::NO_FLAGS) override; - virtual already_AddRefed CreateDataTextureSourceAround( + already_AddRefed CreateDataTextureSourceAround( gfx::DataSourceSurface* aSurface) override { return nullptr; } - virtual void EndFrame() override; + void EndFrame() override; }; } // namespace layers diff --git a/gfx/layers/client/CanvasClient.h b/gfx/layers/client/CanvasClient.h index fdf405860564..ad5c592430d9 100644 --- a/gfx/layers/client/CanvasClient.h +++ b/gfx/layers/client/CanvasClient.h @@ -58,7 +58,7 @@ class CanvasClient : public CompositableClient { mTextureFlags = aFlags; } - virtual ~CanvasClient() {} + virtual ~CanvasClient() = default; virtual void Clear(){}; @@ -66,7 +66,7 @@ class CanvasClient : public CompositableClient { ShareableCanvasRenderer* aCanvasRenderer, wr::RenderRoot aRenderRoot) = 0; - virtual bool AddTextureClient(TextureClient* aTexture) override { + bool AddTextureClient(TextureClient* aTexture) override { ++mFrameID; return CompositableClient::AddTextureClient(aTexture); } @@ -93,22 +93,21 @@ class CanvasClient2D : public CanvasClient { return TextureInfo(CompositableType::IMAGE, mTextureFlags); } - virtual void Clear() override { + void Clear() override { mBackBuffer = mFrontBuffer = mBufferProviderTexture = nullptr; } - virtual void Update(gfx::IntSize aSize, - ShareableCanvasRenderer* aCanvasRenderer, - wr::RenderRoot aRenderRoot) override; + void Update(gfx::IntSize aSize, ShareableCanvasRenderer* aCanvasRenderer, + wr::RenderRoot aRenderRoot) override; - virtual void UpdateFromTexture(TextureClient* aBuffer, - wr::RenderRoot aRenderRoot) override; + void UpdateFromTexture(TextureClient* aBuffer, + wr::RenderRoot aRenderRoot) override; - virtual bool AddTextureClient(TextureClient* aTexture) override { + bool AddTextureClient(TextureClient* aTexture) override { return CanvasClient::AddTextureClient(aTexture); } - virtual void OnDetach() override { mBackBuffer = mFrontBuffer = nullptr; } + void OnDetach() override { mBackBuffer = mFrontBuffer = nullptr; } private: already_AddRefed CreateTextureClientForCanvas( @@ -142,22 +141,21 @@ class CanvasClientSharedSurface : public CanvasClient { ~CanvasClientSharedSurface(); - virtual TextureInfo GetTextureInfo() const override { + TextureInfo GetTextureInfo() const override { return TextureInfo(CompositableType::IMAGE); } - virtual void Clear() override { ClearSurfaces(); } + void Clear() override { ClearSurfaces(); } - virtual void Update(gfx::IntSize aSize, - ShareableCanvasRenderer* aCanvasRenderer, - wr::RenderRoot aRenderRoot) override; + void Update(gfx::IntSize aSize, ShareableCanvasRenderer* aCanvasRenderer, + wr::RenderRoot aRenderRoot) override; void UpdateRenderer(gfx::IntSize aSize, Renderer& aRenderer); - virtual void UpdateAsync(AsyncCanvasRenderer* aRenderer) override; + void UpdateAsync(AsyncCanvasRenderer* aRenderer) override; - virtual void Updated(wr::RenderRoot aRenderRoot) override; + void Updated(wr::RenderRoot aRenderRoot) override; - virtual void OnDetach() override; + void OnDetach() override; }; /** @@ -175,11 +173,10 @@ class CanvasClientBridge final : public CanvasClient { return TextureInfo(CompositableType::IMAGE); } - virtual void Update(gfx::IntSize aSize, - ShareableCanvasRenderer* aCanvasRenderer, - wr::RenderRoot aRenderRoot) override {} + void Update(gfx::IntSize aSize, ShareableCanvasRenderer* aCanvasRenderer, + wr::RenderRoot aRenderRoot) override {} - virtual void UpdateAsync(AsyncCanvasRenderer* aRenderer) override; + void UpdateAsync(AsyncCanvasRenderer* aRenderer) override; void SetLayer(ShadowableLayer* aLayer) { mLayer = aLayer; } diff --git a/gfx/layers/client/ClientCanvasLayer.h b/gfx/layers/client/ClientCanvasLayer.h index a5608cfa3493..86775c8c3a7c 100644 --- a/gfx/layers/client/ClientCanvasLayer.h +++ b/gfx/layers/client/ClientCanvasLayer.h @@ -36,33 +36,32 @@ class ClientCanvasLayer : public CanvasLayer, public ClientLayer { virtual ~ClientCanvasLayer(); public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); CanvasLayer::SetVisibleRegion(aRegion); } - virtual void RenderLayer() override; + void RenderLayer() override; - virtual void ClearCachedResources() override { + void ClearCachedResources() override { mCanvasRenderer->ClearCachedResources(); } - virtual void HandleMemoryPressure() override { + void HandleMemoryPressure() override { mCanvasRenderer->ClearCachedResources(); } - virtual void FillSpecificAttributes( - SpecificLayerAttributes& aAttrs) override { + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override { aAttrs = CanvasLayerAttributes(mSamplingFilter, mBounds); } - virtual Layer* AsLayer() override { return this; } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + ShadowableLayer* AsShadowableLayer() override { return this; } - virtual void Disconnect() override { mCanvasRenderer->Destroy(); } + void Disconnect() override { mCanvasRenderer->Destroy(); } - virtual CompositableClient* GetCompositableClient() override { + CompositableClient* GetCompositableClient() override { ClientCanvasRenderer* canvasRenderer = mCanvasRenderer->AsClientCanvasRenderer(); MOZ_ASSERT(canvasRenderer); diff --git a/gfx/layers/client/ClientColorLayer.cpp b/gfx/layers/client/ClientColorLayer.cpp index 29c358596470..03b42af1a886 100644 --- a/gfx/layers/client/ClientColorLayer.cpp +++ b/gfx/layers/client/ClientColorLayer.cpp @@ -29,21 +29,20 @@ class ClientColorLayer : public ColorLayer, public ClientLayer { virtual ~ClientColorLayer() { MOZ_COUNT_DTOR(ClientColorLayer); } public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ColorLayer::SetVisibleRegion(aRegion); } - virtual void RenderLayer() override { RenderMaskLayers(this); } + void RenderLayer() override { RenderMaskLayers(this); } - virtual void FillSpecificAttributes( - SpecificLayerAttributes& aAttrs) override { + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override { aAttrs = ColorLayerAttributes(GetColor(), GetBounds()); } - virtual Layer* AsLayer() override { return this; } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + ShadowableLayer* AsShadowableLayer() override { return this; } protected: ClientLayerManager* ClientManager() { diff --git a/gfx/layers/client/ClientContainerLayer.h b/gfx/layers/client/ClientContainerLayer.h index dbe3f1704da7..633b0aa4256e 100644 --- a/gfx/layers/client/ClientContainerLayer.h +++ b/gfx/layers/client/ClientContainerLayer.h @@ -38,7 +38,7 @@ class ClientContainerLayer : public ContainerLayer, public ClientLayer { } public: - virtual void RenderLayer() override { + void RenderLayer() override { RenderMaskLayers(this); DefaultComputeSupportsComponentAlphaChildren(); @@ -59,12 +59,12 @@ class ClientContainerLayer : public ContainerLayer, public ClientLayer { } } - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ContainerLayer::SetVisibleRegion(aRegion); } - virtual bool InsertAfter(Layer* aChild, Layer* aAfter) override { + bool InsertAfter(Layer* aChild, Layer* aAfter) override { if (!ClientManager()->InConstruction()) { NS_ERROR("Can only set properties in construction phase"); return false; @@ -80,7 +80,7 @@ class ClientContainerLayer : public ContainerLayer, public ClientLayer { return true; } - virtual bool RemoveChild(Layer* aChild) override { + bool RemoveChild(Layer* aChild) override { if (!ClientManager()->InConstruction()) { NS_ERROR("Can only set properties in construction phase"); return false; @@ -95,7 +95,7 @@ class ClientContainerLayer : public ContainerLayer, public ClientLayer { return true; } - virtual bool RepositionChild(Layer* aChild, Layer* aAfter) override { + bool RepositionChild(Layer* aChild, Layer* aAfter) override { if (!ClientManager()->InConstruction()) { NS_ERROR("Can only set properties in construction phase"); return false; @@ -109,10 +109,10 @@ class ClientContainerLayer : public ContainerLayer, public ClientLayer { return true; } - virtual Layer* AsLayer() override { return this; } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + ShadowableLayer* AsShadowableLayer() override { return this; } - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { DefaultComputeEffectiveTransforms(aTransformToSurface); } @@ -140,12 +140,12 @@ class ClientRefLayer : public RefLayer, public ClientLayer { virtual ~ClientRefLayer() { MOZ_COUNT_DTOR(ClientRefLayer); } public: - virtual Layer* AsLayer() override { return this; } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + ShadowableLayer* AsShadowableLayer() override { return this; } - virtual void RenderLayer() override {} + void RenderLayer() override {} - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { DefaultComputeEffectiveTransforms(aTransformToSurface); } diff --git a/gfx/layers/client/ClientImageLayer.cpp b/gfx/layers/client/ClientImageLayer.cpp index ffe444ee8a3c..464fe6a3087d 100644 --- a/gfx/layers/client/ClientImageLayer.cpp +++ b/gfx/layers/client/ClientImageLayer.cpp @@ -37,43 +37,42 @@ class ClientImageLayer : public ImageLayer, public ClientLayer { MOZ_COUNT_DTOR(ClientImageLayer); } - virtual void SetContainer(ImageContainer* aContainer) override { + void SetContainer(ImageContainer* aContainer) override { ImageLayer::SetContainer(aContainer); mImageClientTypeContainer = CompositableType::UNKNOWN; } - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); ImageLayer::SetVisibleRegion(aRegion); } - virtual void RenderLayer() override; + void RenderLayer() override; - virtual void ClearCachedResources() override { DestroyBackBuffer(); } + void ClearCachedResources() override { DestroyBackBuffer(); } - virtual bool SupportsAsyncUpdate() override { + bool SupportsAsyncUpdate() override { if (GetImageClientType() == CompositableType::IMAGE_BRIDGE) { return true; } return false; } - virtual void HandleMemoryPressure() override { + void HandleMemoryPressure() override { if (mImageClient) { mImageClient->HandleMemoryPressure(); } } - virtual void FillSpecificAttributes( - SpecificLayerAttributes& aAttrs) override { + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override { aAttrs = ImageLayerAttributes(mSamplingFilter, mScaleToSize, mScaleMode); } - virtual Layer* AsLayer() override { return this; } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + ShadowableLayer* AsShadowableLayer() override { return this; } - virtual void Disconnect() override { DestroyBackBuffer(); } + void Disconnect() override { DestroyBackBuffer(); } void DestroyBackBuffer() { if (mImageClient) { @@ -83,9 +82,7 @@ class ClientImageLayer : public ImageLayer, public ClientLayer { } } - virtual CompositableClient* GetCompositableClient() override { - return mImageClient; - } + CompositableClient* GetCompositableClient() override { return mImageClient; } protected: ClientLayerManager* ClientManager() { diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index a325855bd158..4e8080af3f23 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -54,91 +54,85 @@ class ClientLayerManager final : public LayerManager, public: explicit ClientLayerManager(nsIWidget* aWidget); - virtual void Destroy() override; + void Destroy() override; protected: virtual ~ClientLayerManager(); public: - virtual ShadowLayerForwarder* AsShadowForwarder() override { - return mForwarder; - } + ShadowLayerForwarder* AsShadowForwarder() override { return mForwarder; } - virtual KnowsCompositor* AsKnowsCompositor() override { return mForwarder; } + KnowsCompositor* AsKnowsCompositor() override { return mForwarder; } - virtual ClientLayerManager* AsClientLayerManager() override { return this; } + ClientLayerManager* AsClientLayerManager() override { return this; } TabGroup* GetTabGroup(); - virtual int32_t GetMaxTextureSize() const override; + int32_t GetMaxTextureSize() const override; - virtual void SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, - ScreenRotation aRotation); - virtual bool BeginTransactionWithTarget(gfxContext* aTarget, - const nsCString& aURL) override; - virtual bool BeginTransaction(const nsCString& aURL) override; - virtual bool EndEmptyTransaction( - EndTransactionFlags aFlags = END_DEFAULT) override; - virtual void EndTransaction( - DrawPaintedLayerCallback aCallback, void* aCallbackData, - EndTransactionFlags aFlags = END_DEFAULT) override; + void SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, + ScreenRotation aRotation); + bool BeginTransactionWithTarget(gfxContext* aTarget, + const nsCString& aURL) override; + bool BeginTransaction(const nsCString& aURL) override; + bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override; + void EndTransaction(DrawPaintedLayerCallback aCallback, void* aCallbackData, + EndTransactionFlags aFlags = END_DEFAULT) override; - virtual LayersBackend GetBackendType() override { + LayersBackend GetBackendType() override { return LayersBackend::LAYERS_CLIENT; } - virtual LayersBackend GetCompositorBackendType() override { + LayersBackend GetCompositorBackendType() override { return AsShadowForwarder()->GetCompositorBackendType(); } - virtual void GetBackendName(nsAString& name) override; - virtual const char* Name() const override { return "Client"; } + void GetBackendName(nsAString& name) override; + const char* Name() const override { return "Client"; } - virtual void SetRoot(Layer* aLayer) override; + void SetRoot(Layer* aLayer) override; - virtual void Mutated(Layer* aLayer) override; - virtual void MutatedSimple(Layer* aLayer) override; + void Mutated(Layer* aLayer) override; + void MutatedSimple(Layer* aLayer) override; - virtual already_AddRefed CreatePaintedLayer() override; - virtual already_AddRefed CreatePaintedLayerWithHint( + already_AddRefed CreatePaintedLayer() override; + already_AddRefed CreatePaintedLayerWithHint( PaintedLayerCreationHint aHint) override; - virtual already_AddRefed CreateContainerLayer() override; - virtual already_AddRefed CreateImageLayer() override; - virtual already_AddRefed CreateCanvasLayer() override; - virtual already_AddRefed CreateReadbackLayer() override; - virtual already_AddRefed CreateColorLayer() override; - virtual already_AddRefed CreateRefLayer() override; + already_AddRefed CreateContainerLayer() override; + already_AddRefed CreateImageLayer() override; + already_AddRefed CreateCanvasLayer() override; + already_AddRefed CreateReadbackLayer() override; + already_AddRefed CreateColorLayer() override; + already_AddRefed CreateRefLayer() override; - virtual void UpdateTextureFactoryIdentifier( + void UpdateTextureFactoryIdentifier( const TextureFactoryIdentifier& aNewIdentifier) override; - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override { + TextureFactoryIdentifier GetTextureFactoryIdentifier() override { return AsShadowForwarder()->GetTextureFactoryIdentifier(); } - virtual void FlushRendering() override; - virtual void WaitOnTransactionProcessed() override; - virtual void SendInvalidRegion(const nsIntRegion& aRegion) override; + void FlushRendering() override; + void WaitOnTransactionProcessed() override; + void SendInvalidRegion(const nsIntRegion& aRegion) override; - virtual uint32_t StartFrameTimeRecording(int32_t aBufferSize) override; + uint32_t StartFrameTimeRecording(int32_t aBufferSize) override; - virtual void StopFrameTimeRecording( - uint32_t aStartIndex, nsTArray& aFrameIntervals) override; + void StopFrameTimeRecording(uint32_t aStartIndex, + nsTArray& aFrameIntervals) override; - virtual bool NeedsWidgetInvalidation() override { return false; } + bool NeedsWidgetInvalidation() override { return false; } ShadowableLayer* Hold(Layer* aLayer); bool HasShadowManager() const { return mForwarder->HasShadowManager(); } - virtual bool IsCompositingCheap() override; - virtual bool HasShadowManagerInternal() const override { - return HasShadowManager(); - } + bool IsCompositingCheap() override; + bool HasShadowManagerInternal() const override { return HasShadowManager(); } - virtual void SetIsFirstPaint() override; - virtual bool GetIsFirstPaint() const override { + void SetIsFirstPaint() override; + bool GetIsFirstPaint() const override { return mForwarder->GetIsFirstPaint(); } - virtual void SetFocusTarget(const FocusTarget& aFocusTarget) override; + void SetFocusTarget(const FocusTarget& aFocusTarget) override; /** * Pass through call to the forwarder for nsPresContext's @@ -151,9 +145,9 @@ class ClientLayerManager final : public LayerManager, // Drop cached resources and ask our shadow manager to do the same, // if we have one. - virtual void ClearCachedResources(Layer* aSubtree = nullptr) override; + void ClearCachedResources(Layer* aSubtree = nullptr) override; - virtual void OnMemoryPressure(MemoryPressureReason aWhy) override; + void OnMemoryPressure(MemoryPressureReason aWhy) override; void SetRepeatTransaction() { mRepeatTransaction = true; } bool GetRepeatTransaction() { return mRepeatTransaction; } @@ -179,7 +173,7 @@ class ClientLayerManager final : public LayerManager, CompositorBridgeChild* GetRemoteRenderer(); - virtual CompositorBridgeChild* GetCompositorBridgeChild() override; + CompositorBridgeChild* GetCompositorBridgeChild() override; bool InConstruction() { return mPhase == PHASE_CONSTRUCTION; } #ifdef DEBUG @@ -188,20 +182,19 @@ class ClientLayerManager final : public LayerManager, #endif bool InTransaction() { return mPhase != PHASE_NONE; } - virtual void SetNeedsComposite(bool aNeedsComposite) override { + void SetNeedsComposite(bool aNeedsComposite) override { mNeedsComposite = aNeedsComposite; } - virtual bool NeedsComposite() const override { return mNeedsComposite; } + bool NeedsComposite() const override { return mNeedsComposite; } - virtual void ScheduleComposite() override; - virtual void GetFrameUniformity( - FrameUniformityData* aFrameUniformityData) override; + void ScheduleComposite() override; + void GetFrameUniformity(FrameUniformityData* aFrameUniformityData) override; - virtual void DidComposite(TransactionId aTransactionId, - const mozilla::TimeStamp& aCompositeStart, - const mozilla::TimeStamp& aCompositeEnd) override; + void DidComposite(TransactionId aTransactionId, + const mozilla::TimeStamp& aCompositeStart, + const mozilla::TimeStamp& aCompositeEnd) override; - virtual bool AreComponentAlphaLayersEnabled() override; + bool AreComponentAlphaLayersEnabled() override; // Log APZ test data for the current paint. We supply the paint sequence // number ourselves, and take care of calling APZTestData::StartNewPaint() @@ -239,27 +232,21 @@ class ClientLayerManager final : public LayerManager, // Get a copy of the compositor-side APZ test data for our layers ID. void GetCompositorSideAPZTestData(APZTestData* aData) const; - virtual void SetTransactionIdAllocator( - TransactionIdAllocator* aAllocator) override; + void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) override; - virtual TransactionId GetLastTransactionId() override { - return mLatestTransactionId; - } + TransactionId GetLastTransactionId() override { return mLatestTransactionId; } float RequestProperty(const nsAString& aProperty) override; bool AsyncPanZoomEnabled() const override; - virtual void SetLayersObserverEpoch(LayersObserverEpoch aEpoch) override; + void SetLayersObserverEpoch(LayersObserverEpoch aEpoch) override; - virtual void AddDidCompositeObserver( - DidCompositeObserver* aObserver) override; - virtual void RemoveDidCompositeObserver( - DidCompositeObserver* aObserver) override; + void AddDidCompositeObserver(DidCompositeObserver* aObserver) override; + void RemoveDidCompositeObserver(DidCompositeObserver* aObserver) override; - virtual already_AddRefed - CreatePersistentBufferProvider(const gfx::IntSize& aSize, - gfx::SurfaceFormat aFormat) override; + already_AddRefed CreatePersistentBufferProvider( + const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) override; static PaintTiming* MaybeGetPaintTiming(LayerManager* aManager) { if (!aManager) { diff --git a/gfx/layers/client/ClientPaintedLayer.h b/gfx/layers/client/ClientPaintedLayer.h index 9018ddcdbc1c..96398262af8d 100644 --- a/gfx/layers/client/ClientPaintedLayer.h +++ b/gfx/layers/client/ClientPaintedLayer.h @@ -54,23 +54,23 @@ class ClientPaintedLayer : public PaintedLayer, public ClientLayer { } public: - virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { + void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); PaintedLayer::SetVisibleRegion(aRegion); } - virtual void InvalidateRegion(const nsIntRegion& aRegion) override { + void InvalidateRegion(const nsIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); mInvalidRegion.Add(aRegion); UpdateValidRegionAfterInvalidRegionChanged(); } - virtual void RenderLayer() override { RenderLayerWithReadback(nullptr); } + void RenderLayer() override { RenderLayerWithReadback(nullptr); } - virtual void RenderLayerWithReadback(ReadbackProcessor* aReadback) override; + void RenderLayerWithReadback(ReadbackProcessor* aReadback) override; - virtual void ClearCachedResources() override { + void ClearCachedResources() override { if (mContentClient) { mContentClient->Clear(); } @@ -78,14 +78,13 @@ class ClientPaintedLayer : public PaintedLayer, public ClientLayer { DestroyBackBuffer(); } - virtual void HandleMemoryPressure() override { + void HandleMemoryPressure() override { if (mContentClient) { mContentClient->HandleMemoryPressure(); } } - virtual void FillSpecificAttributes( - SpecificLayerAttributes& aAttrs) override { + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override { aAttrs = PaintedLayerAttributes(GetValidRegion()); } @@ -93,14 +92,14 @@ class ClientPaintedLayer : public PaintedLayer, public ClientLayer { return static_cast(mManager); } - virtual Layer* AsLayer() override { return this; } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + ShadowableLayer* AsShadowableLayer() override { return this; } - virtual CompositableClient* GetCompositableClient() override { + CompositableClient* GetCompositableClient() override { return mContentClient; } - virtual void Disconnect() override { mContentClient = nullptr; } + void Disconnect() override { mContentClient = nullptr; } protected: void RecordThebes(); @@ -111,8 +110,7 @@ class ClientPaintedLayer : public PaintedLayer, public ClientLayer { bool UpdatePaintRegion(PaintState& aState); void FinishPaintState(PaintState& aState); - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; void DestroyBackBuffer() { mContentClient = nullptr; } diff --git a/gfx/layers/client/ClientReadbackLayer.h b/gfx/layers/client/ClientReadbackLayer.h index 30a6ee6c71ae..1e6535bb162c 100644 --- a/gfx/layers/client/ClientReadbackLayer.h +++ b/gfx/layers/client/ClientReadbackLayer.h @@ -20,9 +20,9 @@ class ClientReadbackLayer : public ReadbackLayer, public ClientLayer { mImplData = static_cast(this); } - virtual ShadowableLayer* AsShadowableLayer() override { return this; } - virtual Layer* AsLayer() override { return this; } - virtual void RenderLayer() override {} + ShadowableLayer* AsShadowableLayer() override { return this; } + Layer* AsLayer() override { return this; } + void RenderLayer() override {} }; } // namespace layers diff --git a/gfx/layers/client/ClientTiledPaintedLayer.h b/gfx/layers/client/ClientTiledPaintedLayer.h index c3be0206d3dd..6043da0b94bd 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.h +++ b/gfx/layers/client/ClientTiledPaintedLayer.h @@ -43,18 +43,17 @@ class ClientTiledPaintedLayer : public PaintedLayer, public ClientLayer { aCreationHint = LayerManager::NONE); protected: - ~ClientTiledPaintedLayer(); + virtual ~ClientTiledPaintedLayer(); - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; public: // Override name to distinguish it from ClientPaintedLayer in layer dumps - virtual const char* Name() const override { return "TiledPaintedLayer"; } + const char* Name() const override { return "TiledPaintedLayer"; } // PaintedLayer - virtual Layer* AsLayer() override { return this; } - virtual void InvalidateRegion(const nsIntRegion& aRegion) override { + Layer* AsLayer() override { return this; } + void InvalidateRegion(const nsIntRegion& aRegion) override { mInvalidRegion.Add(aRegion); UpdateValidRegionAfterInvalidRegionChanged(); if (!mLowPrecisionValidRegion.IsEmpty()) { @@ -65,14 +64,14 @@ class ClientTiledPaintedLayer : public PaintedLayer, public ClientLayer { } // Shadow methods - virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override; - virtual ShadowableLayer* AsShadowableLayer() override { return this; } + void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override; + ShadowableLayer* AsShadowableLayer() override { return this; } - virtual void RenderLayer() override; + void RenderLayer() override; - virtual void ClearCachedResources() override; + void ClearCachedResources() override; - virtual void HandleMemoryPressure() override { + void HandleMemoryPressure() override { if (mContentClient) { mContentClient->HandleMemoryPressure(); } @@ -87,7 +86,7 @@ class ClientTiledPaintedLayer : public PaintedLayer, public ClientLayer { LayerMetricsWrapper* aOutDisplayPortAncestor, bool* aOutHasTransformAnimation); - virtual bool IsOptimizedFor( + bool IsOptimizedFor( LayerManager::PaintedLayerCreationHint aCreationHint) override; private: diff --git a/gfx/layers/client/CompositableClient.h b/gfx/layers/client/CompositableClient.h index 4b065b8ad655..b75fbabe3bba 100644 --- a/gfx/layers/client/CompositableClient.h +++ b/gfx/layers/client/CompositableClient.h @@ -189,9 +189,9 @@ class CompositableClient { * Helper to call RemoveTexture at the end of a scope. */ struct AutoRemoveTexture { - explicit AutoRemoveTexture(CompositableClient* aCompositable, - wr::RenderRoot aRenderRoot, - TextureClient* aTexture = nullptr) + AutoRemoveTexture(CompositableClient* aCompositable, + wr::RenderRoot aRenderRoot, + TextureClient* aTexture = nullptr) : mTexture(aTexture), mCompositable(aCompositable), mRenderRoot(aRenderRoot) {} diff --git a/gfx/layers/client/ContentClient.h b/gfx/layers/client/ContentClient.h index d78fb5a0267b..0763e41b3ad8 100644 --- a/gfx/layers/client/ContentClient.h +++ b/gfx/layers/client/ContentClient.h @@ -78,10 +78,9 @@ class ContentClient : public CompositableClient { */ enum BufferSizePolicy { SizedToVisibleBounds, ContainsVisibleBounds }; - explicit ContentClient(CompositableForwarder* aForwarder, - BufferSizePolicy aBufferSizePolicy) + ContentClient(CompositableForwarder* aForwarder, + BufferSizePolicy aBufferSizePolicy) : CompositableClient(aForwarder), mBufferSizePolicy(aBufferSizePolicy) {} - virtual ~ContentClient() {} virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix); @@ -225,14 +224,14 @@ class ContentClientBasic final : public ContentClient { gfx::CompositionOp aOp, gfx::SourceSurface* aMask, const gfx::Matrix* aMaskTransform); - virtual TextureInfo GetTextureInfo() const override { + TextureInfo GetTextureInfo() const override { MOZ_CRASH("GFX: Should not be called on non-remote ContentClient"); } protected: - virtual RefPtr CreateBuffer(gfxContentType aType, - const gfx::IntRect& aRect, - uint32_t aFlags) override; + RefPtr CreateBuffer(gfxContentType aType, + const gfx::IntRect& aRect, + uint32_t aFlags) override; private: gfx::BackendType mBackend; @@ -258,19 +257,18 @@ class ContentClientRemoteBuffer : public ContentClient { explicit ContentClientRemoteBuffer(CompositableForwarder* aForwarder) : ContentClient(aForwarder, ContainsVisibleBounds), mIsNewBuffer(false) {} - virtual void Dump( - std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false, - TextureDumpMode aCompress = TextureDumpMode::Compress) override; + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false, + TextureDumpMode aCompress = TextureDumpMode::Compress) override; - virtual void EndPaint( + void EndPaint( PaintState& aPaintState, nsTArray* aReadbackUpdates = nullptr) override; - virtual void Updated(const nsIntRegion& aRegionToDraw, - const nsIntRegion& aVisibleRegion); + void Updated(const nsIntRegion& aRegionToDraw, + const nsIntRegion& aVisibleRegion); - virtual TextureFlags ExtraTextureFlags() const { + TextureFlags ExtraTextureFlags() const { return TextureFlags::IMMEDIATE_UPLOAD; } @@ -284,9 +282,9 @@ class ContentClientRemoteBuffer : public ContentClient { virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw, const nsIntRegion& aVisibleRegion); - virtual RefPtr CreateBuffer(gfxContentType aType, - const gfx::IntRect& aRect, - uint32_t aFlags) override; + RefPtr CreateBuffer(gfxContentType aType, + const gfx::IntRect& aRect, + uint32_t aFlags) override; RefPtr CreateBufferInternal(const gfx::IntRect& aRect, gfx::SurfaceFormat aFormat, @@ -313,26 +311,21 @@ class ContentClientDoubleBuffered : public ContentClientRemoteBuffer { explicit ContentClientDoubleBuffered(CompositableForwarder* aFwd) : ContentClientRemoteBuffer(aFwd), mFrontAndBackBufferDiffer(false) {} - virtual ~ContentClientDoubleBuffered() {} + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false, + TextureDumpMode aCompress = TextureDumpMode::Compress) override; - virtual void Dump( - std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false, - TextureDumpMode aCompress = TextureDumpMode::Compress) override; + void Clear() override; - virtual void Clear() override; + void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override; - virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override; + PaintState BeginPaint(PaintedLayer* aLayer, uint32_t aFlags) override; - virtual PaintState BeginPaint(PaintedLayer* aLayer, uint32_t aFlags) override; + void FinalizeFrame(PaintState& aPaintState) override; - virtual void FinalizeFrame(PaintState& aPaintState) override; + RefPtr GetFrontBuffer() const override { return mFrontBuffer; } - virtual RefPtr GetFrontBuffer() const override { - return mFrontBuffer; - } - - virtual TextureInfo GetTextureInfo() const override { + TextureInfo GetTextureInfo() const override { return TextureInfo(CompositableType::CONTENT_DOUBLE, mTextureFlags); } @@ -356,9 +349,8 @@ class ContentClientSingleBuffered : public ContentClientRemoteBuffer { public: explicit ContentClientSingleBuffered(CompositableForwarder* aFwd) : ContentClientRemoteBuffer(aFwd) {} - virtual ~ContentClientSingleBuffered() {} - virtual TextureInfo GetTextureInfo() const override { + TextureInfo GetTextureInfo() const override { return TextureInfo(CompositableType::CONTENT_SINGLE, mTextureFlags | ExtraTextureFlags()); } diff --git a/gfx/layers/client/GPUVideoTextureClient.h b/gfx/layers/client/GPUVideoTextureClient.h index d8a9c493b8bd..e27425a71879 100644 --- a/gfx/layers/client/GPUVideoTextureClient.h +++ b/gfx/layers/client/GPUVideoTextureClient.h @@ -22,23 +22,23 @@ class GPUVideoTextureData : public TextureData { GPUVideoTextureData(VideoDecoderManagerChild* aManager, const SurfaceDescriptorGPUVideo& aSD, const gfx::IntSize& aSize); - ~GPUVideoTextureData(); + virtual ~GPUVideoTextureData(); - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual bool Lock(OpenMode) override { return true; }; + bool Lock(OpenMode) override { return true; }; - virtual void Unlock() override{}; + void Unlock() override{}; - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - virtual void Deallocate(LayersIPCChannel* aAllocator) override; + void Deallocate(LayersIPCChannel* aAllocator) override; - virtual void Forget(LayersIPCChannel* aAllocator) override; + void Forget(LayersIPCChannel* aAllocator) override; already_AddRefed GetAsSourceSurface(); - virtual GPUVideoTextureData* AsGPUVideoTextureData() override { return this; } + GPUVideoTextureData* AsGPUVideoTextureData() override { return this; } protected: RefPtr mManager; diff --git a/gfx/layers/client/ImageClient.h b/gfx/layers/client/ImageClient.h index 97338e6f18e1..525b90be9e9f 100644 --- a/gfx/layers/client/ImageClient.h +++ b/gfx/layers/client/ImageClient.h @@ -46,7 +46,7 @@ class ImageClient : public CompositableClient { CompositableType aImageHostType, CompositableForwarder* aFwd, TextureFlags aFlags); - virtual ~ImageClient() {} + virtual ~ImageClient() = default; /** * Update this ImageClient from aContainer in aLayer @@ -96,20 +96,20 @@ class ImageClientSingle : public ImageClient { ImageClientSingle(CompositableForwarder* aFwd, TextureFlags aFlags, CompositableType aType); - virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag, - const Maybe& aRenderRoot) override; + bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag, + const Maybe& aRenderRoot) override; - virtual void OnDetach() override; + void OnDetach() override; - virtual bool AddTextureClient(TextureClient* aTexture) override; + bool AddTextureClient(TextureClient* aTexture) override; - virtual TextureInfo GetTextureInfo() const override; + TextureInfo GetTextureInfo() const override; - virtual void FlushAllImages() override; + void FlushAllImages() override; ImageClientSingle* AsImageClientSingle() override { return this; } - virtual RefPtr GetForwardedTexture() override; + RefPtr GetForwardedTexture() override; bool IsEmpty() { return mBuffers.IsEmpty(); } @@ -130,15 +130,11 @@ class ImageClientBridge : public ImageClient { public: ImageClientBridge(CompositableForwarder* aFwd, TextureFlags aFlags); - virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags, - const Maybe& aRenderRoot) override; - virtual bool Connect(ImageContainer* aImageContainer) override { - return false; - } + bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags, + const Maybe& aRenderRoot) override; + bool Connect(ImageContainer* aImageContainer) override { return false; } - virtual TextureInfo GetTextureInfo() const override { - return TextureInfo(mType); - } + TextureInfo GetTextureInfo() const override { return TextureInfo(mType); } protected: CompositableHandle mAsyncContainerHandle; diff --git a/gfx/layers/client/MultiTiledContentClient.h b/gfx/layers/client/MultiTiledContentClient.h index 9c9efbefc484..8b51c3b0d05f 100644 --- a/gfx/layers/client/MultiTiledContentClient.h +++ b/gfx/layers/client/MultiTiledContentClient.h @@ -40,7 +40,7 @@ class ClientMultiTiledLayerBuffer void* aCallbackData, TilePaintFlags aFlags = TilePaintFlags::None) override; - virtual bool SupportsProgressiveUpdate() override { return true; } + bool SupportsProgressiveUpdate() override { return true; } /** * Performs a progressive update of a given tiled buffer. * See ComputeProgressiveUpdateRegion below for parameter documentation. diff --git a/gfx/layers/client/SingleTiledContentClient.h b/gfx/layers/client/SingleTiledContentClient.h index 6954f1dee830..a4562aa40b1b 100644 --- a/gfx/layers/client/SingleTiledContentClient.h +++ b/gfx/layers/client/SingleTiledContentClient.h @@ -24,7 +24,7 @@ class ClientLayerManager; */ class ClientSingleTiledLayerBuffer : public ClientTiledLayerBuffer, public TextureClientAllocator { - virtual ~ClientSingleTiledLayerBuffer() {} + virtual ~ClientSingleTiledLayerBuffer() = default; public: ClientSingleTiledLayerBuffer(ClientTiledPaintedLayer& aPaintedLayer, @@ -109,14 +109,12 @@ class SingleTiledContentClient : public TiledContentClient { static bool ClientSupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager); - virtual void ClearCachedResources() override; + void ClearCachedResources() override; - virtual void UpdatedBuffer(TiledBufferType aType) override; + void UpdatedBuffer(TiledBufferType aType) override; - virtual ClientTiledLayerBuffer* GetTiledBuffer() override { - return mTiledBuffer; - } - virtual ClientTiledLayerBuffer* GetLowPrecisionTiledBuffer() override { + ClientTiledLayerBuffer* GetTiledBuffer() override { return mTiledBuffer; } + ClientTiledLayerBuffer* GetLowPrecisionTiledBuffer() override { return nullptr; } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index c939043a541c..426d8e38beb9 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -1374,20 +1374,19 @@ class MemoryTextureReadLock : public NonBlockingTextureReadLock { public: MemoryTextureReadLock(); - ~MemoryTextureReadLock(); + virtual ~MemoryTextureReadLock(); - virtual bool ReadLock() override; + bool ReadLock() override; - virtual int32_t ReadUnlock() override; + int32_t ReadUnlock() override; - virtual int32_t GetReadCount() override; + int32_t GetReadCount() override; - virtual LockType GetType() override { return TYPE_NONBLOCKING_MEMORY; } + LockType GetType() override { return TYPE_NONBLOCKING_MEMORY; } - virtual bool IsValid() const override { return true; }; + bool IsValid() const override { return true; }; - virtual bool Serialize(ReadLockDescriptor& aOutput, - base::ProcessId aOther) override; + bool Serialize(ReadLockDescriptor& aOutput, base::ProcessId aOther) override; Atomic mReadCount; }; @@ -1408,20 +1407,19 @@ class ShmemTextureReadLock : public NonBlockingTextureReadLock { explicit ShmemTextureReadLock(LayersIPCChannel* aAllocator); - ~ShmemTextureReadLock(); + virtual ~ShmemTextureReadLock(); - virtual bool ReadLock() override; + bool ReadLock() override; - virtual int32_t ReadUnlock() override; + int32_t ReadUnlock() override; - virtual int32_t GetReadCount() override; + int32_t GetReadCount() override; - virtual bool IsValid() const override { return mAllocSuccess; }; + bool IsValid() const override { return mAllocSuccess; }; - virtual LockType GetType() override { return TYPE_NONBLOCKING_SHMEM; } + LockType GetType() override { return TYPE_NONBLOCKING_SHMEM; } - virtual bool Serialize(ReadLockDescriptor& aOutput, - base::ProcessId aOther) override; + bool Serialize(ReadLockDescriptor& aOutput, base::ProcessId aOther) override; mozilla::layers::ShmemSection& GetShmemSection() { return mShmemSection; } @@ -1449,31 +1447,30 @@ class CrossProcessSemaphoreReadLock : public TextureReadLock { explicit CrossProcessSemaphoreReadLock(CrossProcessSemaphoreHandle aHandle) : mSemaphore(CrossProcessSemaphore::Create(aHandle)), mShared(false) {} - virtual bool ReadLock() override { + bool ReadLock() override { if (!IsValid()) { return false; } return mSemaphore->Wait(); } - virtual bool TryReadLock(TimeDuration aTimeout) override { + bool TryReadLock(TimeDuration aTimeout) override { if (!IsValid()) { return false; } return mSemaphore->Wait(Some(aTimeout)); } - virtual int32_t ReadUnlock() override { + int32_t ReadUnlock() override { if (!IsValid()) { return 1; } mSemaphore->Signal(); return 1; } - virtual bool IsValid() const override { return !!mSemaphore; } + bool IsValid() const override { return !!mSemaphore; } - virtual bool Serialize(ReadLockDescriptor& aOutput, - base::ProcessId aOther) override; + bool Serialize(ReadLockDescriptor& aOutput, base::ProcessId aOther) override; - virtual LockType GetType() override { return TYPE_CROSS_PROCESS_SEMAPHORE; } + LockType GetType() override { return TYPE_CROSS_PROCESS_SEMAPHORE; } UniquePtr mSemaphore; bool mShared; diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 162f2cd1caed..599c8a3d6b05 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -118,7 +118,7 @@ class TextureReadbackSink { virtual void ProcessReadback(gfx::DataSourceSurface* aSourceSurface) = 0; protected: - virtual ~TextureReadbackSink() {} + virtual ~TextureReadbackSink() = default; }; enum class BackendSelector { Content, Canvas }; @@ -182,7 +182,7 @@ class NonBlockingTextureReadLock; // once. class TextureReadLock { protected: - virtual ~TextureReadLock() {} + virtual ~TextureReadLock() = default; public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureReadLock) @@ -217,9 +217,7 @@ class NonBlockingTextureReadLock : public TextureReadLock { static already_AddRefed Create(LayersIPCChannel* aAllocator); - virtual NonBlockingTextureReadLock* AsNonBlockingLock() override { - return this; - } + NonBlockingTextureReadLock* AsNonBlockingLock() override { return this; } }; #ifdef XP_WIN @@ -329,8 +327,8 @@ class TextureData { */ class TextureClient : public AtomicRefCountedWithFinalize { public: - explicit TextureClient(TextureData* aData, TextureFlags aFlags, - LayersIPCChannel* aAllocator); + TextureClient(TextureData* aData, TextureFlags aFlags, + LayersIPCChannel* aAllocator); virtual ~TextureClient(); @@ -876,7 +874,7 @@ class MOZ_RAII DualTextureClientAutoLock { class KeepAlive { public: - virtual ~KeepAlive() {} + virtual ~KeepAlive() = default; }; template diff --git a/gfx/layers/client/TextureClientPool.h b/gfx/layers/client/TextureClientPool.h index af997920b802..0ce5801f35c5 100644 --- a/gfx/layers/client/TextureClientPool.h +++ b/gfx/layers/client/TextureClientPool.h @@ -24,7 +24,7 @@ class TextureReadLock; class TextureClientAllocator { protected: - virtual ~TextureClientAllocator() {} + virtual ~TextureClientAllocator() = default; public: NS_INLINE_DECL_REFCOUNTING(TextureClientAllocator) diff --git a/gfx/layers/client/TextureClientRecycleAllocator.cpp b/gfx/layers/client/TextureClientRecycleAllocator.cpp index 0f69c91401d1..9d98e2978ddc 100644 --- a/gfx/layers/client/TextureClientRecycleAllocator.cpp +++ b/gfx/layers/client/TextureClientRecycleAllocator.cpp @@ -16,8 +16,8 @@ namespace layers { // Used to keep TextureClient's reference count stable as not to disrupt // recycling. -class TextureClientHolder { - ~TextureClientHolder() {} +class TextureClientHolder final { + ~TextureClientHolder() = default; public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureClientHolder) diff --git a/gfx/layers/client/TextureClientRecycleAllocator.h b/gfx/layers/client/TextureClientRecycleAllocator.h index 3f9d2898db28..19270b80a1c1 100644 --- a/gfx/layers/client/TextureClientRecycleAllocator.h +++ b/gfx/layers/client/TextureClientRecycleAllocator.h @@ -23,7 +23,7 @@ struct PlanarYCbCrData; class ITextureClientRecycleAllocator { protected: - virtual ~ITextureClientRecycleAllocator() {} + virtual ~ITextureClientRecycleAllocator() = default; public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ITextureClientRecycleAllocator) diff --git a/gfx/layers/client/TextureClientSharedSurface.h b/gfx/layers/client/TextureClientSharedSurface.h index c2fe3064287a..c5f291463b6f 100644 --- a/gfx/layers/client/TextureClientSharedSurface.h +++ b/gfx/layers/client/TextureClientSharedSurface.h @@ -38,17 +38,17 @@ class SharedSurfaceTextureData : public TextureData { explicit SharedSurfaceTextureData(UniquePtr surf); public: - ~SharedSurfaceTextureData(); + virtual ~SharedSurfaceTextureData(); - virtual bool Lock(OpenMode) override { return false; } + bool Lock(OpenMode) override { return false; } - virtual void Unlock() override {} + void Unlock() override {} - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - virtual void Deallocate(LayersIPCChannel*) override; + void Deallocate(LayersIPCChannel*) override; gl::SharedSurface* Surf() const { return mSurf.get(); } }; diff --git a/gfx/layers/client/TiledContentClient.h b/gfx/layers/client/TiledContentClient.h index 4e82b93ac66f..8accb64e3d91 100644 --- a/gfx/layers/client/TiledContentClient.h +++ b/gfx/layers/client/TiledContentClient.h @@ -388,12 +388,11 @@ class TiledContentClient : public CompositableClient { public: virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix); - virtual void Dump( - std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false, - TextureDumpMode aCompress = TextureDumpMode::Compress) override; + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false, + TextureDumpMode aCompress = TextureDumpMode::Compress) override; - virtual TextureInfo GetTextureInfo() const override { + TextureInfo GetTextureInfo() const override { return TextureInfo(CompositableType::CONTENT_TILED); } diff --git a/gfx/layers/composite/AsyncCompositionManager.h b/gfx/layers/composite/AsyncCompositionManager.h index 5d058ebba247..cad222f5cfaa 100644 --- a/gfx/layers/composite/AsyncCompositionManager.h +++ b/gfx/layers/composite/AsyncCompositionManager.h @@ -67,8 +67,8 @@ class AsyncCompositionManager final { public: NS_INLINE_DECL_REFCOUNTING(AsyncCompositionManager) - explicit AsyncCompositionManager(CompositorBridgeParent* aParent, - HostLayerManager* aManager); + AsyncCompositionManager(CompositorBridgeParent* aParent, + HostLayerManager* aManager); /** * This forces the is-first-paint flag to true. This is intended to diff --git a/gfx/layers/composite/CanvasLayerComposite.h b/gfx/layers/composite/CanvasLayerComposite.h index 975251b6347d..81ec27226dbd 100644 --- a/gfx/layers/composite/CanvasLayerComposite.h +++ b/gfx/layers/composite/CanvasLayerComposite.h @@ -31,25 +31,25 @@ class CanvasLayerComposite : public CanvasLayer, public LayerComposite { virtual ~CanvasLayerComposite(); public: - virtual bool SetCompositableHost(CompositableHost* aHost) override; + bool SetCompositableHost(CompositableHost* aHost) override; - virtual void Disconnect() override { Destroy(); } + void Disconnect() override { Destroy(); } - virtual void SetLayerManager(HostLayerManager* aManager) override; + void SetLayerManager(HostLayerManager* aManager) override; - virtual Layer* GetLayer() override; - virtual void RenderLayer(const gfx::IntRect& aClipRect, - const Maybe& aGeometry) override; + Layer* GetLayer() override; + void RenderLayer(const gfx::IntRect& aClipRect, + const Maybe& aGeometry) override; - virtual void CleanupResources() override; + void CleanupResources() override; - virtual void GenEffectChain(EffectChain& aEffect) override; + void GenEffectChain(EffectChain& aEffect) override; CompositableHost* GetCompositableHost() override; - virtual HostLayer* AsHostLayer() override { return this; } + HostLayer* AsHostLayer() override { return this; } - virtual const char* Name() const override { return "CanvasLayerComposite"; } + const char* Name() const override { return "CanvasLayerComposite"; } protected: CanvasRenderer* CreateCanvasRendererInternal() override { @@ -57,8 +57,7 @@ class CanvasLayerComposite : public CanvasLayer, public LayerComposite { return nullptr; } - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; private: gfx::SamplingFilter GetSamplingFilter(); diff --git a/gfx/layers/composite/ColorLayerComposite.h b/gfx/layers/composite/ColorLayerComposite.h index 8a85c1be5136..b4991124861e 100644 --- a/gfx/layers/composite/ColorLayerComposite.h +++ b/gfx/layers/composite/ColorLayerComposite.h @@ -26,34 +26,34 @@ class ColorLayerComposite : public ColorLayer, public LayerComposite { } protected: - ~ColorLayerComposite() { + virtual ~ColorLayerComposite() { MOZ_COUNT_DTOR(ColorLayerComposite); Destroy(); } public: // LayerComposite Implementation - virtual Layer* GetLayer() override { return this; } + Layer* GetLayer() override { return this; } - virtual void SetLayerManager(HostLayerManager* aManager) override { + void SetLayerManager(HostLayerManager* aManager) override { LayerComposite::SetLayerManager(aManager); mManager = aManager; } - virtual void Destroy() override { mDestroyed = true; } + void Destroy() override { mDestroyed = true; } - virtual void RenderLayer(const gfx::IntRect& aClipRect, - const Maybe& aGeometry) override; + void RenderLayer(const gfx::IntRect& aClipRect, + const Maybe& aGeometry) override; - virtual void CleanupResources() override{}; + void CleanupResources() override{}; - virtual void GenEffectChain(EffectChain& aEffect) override; + void GenEffectChain(EffectChain& aEffect) override; CompositableHost* GetCompositableHost() override { return nullptr; } - virtual HostLayer* AsHostLayer() override { return this; } + HostLayer* AsHostLayer() override { return this; } - virtual const char* Name() const override { return "ColorLayerComposite"; } + const char* Name() const override { return "ColorLayerComposite"; } }; } // namespace layers diff --git a/gfx/layers/composite/ContainerLayerComposite.h b/gfx/layers/composite/ContainerLayerComposite.h index 24ac2136245b..5182b534f75b 100644 --- a/gfx/layers/composite/ContainerLayerComposite.h +++ b/gfx/layers/composite/ContainerLayerComposite.h @@ -60,39 +60,39 @@ class ContainerLayerComposite : public ContainerLayer, public LayerComposite { explicit ContainerLayerComposite(LayerManagerComposite* aManager); protected: - ~ContainerLayerComposite(); + virtual ~ContainerLayerComposite(); public: // LayerComposite Implementation - virtual Layer* GetLayer() override { return this; } + Layer* GetLayer() override { return this; } - virtual void SetLayerManager(HostLayerManager* aManager) override { + void SetLayerManager(HostLayerManager* aManager) override { LayerComposite::SetLayerManager(aManager); mManager = aManager; mLastIntermediateSurface = nullptr; } - virtual void Destroy() override; + void Destroy() override; LayerComposite* GetFirstChildComposite() override; - virtual void Cleanup() override; + void Cleanup() override; - virtual void RenderLayer(const gfx::IntRect& aClipRect, - const Maybe& aGeometry) override; + void RenderLayer(const gfx::IntRect& aClipRect, + const Maybe& aGeometry) override; - virtual void Prepare(const RenderTargetIntRect& aClipRect) override; + void Prepare(const RenderTargetIntRect& aClipRect) override; - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { DefaultComputeEffectiveTransforms(aTransformToSurface); } - virtual const LayerIntRegion& GetShadowVisibleRegion() override; + const LayerIntRegion& GetShadowVisibleRegion() override; - virtual void CleanupResources() override; + void CleanupResources() override; - virtual HostLayer* AsHostLayer() override { return this; } + HostLayer* AsHostLayer() override { return this; } // container layers don't use a compositable CompositableHost* GetCompositableHost() override { return nullptr; } @@ -102,16 +102,14 @@ class ContainerLayerComposite : public ContainerLayer, public LayerComposite { // scaling to. This cancels out the post scale of '1 / resolution' // added by Layout. TODO: It would be nice to get rid of both of these // post-scales. - virtual float GetPostXScale() const override { + float GetPostXScale() const override { return mSimpleAttrs.GetPostXScale() * mPresShellResolution; } - virtual float GetPostYScale() const override { + float GetPostYScale() const override { return mSimpleAttrs.GetPostYScale() * mPresShellResolution; } - virtual const char* Name() const override { - return "ContainerLayerComposite"; - } + const char* Name() const override { return "ContainerLayerComposite"; } UniquePtr mPrepared; RefPtr mLastIntermediateSurface; @@ -151,13 +149,13 @@ class RefLayerComposite : public RefLayer, public LayerComposite { explicit RefLayerComposite(LayerManagerComposite* aManager); protected: - ~RefLayerComposite(); + virtual ~RefLayerComposite(); public: /** LayerOGL implementation */ Layer* GetLayer() override { return this; } - virtual void SetLayerManager(HostLayerManager* aManager) override { + void SetLayerManager(HostLayerManager* aManager) override { LayerComposite::SetLayerManager(aManager); mManager = aManager; mLastIntermediateSurface = nullptr; @@ -167,28 +165,28 @@ class RefLayerComposite : public RefLayer, public LayerComposite { LayerComposite* GetFirstChildComposite() override; - virtual void RenderLayer(const gfx::IntRect& aClipRect, - const Maybe& aGeometry) override; + void RenderLayer(const gfx::IntRect& aClipRect, + const Maybe& aGeometry) override; - virtual void Prepare(const RenderTargetIntRect& aClipRect) override; + void Prepare(const RenderTargetIntRect& aClipRect) override; - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const gfx::Matrix4x4& aTransformToSurface) override { DefaultComputeEffectiveTransforms(aTransformToSurface); } - virtual const LayerIntRegion& GetShadowVisibleRegion() override; + const LayerIntRegion& GetShadowVisibleRegion() override; - virtual void Cleanup() override; + void Cleanup() override; - virtual void CleanupResources() override; + void CleanupResources() override; - virtual HostLayer* AsHostLayer() override { return this; } + HostLayer* AsHostLayer() override { return this; } // ref layers don't use a compositable CompositableHost* GetCompositableHost() override { return nullptr; } - virtual const char* Name() const override { return "RefLayerComposite"; } + const char* Name() const override { return "RefLayerComposite"; } UniquePtr mPrepared; RefPtr mLastIntermediateSurface; }; diff --git a/gfx/layers/composite/ContentHost.h b/gfx/layers/composite/ContentHost.h index ce8d6ac10a61..6833ebd74f79 100644 --- a/gfx/layers/composite/ContentHost.h +++ b/gfx/layers/composite/ContentHost.h @@ -70,7 +70,7 @@ class ContentHost : public CompositableHost { return gfx::IntRect(); } - virtual ContentHost* AsContentHost() override { return this; } + ContentHost* AsContentHost() override { return this; } protected: explicit ContentHost(const TextureInfo& aTextureInfo) @@ -98,7 +98,7 @@ class ContentHostBase : public ContentHost { explicit ContentHostBase(const TextureInfo& aTextureInfo); virtual ~ContentHostBase(); - virtual gfx::IntRect GetBufferRect() override { return mBufferRect; } + gfx::IntRect GetBufferRect() override { return mBufferRect; } virtual nsIntPoint GetOriginOffset() { return mBufferRect.TopLeft() - mBufferRotation; @@ -123,30 +123,28 @@ class ContentHostTexture : public ContentHostBase { mLocked(false), mReceivedNewHost(false) {} - virtual void Composite( - Compositor* aCompositor, LayerComposite* aLayer, - EffectChain& aEffectChain, float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::SamplingFilter aSamplingFilter, const gfx::IntRect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - const Maybe& aGeometry = Nothing()) override; + void Composite(Compositor* aCompositor, LayerComposite* aLayer, + EffectChain& aEffectChain, float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::SamplingFilter aSamplingFilter, + const gfx::IntRect& aClipRect, + const nsIntRegion* aVisibleRegion = nullptr, + const Maybe& aGeometry = Nothing()) override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; - virtual void Dump(std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false) override; + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false) override; - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void UseTextureHost(const nsTArray& aTextures) override; - virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack, - TextureHost* aTextureOnWhite) override; + void UseTextureHost(const nsTArray& aTextures) override; + void UseComponentAlphaTextures(TextureHost* aTextureOnBlack, + TextureHost* aTextureOnWhite) override; - virtual bool Lock() override { + bool Lock() override { MOZ_ASSERT(!mLocked); if (!mTextureHost) { return false; @@ -162,7 +160,7 @@ class ContentHostTexture : public ContentHostBase { mLocked = true; return true; } - virtual void Unlock() override { + void Unlock() override { MOZ_ASSERT(mLocked); mTextureHost->Unlock(); if (mTextureHostOnWhite) { @@ -178,7 +176,7 @@ class ContentHostTexture : public ContentHostBase { ContentHostTexture* AsContentHostTexture() override { return this; } - virtual already_AddRefed GenEffect( + already_AddRefed GenEffect( const gfx::SamplingFilter aSamplingFilter) override; protected: @@ -200,9 +198,9 @@ class ContentHostDoubleBuffered : public ContentHostTexture { explicit ContentHostDoubleBuffered(const TextureInfo& aTextureInfo) : ContentHostTexture(aTextureInfo) {} - virtual ~ContentHostDoubleBuffered() {} + virtual ~ContentHostDoubleBuffered() = default; - virtual CompositableType GetType() override { + CompositableType GetType() override { return CompositableType::CONTENT_DOUBLE; } @@ -222,15 +220,14 @@ class ContentHostSingleBuffered : public ContentHostTexture { public: explicit ContentHostSingleBuffered(const TextureInfo& aTextureInfo) : ContentHostTexture(aTextureInfo) {} - virtual ~ContentHostSingleBuffered() {} + virtual ~ContentHostSingleBuffered() = default; - virtual CompositableType GetType() override { + CompositableType GetType() override { return CompositableType::CONTENT_SINGLE; } - virtual bool UpdateThebes(const ThebesBufferData& aData, - const nsIntRegion& aUpdated, - const nsIntRegion& aOldValidRegionBack) override; + bool UpdateThebes(const ThebesBufferData& aData, const nsIntRegion& aUpdated, + const nsIntRegion& aOldValidRegionBack) override; }; } // namespace layers diff --git a/gfx/layers/composite/FPSCounter.h b/gfx/layers/composite/FPSCounter.h index ba0d2f2437d9..c61b13a7b560 100644 --- a/gfx/layers/composite/FPSCounter.h +++ b/gfx/layers/composite/FPSCounter.h @@ -54,7 +54,7 @@ const int kMaxFrames = 2400; * Use the HasNext(), GetNextTimeStamp() like an iterator to read the data, * backwards in time. This abstracts away the mechanics of reading the data. */ -class FPSCounter { +class FPSCounter final { public: explicit FPSCounter(const char* aName); ~FPSCounter(); diff --git a/gfx/layers/composite/GPUVideoTextureHost.h b/gfx/layers/composite/GPUVideoTextureHost.h index f71cd091e899..85c6c0790672 100644 --- a/gfx/layers/composite/GPUVideoTextureHost.h +++ b/gfx/layers/composite/GPUVideoTextureHost.h @@ -19,53 +19,50 @@ class GPUVideoTextureHost : public TextureHost { virtual ~GPUVideoTextureHost(); - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} virtual void SetTextureSourceProvider( TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override; - virtual bool AcquireTextureSource( - CompositableTextureSourceRef& aTexture) override; + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; + bool AcquireTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) } - virtual gfx::YUVColorSpace GetYUVColorSpace() const override; + gfx::YUVColorSpace GetYUVColorSpace() const override; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; #ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "GPUVideoTextureHost"; } + const char* Name() override { return "GPUVideoTextureHost"; } #endif - virtual bool HasIntermediateBuffer() const override; + bool HasIntermediateBuffer() const override; - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual uint32_t NumSubTextures() const override; + uint32_t NumSubTextures() const override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; - virtual bool SupportsWrNativeTexture() override; + bool SupportsWrNativeTexture() override; protected: GPUVideoTextureHost(TextureFlags aFlags, TextureHost* aWrappedTextureHost); diff --git a/gfx/layers/composite/ImageComposite.h b/gfx/layers/composite/ImageComposite.h index dee28b5e7ad8..f35401409164 100644 --- a/gfx/layers/composite/ImageComposite.h +++ b/gfx/layers/composite/ImageComposite.h @@ -23,7 +23,7 @@ class ImageComposite { static const float BIAS_TIME_MS; explicit ImageComposite(); - ~ImageComposite(); + virtual ~ImageComposite(); int32_t GetFrameID() { const TimedImage* img = ChooseImage(); diff --git a/gfx/layers/composite/ImageHost.h b/gfx/layers/composite/ImageHost.h index 9b455b4843f5..845e554339eb 100644 --- a/gfx/layers/composite/ImageHost.h +++ b/gfx/layers/composite/ImageHost.h @@ -40,54 +40,49 @@ class HostLayerManager; class ImageHost : public CompositableHost, public ImageComposite { public: explicit ImageHost(const TextureInfo& aTextureInfo); - ~ImageHost(); + virtual ~ImageHost(); - virtual CompositableType GetType() override { - return mTextureInfo.mCompositableType; - } - virtual ImageHost* AsImageHost() override { return this; } + CompositableType GetType() override { return mTextureInfo.mCompositableType; } + ImageHost* AsImageHost() override { return this; } - virtual void Composite( - Compositor* aCompositor, LayerComposite* aLayer, - EffectChain& aEffectChain, float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::SamplingFilter aSamplingFilter, const gfx::IntRect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - const Maybe& aGeometry = Nothing()) override; + void Composite(Compositor* aCompositor, LayerComposite* aLayer, + EffectChain& aEffectChain, float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::SamplingFilter aSamplingFilter, + const gfx::IntRect& aClipRect, + const nsIntRegion* aVisibleRegion = nullptr, + const Maybe& aGeometry = Nothing()) override; - virtual void UseTextureHost(const nsTArray& aTextures) override; + void UseTextureHost(const nsTArray& aTextures) override; - virtual void RemoveTextureHost(TextureHost* aTexture) override; + void RemoveTextureHost(TextureHost* aTexture) override; - virtual TextureHost* GetAsTextureHost( - gfx::IntRect* aPictureRect = nullptr) override; + TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) override; - virtual void Attach(Layer* aLayer, TextureSourceProvider* aProvider, - AttachFlags aFlags = NO_FLAGS) override; + void Attach(Layer* aLayer, TextureSourceProvider* aProvider, + AttachFlags aFlags = NO_FLAGS) override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; gfx::IntSize GetImageSize() override; - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void Dump(std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false) override; + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false) override; - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual already_AddRefed GenEffect( + already_AddRefed GenEffect( const gfx::SamplingFilter aSamplingFilter) override; void SetCurrentTextureHost(TextureHost* aTexture); - virtual void CleanupResources() override; + void CleanupResources() override; bool IsOpaque(); @@ -119,7 +114,7 @@ class ImageHost : public CompositableHost, public ImageComposite { protected: // ImageComposite - virtual TimeStamp GetCompositionTime() const override; + TimeStamp GetCompositionTime() const override; // Use a simple RefPtr because the same texture is already held by a // a CompositableTextureHostRef in the array of TimedImage. diff --git a/gfx/layers/composite/ImageLayerComposite.h b/gfx/layers/composite/ImageLayerComposite.h index 4e6a08178263..f0725c28529f 100644 --- a/gfx/layers/composite/ImageLayerComposite.h +++ b/gfx/layers/composite/ImageLayerComposite.h @@ -34,37 +34,36 @@ class ImageLayerComposite : public ImageLayer, public LayerComposite { virtual ~ImageLayerComposite(); public: - virtual void Disconnect() override; + void Disconnect() override; - virtual bool SetCompositableHost(CompositableHost* aHost) override; + bool SetCompositableHost(CompositableHost* aHost) override; - virtual Layer* GetLayer() override; + Layer* GetLayer() override; - virtual void SetLayerManager(HostLayerManager* aManager) override; + void SetLayerManager(HostLayerManager* aManager) override; - virtual void RenderLayer(const gfx::IntRect& aClipRect, - const Maybe& aGeometry) override; + void RenderLayer(const gfx::IntRect& aClipRect, + const Maybe& aGeometry) override; - virtual void ComputeEffectiveTransforms( + void ComputeEffectiveTransforms( const mozilla::gfx::Matrix4x4& aTransformToSurface) override; - virtual void CleanupResources() override; + void CleanupResources() override; CompositableHost* GetCompositableHost() override; - virtual void GenEffectChain(EffectChain& aEffect) override; + void GenEffectChain(EffectChain& aEffect) override; - virtual HostLayer* AsHostLayer() override { return this; } + HostLayer* AsHostLayer() override { return this; } - virtual const char* Name() const override { return "ImageLayerComposite"; } + const char* Name() const override { return "ImageLayerComposite"; } - virtual bool IsOpaque() override; + bool IsOpaque() override; - virtual nsIntRegion GetFullyRenderedRegion() override; + nsIntRegion GetFullyRenderedRegion() override; protected: - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; private: gfx::SamplingFilter GetSamplingFilter(); diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 7d74fdaaaa75..a648a15b0b44 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -78,30 +78,28 @@ static const int kVisualWarningDuration = 150; // ms class HostLayerManager : public LayerManager { public: HostLayerManager(); - ~HostLayerManager(); + virtual ~HostLayerManager(); - virtual bool BeginTransactionWithTarget(gfxContext* aTarget, - const nsCString& aURL) override { + bool BeginTransactionWithTarget(gfxContext* aTarget, + const nsCString& aURL) override { MOZ_CRASH("GFX: Use BeginTransactionWithDrawTarget"); } - virtual bool EndEmptyTransaction( - EndTransactionFlags aFlags = END_DEFAULT) override { + bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override { MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)"); return false; } - virtual void EndTransaction( - DrawPaintedLayerCallback aCallback, void* aCallbackData, - EndTransactionFlags aFlags = END_DEFAULT) override { + void EndTransaction(DrawPaintedLayerCallback aCallback, void* aCallbackData, + EndTransactionFlags aFlags = END_DEFAULT) override { MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)"); } - virtual int32_t GetMaxTextureSize() const override { + int32_t GetMaxTextureSize() const override { MOZ_CRASH("GFX: Call on compositor, not LayerManagerComposite"); } - virtual void GetBackendName(nsAString& name) override { + void GetBackendName(nsAString& name) override { MOZ_CRASH("GFX: Shouldn't be called for composited layer manager"); } @@ -119,7 +117,7 @@ class HostLayerManager : public LayerManager { virtual void SetDiagnosticTypes(DiagnosticTypes aDiagnostics) {} virtual void InvalidateAll() = 0; - virtual HostLayerManager* AsHostLayerManager() override { return this; } + HostLayerManager* AsHostLayerManager() override { return this; } virtual LayerManagerMLGPU* AsLayerManagerMLGPU() { return nullptr; } void ExtractImageCompositeNotifications( @@ -245,9 +243,9 @@ class LayerManagerComposite final : public HostLayerManager { public: explicit LayerManagerComposite(Compositor* aCompositor); - ~LayerManagerComposite(); + virtual ~LayerManagerComposite(); - virtual void Destroy() override; + void Destroy() override; /** * Sets the clipping region for this layer manager. This is important on @@ -265,13 +263,11 @@ class LayerManagerComposite final : public HostLayerManager { /** * LayerManager implementation. */ - virtual LayerManagerComposite* AsLayerManagerComposite() override { - return this; - } + LayerManagerComposite* AsLayerManagerComposite() override { return this; } void UpdateRenderBounds(const gfx::IntRect& aRect) override; - virtual bool BeginTransaction(const nsCString& aURL) override; + bool BeginTransaction(const nsCString& aURL) override; void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget, const gfx::IntRect& aRect) override; void EndTransaction(const TimeStamp& aTimeStamp, @@ -282,28 +278,28 @@ class LayerManagerComposite final : public HostLayerManager { MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)"); } - virtual void SetRoot(Layer* aLayer) override { mRoot = aLayer; } + void SetRoot(Layer* aLayer) override { mRoot = aLayer; } // XXX[nrc]: never called, we should move this logic to ClientLayerManager // (bug 946926). - virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override; + bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override; - virtual void ClearCachedResources(Layer* aSubtree = nullptr) override; + void ClearCachedResources(Layer* aSubtree = nullptr) override; - virtual already_AddRefed CreatePaintedLayer() override; - virtual already_AddRefed CreateContainerLayer() override; - virtual already_AddRefed CreateImageLayer() override; - virtual already_AddRefed CreateColorLayer() override; - virtual already_AddRefed CreateCanvasLayer() override; - virtual already_AddRefed CreateRefLayer() override; + already_AddRefed CreatePaintedLayer() override; + already_AddRefed CreateContainerLayer() override; + already_AddRefed CreateImageLayer() override; + already_AddRefed CreateColorLayer() override; + already_AddRefed CreateCanvasLayer() override; + already_AddRefed CreateRefLayer() override; - virtual bool AreComponentAlphaLayersEnabled() override; + bool AreComponentAlphaLayersEnabled() override; - virtual already_AddRefed CreateOptimalMaskDrawTarget( + already_AddRefed CreateOptimalMaskDrawTarget( const IntSize& aSize) override; - virtual const char* Name() const override { return ""; } - virtual bool IsCompositingToScreen() const override; + const char* Name() const override { return ""; } + bool IsCompositingToScreen() const override; bool AlwaysScheduleComposite() const override; @@ -378,18 +374,18 @@ class LayerManagerComposite final : public HostLayerManager { bool AsyncPanZoomEnabled() const override; public: - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override { + TextureFactoryIdentifier GetTextureFactoryIdentifier() override { return mCompositor->GetTextureFactoryIdentifier(); } - virtual LayersBackend GetBackendType() override { + LayersBackend GetBackendType() override { return mCompositor ? mCompositor->GetBackendType() : LayersBackend::LAYERS_NONE; } - virtual void SetDiagnosticTypes(DiagnosticTypes aDiagnostics) override { + void SetDiagnosticTypes(DiagnosticTypes aDiagnostics) override { mCompositor->SetDiagnosticTypes(aDiagnostics); } - virtual void InvalidateAll() override { + void InvalidateAll() override { AddInvalidRegion(nsIntRegion(mRenderBounds)); } @@ -497,7 +493,7 @@ class HostLayer { } HostLayerManager* GetLayerManager() const { return mCompositorManager; } - virtual ~HostLayer() {} + virtual ~HostLayer() = default; virtual LayerComposite* GetFirstChildComposite() { return nullptr; } @@ -596,9 +592,9 @@ class LayerComposite : public HostLayer { virtual ~LayerComposite(); - virtual void SetLayerManager(HostLayerManager* aManager) override; + void SetLayerManager(HostLayerManager* aManager) override; - virtual LayerComposite* GetFirstChildComposite() override { return nullptr; } + LayerComposite* GetFirstChildComposite() override { return nullptr; } /* Do NOT call this from the generic LayerComposite destructor. Only from the * concrete class destructor @@ -618,7 +614,7 @@ class LayerComposite : public HostLayer { virtual void RenderLayer(const gfx::IntRect& aClipRect, const Maybe& aGeometry) = 0; - virtual bool SetCompositableHost(CompositableHost*) override { + bool SetCompositableHost(CompositableHost*) override { // We must handle this gracefully, see bug 967824 NS_WARNING( "called SetCompositableHost for a layer type not accepting a " diff --git a/gfx/layers/composite/PaintedLayerComposite.h b/gfx/layers/composite/PaintedLayerComposite.h index 9d93d0cbadde..c2c22eb433ae 100644 --- a/gfx/layers/composite/PaintedLayerComposite.h +++ b/gfx/layers/composite/PaintedLayerComposite.h @@ -36,34 +36,34 @@ class PaintedLayerComposite : public PaintedLayer, public LayerComposite { virtual ~PaintedLayerComposite(); public: - virtual void Disconnect() override; + void Disconnect() override; CompositableHost* GetCompositableHost() override; - virtual void Destroy() override; + void Destroy() override; - virtual Layer* GetLayer() override; + Layer* GetLayer() override; - virtual void SetLayerManager(HostLayerManager* aManager) override; + void SetLayerManager(HostLayerManager* aManager) override; - virtual void RenderLayer(const gfx::IntRect& aClipRect, - const Maybe& aGeometry) override; + void RenderLayer(const gfx::IntRect& aClipRect, + const Maybe& aGeometry) override; - virtual void CleanupResources() override; + void CleanupResources() override; - virtual bool IsOpaque() override; + bool IsOpaque() override; - virtual void GenEffectChain(EffectChain& aEffect) override; + void GenEffectChain(EffectChain& aEffect) override; - virtual bool SetCompositableHost(CompositableHost* aHost) override; + bool SetCompositableHost(CompositableHost* aHost) override; - virtual HostLayer* AsHostLayer() override { return this; } + HostLayer* AsHostLayer() override { return this; } - virtual void InvalidateRegion(const nsIntRegion& aRegion) override { + void InvalidateRegion(const nsIntRegion& aRegion) override { MOZ_CRASH("PaintedLayerComposites can't fill invalidated regions"); } - const virtual gfx::TiledIntRegion& GetInvalidRegion() override; + const gfx::TiledIntRegion& GetInvalidRegion() override; MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_PAINTED) diff --git a/gfx/layers/composite/TextRenderer.h b/gfx/layers/composite/TextRenderer.h index 6a3e78e456e1..035b4cbc3058 100644 --- a/gfx/layers/composite/TextRenderer.h +++ b/gfx/layers/composite/TextRenderer.h @@ -21,7 +21,7 @@ class TextureSource; class TextureSourceProvider; struct FontBitmapInfo; -class TextRenderer { +class TextRenderer final { ~TextRenderer(); public: @@ -29,7 +29,7 @@ class TextRenderer { enum class FontType { Default, FixedWidth, NumTypes }; - explicit TextRenderer() {} + TextRenderer() = default; RefPtr RenderText(TextureSourceProvider* aProvider, const std::string& aText, uint32_t aTextSize, diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 2e77e058f451..98d789a6b6a2 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -75,10 +75,10 @@ namespace layers { */ class TextureParent : public ParentActor { public: - explicit TextureParent(HostIPCAllocator* aAllocator, uint64_t aSerial, - const wr::MaybeExternalImageId& aExternalImageId); + TextureParent(HostIPCAllocator* aAllocator, uint64_t aSerial, + const wr::MaybeExternalImageId& aExternalImageId); - ~TextureParent(); + virtual ~TextureParent(); bool Init(const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock, @@ -86,12 +86,12 @@ class TextureParent : public ParentActor { void NotifyNotUsed(uint64_t aTransactionId); - virtual mozilla::ipc::IPCResult RecvRecycleTexture( + mozilla::ipc::IPCResult RecvRecycleTexture( const TextureFlags& aTextureFlags) final; TextureHost* GetTextureHost() { return mTextureHost; } - virtual void Destroy() override; + void Destroy() override; uint64_t GetSerial() const { return mSerial; } @@ -450,12 +450,6 @@ void TextureHost::Updated(const nsIntRegion* aRegion) { TextureSource::TextureSource() : mCompositableCount(0) {} TextureSource::~TextureSource() {} - -const char* TextureSource::Name() const { - MOZ_CRASH("GFX: TextureSource without class name"); - return "TextureSource"; -} - BufferTextureHost::BufferTextureHost(const BufferDescriptor& aDesc, TextureFlags aFlags) : TextureHost(aFlags), diff --git a/gfx/layers/composite/TextureHost.h b/gfx/layers/composite/TextureHost.h index 6f75e2332ac8..a0790f875042 100644 --- a/gfx/layers/composite/TextureHost.h +++ b/gfx/layers/composite/TextureHost.h @@ -289,9 +289,9 @@ class DataTextureSource : public TextureSource { public: DataTextureSource() : mOwner(0), mUpdateSerial(0) {} - virtual const char* Name() const override { return "DataTextureSource"; } + const char* Name() const override { return "DataTextureSource"; } - virtual DataTextureSource* AsDataTextureSource() override { return this; } + DataTextureSource* AsDataTextureSource() override { return this; } /** * Upload a (portion of) surface to the TextureSource. @@ -316,7 +316,7 @@ class DataTextureSource : public TextureSource { // By default at least set the update serial to zero. // overloaded versions should do that too. - virtual void DeallocateDeviceData() override { SetUpdateSerial(0); } + void DeallocateDeviceData() override { SetUpdateSerial(0); } #ifdef DEBUG /** @@ -720,30 +720,26 @@ class BufferTextureHost : public TextureHost { public: BufferTextureHost(const BufferDescriptor& aDescriptor, TextureFlags aFlags); - ~BufferTextureHost(); + virtual ~BufferTextureHost(); virtual uint8_t* GetBuffer() = 0; virtual size_t GetBufferSize() = 0; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual void PrepareTextureSource( - CompositableTextureSourceRef& aTexture) override; + void PrepareTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override; - virtual bool AcquireTextureSource( - CompositableTextureSourceRef& aTexture) override; + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; + bool AcquireTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual void UnbindTextureSource() override; + void UnbindTextureSource() override; - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; /** * Return the format that is exposed to the compositor when calling @@ -752,42 +748,39 @@ class BufferTextureHost : public TextureHost { * If the shared format is YCbCr and the compositor does not support it, * GetFormat will be RGB32 (even though mFormat is SurfaceFormat::YUV). */ - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual gfx::YUVColorSpace GetYUVColorSpace() const override; + gfx::YUVColorSpace GetYUVColorSpace() const override; - virtual gfx::ColorDepth GetColorDepth() const override; + gfx::ColorDepth GetColorDepth() const override; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; - virtual bool HasIntermediateBuffer() const override { - return mHasIntermediateBuffer; - } + bool HasIntermediateBuffer() const override { return mHasIntermediateBuffer; } - virtual BufferTextureHost* AsBufferTextureHost() override { return this; } + BufferTextureHost* AsBufferTextureHost() override { return this; } const BufferDescriptor& GetBufferDescriptor() const { return mDescriptor; } - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual uint32_t NumSubTextures() const override; + uint32_t NumSubTextures() const override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; - virtual void ReadUnlock() override; - virtual bool IsDirectMap() override { + void ReadUnlock() override; + bool IsDirectMap() override { return mFirstSource && mFirstSource->IsDirectMap(); }; @@ -799,8 +792,8 @@ class BufferTextureHost : public TextureHost { bool MaybeUpload(nsIntRegion* aRegion); bool EnsureWrappingTextureSource(); - virtual void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; - virtual void MaybeNotifyUnlocked() override; + void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; + void MaybeNotifyUnlocked() override; BufferDescriptor mDescriptor; RefPtr mCompositor; @@ -831,17 +824,17 @@ class ShmemTextureHost : public BufferTextureHost { ~ShmemTextureHost(); public: - virtual void DeallocateSharedData() override; + void DeallocateSharedData() override; - virtual void ForgetSharedData() override; + void ForgetSharedData() override; - virtual uint8_t* GetBuffer() override; + uint8_t* GetBuffer() override; - virtual size_t GetBufferSize() override; + size_t GetBufferSize() override; - virtual const char* Name() override { return "ShmemTextureHost"; } + const char* Name() override { return "ShmemTextureHost"; } - virtual void OnShutdown() override; + void OnShutdown() override; protected: UniquePtr mShmem; @@ -863,15 +856,15 @@ class MemoryTextureHost : public BufferTextureHost { ~MemoryTextureHost(); public: - virtual void DeallocateSharedData() override; + void DeallocateSharedData() override; - virtual void ForgetSharedData() override; + void ForgetSharedData() override; - virtual uint8_t* GetBuffer() override; + uint8_t* GetBuffer() override; - virtual size_t GetBufferSize() override; + size_t GetBufferSize() override; - virtual const char* Name() override { return "MemoryTextureHost"; } + const char* Name() override { return "MemoryTextureHost"; } protected: uint8_t* mBuffer; @@ -929,11 +922,9 @@ class CompositingRenderTarget : public TextureSource { mZFar(0), mHasComplexProjection(false), mEnableDepthBuffer(false) {} - virtual ~CompositingRenderTarget() {} + virtual ~CompositingRenderTarget() = default; - virtual const char* Name() const override { - return "CompositingRenderTarget"; - } + const char* Name() const override { return "CompositingRenderTarget"; } #ifdef MOZ_DUMP_PAINTING virtual already_AddRefed Dump( diff --git a/gfx/layers/composite/TiledContentHost.h b/gfx/layers/composite/TiledContentHost.h index 120456624f23..a411efdd199f 100644 --- a/gfx/layers/composite/TiledContentHost.h +++ b/gfx/layers/composite/TiledContentHost.h @@ -170,7 +170,7 @@ class TiledContentHost : public ContentHost { explicit TiledContentHost(const TextureInfo& aTextureInfo); protected: - ~TiledContentHost(); + virtual ~TiledContentHost(); public: // Generate effect for layerscope when using hwc. @@ -192,8 +192,7 @@ class TiledContentHost : public ContentHost { return mTiledBuffer.GetValidRegion(); } - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override { + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override { CompositableHost::SetTextureSourceProvider(aProvider); mTiledBuffer.SetTextureSourceProvider(aProvider); mLowPrecisionTiledBuffer.SetTextureSourceProvider(aProvider); @@ -202,33 +201,31 @@ class TiledContentHost : public ContentHost { bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator, const SurfaceDescriptorTiles& aTiledDescriptor); - virtual void Composite( - Compositor* aCompositor, LayerComposite* aLayer, - EffectChain& aEffectChain, float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::SamplingFilter aSamplingFilter, const gfx::IntRect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - const Maybe& aGeometry = Nothing()) override; + void Composite(Compositor* aCompositor, LayerComposite* aLayer, + EffectChain& aEffectChain, float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::SamplingFilter aSamplingFilter, + const gfx::IntRect& aClipRect, + const nsIntRegion* aVisibleRegion = nullptr, + const Maybe& aGeometry = Nothing()) override; - virtual CompositableType GetType() override { + CompositableType GetType() override { return CompositableType::CONTENT_TILED; } - virtual TiledContentHost* AsTiledContentHost() override { return this; } + TiledContentHost* AsTiledContentHost() override { return this; } - virtual void Attach(Layer* aLayer, TextureSourceProvider* aProvider, - AttachFlags aFlags = NO_FLAGS) override; + void Attach(Layer* aLayer, TextureSourceProvider* aProvider, + AttachFlags aFlags = NO_FLAGS) override; - virtual void Detach(Layer* aLayer = nullptr, - AttachFlags aFlags = NO_FLAGS) override; + void Detach(Layer* aLayer = nullptr, AttachFlags aFlags = NO_FLAGS) override; - virtual void Dump(std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false) override; + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false) override; - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void AddAnimationInvalidation(nsIntRegion& aRegion) override; + void AddAnimationInvalidation(nsIntRegion& aRegion) override; TiledLayerBufferComposite& GetLowResBuffer() { return mLowPrecisionTiledBuffer; diff --git a/gfx/layers/composite/X11TextureHost.h b/gfx/layers/composite/X11TextureHost.h index 70b5e423ca51..568e136ff180 100644 --- a/gfx/layers/composite/X11TextureHost.h +++ b/gfx/layers/composite/X11TextureHost.h @@ -22,7 +22,7 @@ class X11TextureSource : public TextureSource { // Useful for determining whether to rebind a GLXPixmap to a texture. virtual void Updated() = 0; - virtual const char* Name() const override { return "X11TextureSource"; } + const char* Name() const override { return "X11TextureSource"; } }; // TextureHost for Xlib-backed TextureSources. @@ -30,29 +30,27 @@ class X11TextureHost : public TextureHost { public: X11TextureHost(TextureFlags aFlags, const SurfaceDescriptorX11& aDescriptor); - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override { + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override { aTexture = mTextureSource; return !!aTexture; } - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; #ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "X11TextureHost"; } + const char* Name() override { return "X11TextureHost"; } #endif protected: - virtual void UpdatedInternal(const nsIntRegion*) override { + void UpdatedInternal(const nsIntRegion*) override { if (mTextureSource) mTextureSource->Updated(); } diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h index 27c3e67b13ec..68bf6c8d2ff7 100644 --- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -29,86 +29,85 @@ class CompositorD3D11 : public Compositor { public: CompositorD3D11(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget); - ~CompositorD3D11(); + virtual ~CompositorD3D11(); - virtual CompositorD3D11* AsCompositorD3D11() override { return this; } + CompositorD3D11* AsCompositorD3D11() override { return this; } - virtual bool Initialize(nsCString* const out_failureReason) override; + bool Initialize(nsCString* const out_failureReason) override; - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override; + TextureFactoryIdentifier GetTextureFactoryIdentifier() override; - virtual already_AddRefed CreateDataTextureSource( + already_AddRefed CreateDataTextureSource( TextureFlags aFlags = TextureFlags::NO_FLAGS) override; - virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override; + bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override; int32_t GetMaxTextureSize() const final; - virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) override {} + void MakeCurrent(MakeCurrentFlags aFlags = 0) override {} - virtual already_AddRefed CreateRenderTarget( + already_AddRefed CreateRenderTarget( const gfx::IntRect& aRect, SurfaceInitMode aInit) override; - virtual already_AddRefed - CreateRenderTargetFromSource(const gfx::IntRect& aRect, - const CompositingRenderTarget* aSource, - const gfx::IntPoint& aSourcePoint) override; + already_AddRefed CreateRenderTargetFromSource( + const gfx::IntRect& aRect, const CompositingRenderTarget* aSource, + const gfx::IntPoint& aSourcePoint) override; - virtual void SetRenderTarget(CompositingRenderTarget* aSurface) override; - virtual already_AddRefed GetCurrentRenderTarget() + void SetRenderTarget(CompositingRenderTarget* aSurface) override; + already_AddRefed GetCurrentRenderTarget() const override { return do_AddRef(mCurrentRT); } - virtual already_AddRefed GetWindowRenderTarget() + already_AddRefed GetWindowRenderTarget() const override; - virtual bool ReadbackRenderTarget(CompositingRenderTarget* aSource, - AsyncReadbackBuffer* aDest) override; - virtual already_AddRefed CreateAsyncReadbackBuffer( + bool ReadbackRenderTarget(CompositingRenderTarget* aSource, + AsyncReadbackBuffer* aDest) override; + already_AddRefed CreateAsyncReadbackBuffer( const gfx::IntSize& aSize) override; - virtual bool BlitRenderTarget(CompositingRenderTarget* aSource, - const gfx::IntSize& aSourceSize, - const gfx::IntSize& aDestSize) override; + bool BlitRenderTarget(CompositingRenderTarget* aSource, + const gfx::IntSize& aSourceSize, + const gfx::IntSize& aDestSize) override; - virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override {} + void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override {} /** * Declare an offset to use when rendering layers. This will be ignored when * rendering to a target instead of the screen. */ - virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) override { + void SetScreenRenderOffset(const ScreenPoint& aOffset) override { if (aOffset.x || aOffset.y) { MOZ_CRASH("SetScreenRenderOffset not supported by CompositorD3D11."); } // If the offset is 0, 0 that's okay. } - virtual void ClearRect(const gfx::Rect& aRect) override; + void ClearRect(const gfx::Rect& aRect) override; - virtual void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect, - const EffectChain& aEffectChain, gfx::Float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::Rect& aVisibleRect) override; + void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect, + const EffectChain& aEffectChain, gfx::Float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::Rect& aVisibleRect) override; /** * Start a new frame. If aClipRectIn is null, sets *aClipRectOut to the * screen dimensions. */ - virtual void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, - const gfx::IntRect& aRenderBounds, - const nsIntRegion& aOpaqueRegion, - gfx::IntRect* aClipRectOut = nullptr, - gfx::IntRect* aRenderBoundsOut = nullptr) override; + void BeginFrame(const nsIntRegion& aInvalidRegion, + const gfx::IntRect* aClipRectIn, + const gfx::IntRect& aRenderBounds, + const nsIntRegion& aOpaqueRegion, + gfx::IntRect* aClipRectOut = nullptr, + gfx::IntRect* aRenderBoundsOut = nullptr) override; void NormalDrawingDone() override; /** * Flush the current frame to the screen. */ - virtual void EndFrame() override; + void EndFrame() override; - virtual void CancelFrame(bool aNeedFlush = true) override; + void CancelFrame(bool aNeedFlush = true) override; /** * Setup the viewport and projection matrix for rendering @@ -119,15 +118,15 @@ class CompositorD3D11 : public Compositor { const gfx::Matrix4x4& aProjection, float aZNear, float aZFar); - virtual bool SupportsPartialTextureUpdate() override { return true; } + bool SupportsPartialTextureUpdate() override { return true; } - virtual bool SupportsLayerGeometry() const override; + bool SupportsLayerGeometry() const override; #ifdef MOZ_DUMP_PAINTING - virtual const char* Name() const override { return "Direct3D 11"; } + const char* Name() const override { return "Direct3D 11"; } #endif - virtual LayersBackend GetBackendType() const override { + LayersBackend GetBackendType() const override { return LayersBackend::LAYERS_D3D11; } @@ -170,13 +169,11 @@ class CompositorD3D11 : public Compositor { RefPtr* aOutTexture, RefPtr* aOutView); - virtual void DrawTriangles(const nsTArray& aTriangles, - const gfx::Rect& aRect, - const gfx::IntRect& aClipRect, - const EffectChain& aEffectChain, - gfx::Float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::Rect& aVisibleRect) override; + void DrawTriangles(const nsTArray& aTriangles, + const gfx::Rect& aRect, const gfx::IntRect& aClipRect, + const EffectChain& aEffectChain, gfx::Float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::Rect& aVisibleRect) override; template void DrawGeometry(const Geometry& aGeometry, const gfx::Rect& aRect, diff --git a/gfx/layers/d3d11/DeviceAttachmentsD3D11.h b/gfx/layers/d3d11/DeviceAttachmentsD3D11.h index 29fa1bd4d449..2d655ceb2fcd 100644 --- a/gfx/layers/d3d11/DeviceAttachmentsD3D11.h +++ b/gfx/layers/d3d11/DeviceAttachmentsD3D11.h @@ -20,7 +20,7 @@ namespace layers { struct ShaderBytes; -class DeviceAttachmentsD3D11 { +class DeviceAttachmentsD3D11 final { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DeviceAttachmentsD3D11); public: diff --git a/gfx/layers/d3d11/MLGDeviceD3D11.h b/gfx/layers/d3d11/MLGDeviceD3D11.h index d75d158ccc71..0aa49f780f3a 100644 --- a/gfx/layers/d3d11/MLGDeviceD3D11.h +++ b/gfx/layers/d3d11/MLGDeviceD3D11.h @@ -48,7 +48,7 @@ class MLGRenderTargetD3D11 final : public MLGRenderTarget { void ForgetTexture(); private: - ~MLGRenderTargetD3D11() override; + virtual ~MLGRenderTargetD3D11(); private: RefPtr mTexture; @@ -76,7 +76,7 @@ class MLGSwapChainD3D11 final : public MLGSwapChain { private: MLGSwapChainD3D11(MLGDeviceD3D11* aParent, ID3D11Device* aDevice); - ~MLGSwapChainD3D11() override; + virtual ~MLGSwapChainD3D11(); bool Initialize(widget::CompositorWidget* aWidget); void UpdateBackBufferContents(ID3D11Texture2D* aBack); @@ -112,7 +112,7 @@ class MLGBufferD3D11 final : public MLGBuffer, public MLGResourceD3D11 { protected: MLGBufferD3D11(ID3D11Buffer* aBuffer, MLGBufferType aType, size_t aSize); - ~MLGBufferD3D11() override; + virtual ~MLGBufferD3D11(); private: RefPtr mBuffer; @@ -144,7 +144,7 @@ class MLGTextureD3D11 final : public MLGTexture, public MLGResourceD3D11 { class MLGDeviceD3D11 final : public MLGDevice { public: explicit MLGDeviceD3D11(ID3D11Device* aDevice); - ~MLGDeviceD3D11() override; + virtual ~MLGDeviceD3D11(); bool Initialize() override; diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index 725304d224a3..cc29786f9582 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -29,7 +29,7 @@ already_AddRefed CreateTextureHostD3D11( const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, LayersBackend aBackend, TextureFlags aFlags); -class MOZ_RAII AutoTextureLock { +class MOZ_RAII AutoTextureLock final { public: AutoTextureLock(IDXGIKeyedMutex* aMutex, HRESULT& aResult, uint32_t aTimeout = 0); @@ -44,11 +44,11 @@ class CompositorD3D11; class DXGITextureData : public TextureData { public: - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; bool SerializeSpecific(SurfaceDescriptorD3D10* aOutDesc); - virtual bool Serialize(SurfaceDescriptor& aOutDescrptor) override; - virtual void GetSubDescriptor(GPUVideoSubDescriptor* aOutDesc) override; + bool Serialize(SurfaceDescriptor& aOutDescrptor) override; + void GetSubDescriptor(GPUVideoSubDescriptor* aOutDesc) override; static DXGITextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, TextureAllocationFlags aFlags); @@ -83,34 +83,34 @@ class D3D11TextureData : public DXGITextureData { TextureAllocationFlags aAllocFlags, ID3D11Device* aDevice = nullptr); - virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; + bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; - virtual bool Lock(OpenMode aMode) override; + bool Lock(OpenMode aMode) override; - virtual void Unlock() override; + void Unlock() override; - virtual already_AddRefed BorrowDrawTarget() override; + already_AddRefed BorrowDrawTarget() override; - virtual TextureData* CreateSimilar( - LayersIPCChannel* aAllocator, LayersBackend aLayersBackend, - TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const override; + TextureData* CreateSimilar(LayersIPCChannel* aAllocator, + LayersBackend aLayersBackend, TextureFlags aFlags, + TextureAllocationFlags aAllocFlags) const override; - virtual void SyncWithObject(SyncObjectClient* aSyncObject) override; + void SyncWithObject(SyncObjectClient* aSyncObject) override; ID3D11Texture2D* GetD3D11Texture() { return mTexture; } - virtual void Deallocate(LayersIPCChannel* aAllocator) override; + void Deallocate(LayersIPCChannel* aAllocator) override; D3D11TextureData* AsD3D11TextureData() override { return this; } - ~D3D11TextureData(); + virtual ~D3D11TextureData(); protected: D3D11TextureData(ID3D11Texture2D* aTexture, gfx::IntSize aSize, gfx::SurfaceFormat aFormat, bool aNeedsClear, bool aNeedsClearWhite, bool aIsForOutOfBandContent); - virtual void GetDXGIResource(IDXGIResource** aOutResource) override; + void GetDXGIResource(IDXGIResource** aOutResource) override; static DXGITextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, gfx::SourceSurface* aSurface, @@ -142,25 +142,25 @@ class DXGIYCbCrTextureData : public TextureData { const gfx::IntSize& aSizeY, const gfx::IntSize& aSizeCbCr, gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace); - virtual bool Lock(OpenMode) override { return true; } + bool Lock(OpenMode) override { return true; } - virtual void Unlock() override {} + void Unlock() override {} - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; void SerializeSpecific(SurfaceDescriptorDXGIYCbCr* aOutDesc); - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - virtual void GetSubDescriptor(GPUVideoSubDescriptor* aOutDesc) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + void GetSubDescriptor(GPUVideoSubDescriptor* aOutDesc) override; - virtual already_AddRefed BorrowDrawTarget() override { + already_AddRefed BorrowDrawTarget() override { return nullptr; } - virtual void Deallocate(LayersIPCChannel* aAllocator) override; + void Deallocate(LayersIPCChannel* aAllocator) override; - virtual bool UpdateFromSurface(gfx::SourceSurface*) override { return false; } + bool UpdateFromSurface(gfx::SourceSurface*) override { return false; } - virtual TextureFlags GetTextureFlags() const override { + TextureFlags GetTextureFlags() const override { return TextureFlags::DEALLOCATE_MAIN_THREAD; } @@ -196,7 +196,7 @@ class DXGIYCbCrTextureData : public TextureData { class TextureSourceD3D11 { public: TextureSourceD3D11() : mFormatOverride(DXGI_FORMAT_UNKNOWN) {} - virtual ~TextureSourceD3D11() {} + virtual ~TextureSourceD3D11() = default; virtual ID3D11Texture2D* GetD3D11Texture() const { return mTexture; } virtual ID3D11ShaderResourceView* GetShaderResourceView(); @@ -240,50 +240,48 @@ class DataTextureSourceD3D11 : public DataTextureSource, virtual ~DataTextureSourceD3D11(); - virtual const char* Name() const override { return "DataTextureSourceD3D11"; } + const char* Name() const override { return "DataTextureSourceD3D11"; } // DataTextureSource - virtual bool Update(gfx::DataSourceSurface* aSurface, - nsIntRegion* aDestRegion = nullptr, - gfx::IntPoint* aSrcOffset = nullptr) override; + bool Update(gfx::DataSourceSurface* aSurface, + nsIntRegion* aDestRegion = nullptr, + gfx::IntPoint* aSrcOffset = nullptr) override; // TextureSource - virtual TextureSourceD3D11* AsSourceD3D11() override { return this; } + TextureSourceD3D11* AsSourceD3D11() override { return this; } - virtual ID3D11Texture2D* GetD3D11Texture() const override; + ID3D11Texture2D* GetD3D11Texture() const override; - virtual ID3D11ShaderResourceView* GetShaderResourceView() override; + ID3D11ShaderResourceView* GetShaderResourceView() override; // Returns nullptr if this texture was created by a DXGI TextureHost. - virtual DataTextureSource* AsDataTextureSource() override { + DataTextureSource* AsDataTextureSource() override { return mAllowTextureUploads ? this : nullptr; } - virtual void DeallocateDeviceData() override { mTexture = nullptr; } + void DeallocateDeviceData() override { mTexture = nullptr; } - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; } + gfx::SurfaceFormat GetFormat() const override { return mFormat; } // BigImageIterator - virtual BigImageIterator* AsBigImageIterator() override { + BigImageIterator* AsBigImageIterator() override { return mIsTiled ? this : nullptr; } - virtual size_t GetTileCount() override { return mTileTextures.size(); } + size_t GetTileCount() override { return mTileTextures.size(); } - virtual bool NextTile() override { - return (++mCurrentTile < mTileTextures.size()); - } + bool NextTile() override { return (++mCurrentTile < mTileTextures.size()); } - virtual gfx::IntRect GetTileRect() override; + gfx::IntRect GetTileRect() override; - virtual void EndBigImageIteration() override { mIterating = false; } + void EndBigImageIteration() override { mIterating = false; } - virtual void BeginBigImageIteration() override { + void BeginBigImageIteration() override { mIterating = true; mCurrentTile = 0; } @@ -325,45 +323,41 @@ class DXGITextureHostD3D11 : public TextureHost { DXGITextureHostD3D11(TextureFlags aFlags, const SurfaceDescriptorD3D10& aDescriptor); - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override; - virtual bool AcquireTextureSource( - CompositableTextureSourceRef& aTexture) override; + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; + bool AcquireTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; } + gfx::SurfaceFormat GetFormat() const override { return mFormat; } - virtual bool Lock() override; - virtual void Unlock() override; + bool Lock() override; + void Unlock() override; - virtual bool LockWithoutCompositor() override; - virtual void UnlockWithoutCompositor() override; + bool LockWithoutCompositor() override; + void UnlockWithoutCompositor() override; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual uint32_t NumSubTextures() const override; + uint32_t NumSubTextures() const override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; - virtual bool SupportsWrNativeTexture() override { return true; } + bool SupportsWrNativeTexture() override { return true; } protected: bool LockInternal(); @@ -389,53 +383,49 @@ class DXGIYCbCrTextureHostD3D11 : public TextureHost { DXGIYCbCrTextureHostD3D11(TextureFlags aFlags, const SurfaceDescriptorDXGIYCbCr& aDescriptor); - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override; - virtual bool AcquireTextureSource( - CompositableTextureSourceRef& aTexture) override; + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; + bool AcquireTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual gfx::SurfaceFormat GetFormat() const override { + gfx::SurfaceFormat GetFormat() const override { return gfx::SurfaceFormat::YUV; } - virtual gfx::ColorDepth GetColorDepth() const override { return mColorDepth; } + gfx::ColorDepth GetColorDepth() const override { return mColorDepth; } - virtual gfx::YUVColorSpace GetYUVColorSpace() const override { + gfx::YUVColorSpace GetYUVColorSpace() const override { return mYUVColorSpace; } - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; } - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual uint32_t NumSubTextures() const override; + uint32_t NumSubTextures() const override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; - virtual bool SupportsWrNativeTexture() override { return true; } + bool SupportsWrNativeTexture() override { return true; } private: bool EnsureTextureSource(); @@ -463,15 +453,13 @@ class CompositingRenderTargetD3D11 : public CompositingRenderTarget, ID3D11Texture2D* aTexture, const gfx::IntPoint& aOrigin, DXGI_FORMAT aFormatOverride = DXGI_FORMAT_UNKNOWN); - virtual const char* Name() const override { - return "CompositingRenderTargetD3D11"; - } + const char* Name() const override { return "CompositingRenderTargetD3D11"; } - virtual TextureSourceD3D11* AsSourceD3D11() override { return this; } + TextureSourceD3D11* AsSourceD3D11() override { return this; } void BindRenderTarget(ID3D11DeviceContext* aContext); - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; void SetSize(const gfx::IntSize& aSize) { mSize = aSize; } @@ -484,16 +472,16 @@ class SyncObjectD3D11Host : public SyncObjectHost { public: explicit SyncObjectD3D11Host(ID3D11Device* aDevice); - virtual bool Init() override; + bool Init() override; - virtual SyncHandle GetSyncHandle() override; + SyncHandle GetSyncHandle() override; - virtual bool Synchronize(bool aFallible) override; + bool Synchronize(bool aFallible) override; IDXGIKeyedMutex* GetKeyedMutex() { return mKeyedMutex.get(); }; private: - virtual ~SyncObjectD3D11Host() {} + virtual ~SyncObjectD3D11Host() = default; SyncHandle mSyncHandle; RefPtr mDevice; @@ -503,13 +491,13 @@ class SyncObjectD3D11Host : public SyncObjectHost { class SyncObjectD3D11Client : public SyncObjectClient { public: - explicit SyncObjectD3D11Client(SyncHandle aSyncHandle, ID3D11Device* aDevice); + SyncObjectD3D11Client(SyncHandle aSyncHandle, ID3D11Device* aDevice); - virtual bool Synchronize(bool aFallible) override; + bool Synchronize(bool aFallible) override; - virtual bool IsSyncObjectValid() override; + bool IsSyncObjectValid() override; - virtual SyncType GetSyncType() override { return SyncType::D3D11; } + SyncType GetSyncType() override { return SyncType::D3D11; } void RegisterTexture(ID3D11Texture2D* aTexture); diff --git a/gfx/layers/ipc/APZChild.h b/gfx/layers/ipc/APZChild.h index e9ce16e5ed22..a6f40a52129c 100644 --- a/gfx/layers/ipc/APZChild.h +++ b/gfx/layers/ipc/APZChild.h @@ -22,7 +22,7 @@ class GeckoContentController; class APZChild final : public PAPZChild { public: explicit APZChild(RefPtr aController); - ~APZChild(); + virtual ~APZChild(); mozilla::ipc::IPCResult RecvLayerTransforms( const nsTArray& aTransforms); diff --git a/gfx/layers/ipc/CompositorBench.cpp b/gfx/layers/ipc/CompositorBench.cpp index f9ec40694537..a9b9c6dcf10a 100644 --- a/gfx/layers/ipc/CompositorBench.cpp +++ b/gfx/layers/ipc/CompositorBench.cpp @@ -33,7 +33,7 @@ class BenchTest { public: BenchTest(const char* aTestName) : mTestName(aTestName) {} - virtual ~BenchTest() {} + virtual ~BenchTest() = default; virtual void Setup(Compositor* aCompositor, size_t aStep) {} virtual void Teardown(Compositor* aCompositor) {} diff --git a/gfx/layers/ipc/CompositorBridgeChild.h b/gfx/layers/ipc/CompositorBridgeChild.h index 94b39a70fd41..a695ae656674 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.h +++ b/gfx/layers/ipc/CompositorBridgeChild.h @@ -115,11 +115,12 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, mozilla::ipc::IPCResult RecvParentAsyncMessages( InfallibleTArray&& aMessages); - virtual PTextureChild* CreateTexture( - const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock, - LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial, - wr::MaybeExternalImageId& aExternalImageId, - nsIEventTarget* aTarget) override; + PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData, + const ReadLockDescriptor& aReadLock, + LayersBackend aLayersBackend, + TextureFlags aFlags, uint64_t aSerial, + wr::MaybeExternalImageId& aExternalImageId, + nsIEventTarget* aTarget) override; /** * Request that the parent tell us when graphics are ready on GPU. @@ -155,7 +156,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, bool SendAllPluginsCaptured(); bool IsSameProcess() const override; - virtual bool IPCOpen() const override { return mCanSend; } + bool IPCOpen() const override { return mCanSend; } static void ShutDown(); @@ -175,28 +176,28 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, */ void NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId); - virtual void CancelWaitForRecycle(uint64_t aTextureId) override; + void CancelWaitForRecycle(uint64_t aTextureId) override; TextureClientPool* GetTexturePool(KnowsCompositor* aAllocator, gfx::SurfaceFormat aFormat, TextureFlags aFlags); void ClearTexturePool(); - virtual FixedSizeSmallShmemSectionAllocator* GetTileLockAllocator() override; + FixedSizeSmallShmemSectionAllocator* GetTileLockAllocator() override; void HandleMemoryPressure(); - virtual MessageLoop* GetMessageLoop() const override { return mMessageLoop; } + MessageLoop* GetMessageLoop() const override { return mMessageLoop; } - virtual base::ProcessId GetParentPid() const override { return OtherPid(); } + base::ProcessId GetParentPid() const override { return OtherPid(); } - virtual bool AllocUnsafeShmem( - size_t aSize, mozilla::ipc::SharedMemory::SharedMemoryType aShmType, - mozilla::ipc::Shmem* aShmem) override; - virtual bool AllocShmem(size_t aSize, - mozilla::ipc::SharedMemory::SharedMemoryType aShmType, - mozilla::ipc::Shmem* aShmem) override; - virtual bool DeallocShmem(mozilla::ipc::Shmem& aShmem) override; + bool AllocUnsafeShmem(size_t aSize, + mozilla::ipc::SharedMemory::SharedMemoryType aShmType, + mozilla::ipc::Shmem* aShmem) override; + bool AllocShmem(size_t aSize, + mozilla::ipc::SharedMemory::SharedMemoryType aShmType, + mozilla::ipc::Shmem* aShmem) override; + bool DeallocShmem(mozilla::ipc::Shmem& aShmem) override; PCompositorWidgetChild* AllocPCompositorWidgetChild( const CompositorWidgetInitData& aInitData); @@ -265,7 +266,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, bool DeallocPLayerTransactionChild(PLayerTransactionChild* aChild); - virtual void ActorDestroy(ActorDestroyReason aWhy) override; + void ActorDestroy(ActorDestroyReason aWhy) override; mozilla::ipc::IPCResult RecvSharedCompositorFrameMetrics( const mozilla::ipc::SharedMemoryBasic::Handle& metrics, @@ -290,7 +291,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild, // Class used to store the shared FrameMetrics, mutex, and APZCId in a hash // table - class SharedFrameMetricsData { + class SharedFrameMetricsData final { public: SharedFrameMetricsData( const mozilla::ipc::SharedMemoryBasic::Handle& metrics, diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index fd6a5230cd7b..944bb55cabdf 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -198,7 +198,7 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent, virtual void AccumulateMemoryReport(wr::MemoryReport*) {} protected: - ~CompositorBridgeParentBase() override; + virtual ~CompositorBridgeParentBase(); virtual PAPZParent* AllocPAPZParent(const LayersId& layersId) = 0; virtual bool DeallocPAPZParent(PAPZParent* aActor) = 0; @@ -351,8 +351,8 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase, const TimeStamp& aRecordingStart) override; mozilla::ipc::IPCResult RecvEndRecording() override; - virtual void NotifyMemoryPressure() override; - virtual void AccumulateMemoryReport(wr::MemoryReport*) override; + void NotifyMemoryPressure() override; + void AccumulateMemoryReport(wr::MemoryReport*) override; void ActorDestroy(ActorDestroyReason why) override; diff --git a/gfx/layers/ipc/CompositorManagerChild.h b/gfx/layers/ipc/CompositorManagerChild.h index 20596fcee5a1..4b33353bd3a7 100644 --- a/gfx/layers/ipc/CompositorManagerChild.h +++ b/gfx/layers/ipc/CompositorManagerChild.h @@ -92,7 +92,7 @@ class CompositorManagerChild : public PCompositorManagerChild { CompositorManagerChild(Endpoint&& aEndpoint, uint64_t aProcessToken, uint32_t aNamespace); - ~CompositorManagerChild() override {} + virtual ~CompositorManagerChild() = default; void DeallocPCompositorManagerChild() override; diff --git a/gfx/layers/ipc/CompositorManagerParent.h b/gfx/layers/ipc/CompositorManagerParent.h index e925e8c918f7..1772ecd503eb 100644 --- a/gfx/layers/ipc/CompositorManagerParent.h +++ b/gfx/layers/ipc/CompositorManagerParent.h @@ -67,7 +67,7 @@ class CompositorManagerParent final : public PCompositorManagerParent { #endif CompositorManagerParent(); - ~CompositorManagerParent() override; + virtual ~CompositorManagerParent(); void Bind(Endpoint&& aEndpoint); diff --git a/gfx/layers/ipc/CompositorVsyncScheduler.h b/gfx/layers/ipc/CompositorVsyncScheduler.h index 814979cc8823..1de0d50df167 100644 --- a/gfx/layers/ipc/CompositorVsyncScheduler.h +++ b/gfx/layers/ipc/CompositorVsyncScheduler.h @@ -40,9 +40,8 @@ class CompositorVsyncScheduler { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorVsyncScheduler) public: - explicit CompositorVsyncScheduler( - CompositorVsyncSchedulerOwner* aVsyncSchedulerOwner, - widget::CompositorWidget* aWidget); + CompositorVsyncScheduler(CompositorVsyncSchedulerOwner* aVsyncSchedulerOwner, + widget::CompositorWidget* aWidget); /** * Notify this class of a vsync. This will trigger a composite if one is @@ -133,7 +132,7 @@ class CompositorVsyncScheduler { class Observer final : public VsyncObserver { public: explicit Observer(CompositorVsyncScheduler* aOwner); - virtual bool NotifyVsync(const VsyncEvent& aVsync) override; + bool NotifyVsync(const VsyncEvent& aVsync) override; void Destroy(); private: diff --git a/gfx/layers/ipc/ISurfaceAllocator.h b/gfx/layers/ipc/ISurfaceAllocator.h index 285c4bf2277f..27411f3556df 100644 --- a/gfx/layers/ipc/ISurfaceAllocator.h +++ b/gfx/layers/ipc/ISurfaceAllocator.h @@ -108,7 +108,7 @@ class ISurfaceAllocator { protected: void Finalize() {} - virtual ~ISurfaceAllocator() {} + virtual ~ISurfaceAllocator() = default; }; /// Methods that are specific to the client/child side. @@ -116,7 +116,7 @@ class ClientIPCAllocator : public ISurfaceAllocator { public: ClientIPCAllocator() {} - virtual ClientIPCAllocator* AsClientAllocator() override { return this; } + ClientIPCAllocator* AsClientAllocator() override { return this; } virtual base::ProcessId GetParentPid() const = 0; @@ -130,7 +130,7 @@ class HostIPCAllocator : public ISurfaceAllocator { public: HostIPCAllocator() {} - virtual HostIPCAllocator* AsHostIPCAllocator() override { return this; } + HostIPCAllocator* AsHostIPCAllocator() override { return this; } /** * Get child side's process Id. @@ -280,12 +280,11 @@ class FixedSizeSmallShmemSectionAllocator final : public ShmemSectionAllocator { ~FixedSizeSmallShmemSectionAllocator(); - virtual bool AllocShmemSection(uint32_t aSize, - ShmemSection* aShmemSection) override; + bool AllocShmemSection(uint32_t aSize, ShmemSection* aShmemSection) override; - virtual void DeallocShmemSection(ShmemSection& aShmemSection) override; + void DeallocShmemSection(ShmemSection& aShmemSection) override; - virtual void MemoryPressure() override { ShrinkShmemSectionHeap(); } + void MemoryPressure() override { ShrinkShmemSectionHeap(); } // can be called on the compositor process. static void FreeShmemSection(ShmemSection& aShmemSection); diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index 43de28456b40..26a3ce585a20 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -91,7 +91,7 @@ struct CompositableTransaction { bool mFinished; }; -struct AutoEndTransaction { +struct AutoEndTransaction final { explicit AutoEndTransaction(CompositableTransaction* aTxn) : mTxn(aTxn) {} ~AutoEndTransaction() { mTxn->End(); } CompositableTransaction* mTxn; diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index a8685d9a14a3..f9e6a60d75ee 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -175,9 +175,9 @@ class ImageBridgeChild final : public PImageBridgeChild, * * Can be called from any thread. */ - virtual MessageLoop* GetMessageLoop() const override; + MessageLoop* GetMessageLoop() const override; - virtual base::ProcessId GetParentPid() const override { return OtherPid(); } + base::ProcessId GetParentPid() const override { return OtherPid(); } PTextureChild* AllocPTextureChild( const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock, @@ -218,14 +218,14 @@ class ImageBridgeChild final : public PImageBridgeChild, */ void FlushAllImages(ImageClient* aClient, ImageContainer* aContainer); - virtual bool IPCOpen() const override { return mCanSend; } + bool IPCOpen() const override { return mCanSend; } private: /** * This must be called by the static function DeleteImageBridgeSync defined * in ImageBridgeChild.cpp ONLY. */ - ~ImageBridgeChild(); + virtual ~ImageBridgeChild(); // Helpers for dispatching. already_AddRefed CreateCanvasClientNow( @@ -257,20 +257,20 @@ class ImageBridgeChild final : public PImageBridgeChild, public: // CompositableForwarder - virtual void Connect(CompositableClient* aCompositable, - ImageContainer* aImageContainer) override; + void Connect(CompositableClient* aCompositable, + ImageContainer* aImageContainer) override; - virtual bool UsesImageBridge() const override { return true; } + bool UsesImageBridge() const override { return true; } /** * See CompositableForwarder::UseTextures */ - virtual void UseTextures(CompositableClient* aCompositable, - const nsTArray& aTextures, - const Maybe& aRenderRoot) override; - virtual void UseComponentAlphaTextures( - CompositableClient* aCompositable, TextureClient* aClientOnBlack, - TextureClient* aClientOnWhite) override; + void UseTextures(CompositableClient* aCompositable, + const nsTArray& aTextures, + const Maybe& aRenderRoot) override; + void UseComponentAlphaTextures(CompositableClient* aCompositable, + TextureClient* aClientOnBlack, + TextureClient* aClientOnWhite) override; void ReleaseCompositable(const CompositableHandle& aHandle) override; @@ -289,24 +289,24 @@ class ImageBridgeChild final : public PImageBridgeChild, */ void NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId); - virtual void CancelWaitForRecycle(uint64_t aTextureId) override; + void CancelWaitForRecycle(uint64_t aTextureId) override; - virtual bool DestroyInTransaction(PTextureChild* aTexture) override; + bool DestroyInTransaction(PTextureChild* aTexture) override; bool DestroyInTransaction(const CompositableHandle& aHandle); - virtual void RemoveTextureFromCompositable( + void RemoveTextureFromCompositable( CompositableClient* aCompositable, TextureClient* aTexture, const Maybe& aRenderRoot) override; - virtual void UseTiledLayerBuffer( + void UseTiledLayerBuffer( CompositableClient* aCompositable, const SurfaceDescriptorTiles& aTileLayerDescriptor) override { MOZ_CRASH("should not be called"); } - virtual void UpdateTextureRegion(CompositableClient* aCompositable, - const ThebesBufferData& aThebesBufferData, - const nsIntRegion& aUpdatedRegion) override { + void UpdateTextureRegion(CompositableClient* aCompositable, + const ThebesBufferData& aThebesBufferData, + const nsIntRegion& aUpdatedRegion) override { MOZ_CRASH("should not be called"); } @@ -318,12 +318,12 @@ class ImageBridgeChild final : public PImageBridgeChild, * If used outside the ImageBridgeChild thread, it will proxy a synchronous * call on the ImageBridgeChild thread. */ - virtual bool AllocUnsafeShmem( - size_t aSize, mozilla::ipc::SharedMemory::SharedMemoryType aShmType, - mozilla::ipc::Shmem* aShmem) override; - virtual bool AllocShmem(size_t aSize, - mozilla::ipc::SharedMemory::SharedMemoryType aShmType, - mozilla::ipc::Shmem* aShmem) override; + bool AllocUnsafeShmem(size_t aSize, + mozilla::ipc::SharedMemory::SharedMemoryType aShmType, + mozilla::ipc::Shmem* aShmem) override; + bool AllocShmem(size_t aSize, + mozilla::ipc::SharedMemory::SharedMemoryType aShmType, + mozilla::ipc::Shmem* aShmem) override; /** * See ISurfaceAllocator.h @@ -331,24 +331,25 @@ class ImageBridgeChild final : public PImageBridgeChild, * If used outside the ImageBridgeChild thread, it will proxy a synchronous * call on the ImageBridgeChild thread. */ - virtual bool DeallocShmem(mozilla::ipc::Shmem& aShmem) override; + bool DeallocShmem(mozilla::ipc::Shmem& aShmem) override; - virtual PTextureChild* CreateTexture( - const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock, - LayersBackend aLayersBackend, TextureFlags aFlags, uint64_t aSerial, - wr::MaybeExternalImageId& aExternalImageId, - nsIEventTarget* aTarget = nullptr) override; + PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData, + const ReadLockDescriptor& aReadLock, + LayersBackend aLayersBackend, + TextureFlags aFlags, uint64_t aSerial, + wr::MaybeExternalImageId& aExternalImageId, + nsIEventTarget* aTarget = nullptr) override; - virtual bool IsSameProcess() const override; + bool IsSameProcess() const override; - virtual void UpdateFwdTransactionId() override { ++mFwdTransactionId; } - virtual uint64_t GetFwdTransactionId() override { return mFwdTransactionId; } + void UpdateFwdTransactionId() override { ++mFwdTransactionId; } + uint64_t GetFwdTransactionId() override { return mFwdTransactionId; } bool InForwarderThread() override { return InImageBridgeChildThread(); } - virtual void HandleFatalError(const char* aMsg) const override; + void HandleFatalError(const char* aMsg) const override; - virtual wr::MaybeExternalImageId GetNextExternalImageId() override; + wr::MaybeExternalImageId GetNextExternalImageId() override; protected: explicit ImageBridgeChild(uint32_t aNamespace); diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index 888fa9110192..e971ebec1546 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -153,7 +153,7 @@ void ImageBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { // forever, waiting for the compositor thread to terminate. } -class MOZ_STACK_CLASS AutoImageBridgeParentAsyncMessageSender { +class MOZ_STACK_CLASS AutoImageBridgeParentAsyncMessageSender final { public: explicit AutoImageBridgeParentAsyncMessageSender( ImageBridgeParent* aImageBridge, diff --git a/gfx/layers/ipc/ImageBridgeParent.h b/gfx/layers/ipc/ImageBridgeParent.h index 3973e2544cf3..433486290d52 100644 --- a/gfx/layers/ipc/ImageBridgeParent.h +++ b/gfx/layers/ipc/ImageBridgeParent.h @@ -48,7 +48,7 @@ class ImageBridgeParent final : public PImageBridgeParent, ImageBridgeParent(MessageLoop* aLoop, ProcessId aChildProcessId); public: - ~ImageBridgeParent(); + virtual ~ImageBridgeParent(); /** * Creates the globals of ImageBridgeParent. @@ -60,18 +60,18 @@ class ImageBridgeParent final : public PImageBridgeParent, static bool CreateForContent(Endpoint&& aEndpoint); static void Shutdown(); - virtual ShmemAllocator* AsShmemAllocator() override { return this; } + ShmemAllocator* AsShmemAllocator() override { return this; } - virtual void ActorDestroy(ActorDestroyReason aWhy) override; + void ActorDestroy(ActorDestroyReason aWhy) override; // CompositableParentManager - virtual void SendAsyncMessage( + void SendAsyncMessage( const InfallibleTArray& aMessage) override; - virtual void NotifyNotUsed(PTextureParent* aTexture, - uint64_t aTransactionId) override; + void NotifyNotUsed(PTextureParent* aTexture, + uint64_t aTransactionId) override; - virtual base::ProcessId GetChildProcessId() override { return OtherPid(); } + base::ProcessId GetChildProcessId() override { return OtherPid(); } // PImageBridge mozilla::ipc::IPCResult RecvUpdate(EditArray&& aEdits, @@ -102,26 +102,24 @@ class ImageBridgeParent final : public PImageBridgeParent, // ShmemAllocator - virtual bool AllocShmem(size_t aSize, - ipc::SharedMemory::SharedMemoryType aType, - ipc::Shmem* aShmem) override; + bool AllocShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType, + ipc::Shmem* aShmem) override; - virtual bool AllocUnsafeShmem(size_t aSize, - ipc::SharedMemory::SharedMemoryType aType, - ipc::Shmem* aShmem) override; + bool AllocUnsafeShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType, + ipc::Shmem* aShmem) override; - virtual void DeallocShmem(ipc::Shmem& aShmem) override; + void DeallocShmem(ipc::Shmem& aShmem) override; - virtual bool IsSameProcess() const override; + bool IsSameProcess() const override; static already_AddRefed GetInstance(ProcessId aId); static bool NotifyImageComposites( nsTArray& aNotifications); - virtual bool UsesImageBridge() const override { return true; } + bool UsesImageBridge() const override { return true; } - virtual bool IPCOpen() const override { return !mClosed; } + bool IPCOpen() const override { return !mClosed; } protected: void Bind(Endpoint&& aEndpoint); diff --git a/gfx/layers/ipc/KnowsCompositor.h b/gfx/layers/ipc/KnowsCompositor.h index d9894e71dec9..c11aa2ce55b4 100644 --- a/gfx/layers/ipc/KnowsCompositor.h +++ b/gfx/layers/ipc/KnowsCompositor.h @@ -41,7 +41,7 @@ class ActiveResourceTracker : public nsExpirationTracker { nsIEventTarget* aEventTarget) : nsExpirationTracker(aExpirationCycle, aName, aEventTarget) {} - virtual void NotifyExpired(ActiveResource* aResource) override { + void NotifyExpired(ActiveResource* aResource) override { RemoveObject(aResource); aResource->NotifyInactive(); } @@ -56,7 +56,7 @@ class KnowsCompositor { NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING KnowsCompositor(); - ~KnowsCompositor(); + virtual ~KnowsCompositor(); void IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier); @@ -169,13 +169,13 @@ class KnowsCompositorMediaProxy : public KnowsCompositor { explicit KnowsCompositorMediaProxy( const TextureFactoryIdentifier& aIdentifier); - virtual TextureForwarder* GetTextureForwarder() override; + TextureForwarder* GetTextureForwarder() override; - virtual LayersIPCActor* GetLayersIPCActor() override; + LayersIPCActor* GetLayersIPCActor() override; - virtual ActiveResourceTracker* GetActiveResourceTracker() override; + ActiveResourceTracker* GetActiveResourceTracker() override; - virtual void SyncWithCompositor() override; + void SyncWithCompositor() override; protected: virtual ~KnowsCompositorMediaProxy(); diff --git a/gfx/layers/ipc/LayerTransactionChild.h b/gfx/layers/ipc/LayerTransactionChild.h index 5937c0c99b69..83ce36b02245 100644 --- a/gfx/layers/ipc/LayerTransactionChild.h +++ b/gfx/layers/ipc/LayerTransactionChild.h @@ -46,7 +46,7 @@ class LayerTransactionChild : public PLayerTransactionChild { protected: explicit LayerTransactionChild(const LayersId& aId) : mForwarder(nullptr), mIPCOpen(false), mDestroyed(false), mId(aId) {} - ~LayerTransactionChild() {} + virtual ~LayerTransactionChild() = default; void ActorDestroy(ActorDestroyReason why) override; diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index 0a1f354aa0a1..e02b7e917df6 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -112,7 +112,7 @@ void LayerTransactionParent::Destroy() { mAnimStorage = nullptr; } -class MOZ_STACK_CLASS AutoLayerTransactionParentAsyncMessageSender { +class MOZ_STACK_CLASS AutoLayerTransactionParentAsyncMessageSender final { public: explicit AutoLayerTransactionParentAsyncMessageSender( LayerTransactionParent* aLayerTransaction, diff --git a/gfx/layers/ipc/LayerTransactionParent.h b/gfx/layers/ipc/LayerTransactionParent.h index 373daf59f88b..dc85227c61cc 100644 --- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -47,7 +47,7 @@ class LayerTransactionParent final : public PLayerTransactionParent, TimeDuration aVsyncRate); protected: - ~LayerTransactionParent(); + virtual ~LayerTransactionParent(); public: void Destroy(); diff --git a/gfx/layers/ipc/RemoteContentController.h b/gfx/layers/ipc/RemoteContentController.h index 27b726c32a81..0c19b4e01246 100644 --- a/gfx/layers/ipc/RemoteContentController.h +++ b/gfx/layers/ipc/RemoteContentController.h @@ -38,59 +38,55 @@ class RemoteContentController : public GeckoContentController, virtual ~RemoteContentController(); - virtual void NotifyLayerTransforms( + void NotifyLayerTransforms( const nsTArray& aTransforms) override; - virtual void RequestContentRepaint(const RepaintRequest& aRequest) override; + void RequestContentRepaint(const RepaintRequest& aRequest) override; - virtual void HandleTap(TapType aTapType, const LayoutDevicePoint& aPoint, - Modifiers aModifiers, const ScrollableLayerGuid& aGuid, - uint64_t aInputBlockId) override; + void HandleTap(TapType aTapType, const LayoutDevicePoint& aPoint, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid, + uint64_t aInputBlockId) override; - virtual void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType, - const ScrollableLayerGuid& aGuid, - LayoutDeviceCoord aSpanChange, - Modifiers aModifiers) override; + void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType, + const ScrollableLayerGuid& aGuid, + LayoutDeviceCoord aSpanChange, + Modifiers aModifiers) override; - virtual void PostDelayedTask(already_AddRefed aTask, - int aDelayMs) override; + void PostDelayedTask(already_AddRefed aTask, int aDelayMs) override; - virtual bool IsRepaintThread() override; + bool IsRepaintThread() override; - virtual void DispatchToRepaintThread( - already_AddRefed aTask) override; + void DispatchToRepaintThread(already_AddRefed aTask) override; - virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, - APZStateChange aChange, int aArg) override; + void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, + APZStateChange aChange, int aArg) override; - virtual void UpdateOverscrollVelocity(float aX, float aY, - bool aIsRootContent) override; + void UpdateOverscrollVelocity(float aX, float aY, + bool aIsRootContent) override; - virtual void UpdateOverscrollOffset(float aX, float aY, - bool aIsRootContent) override; + void UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent) override; - virtual void NotifyMozMouseScrollEvent( - const ScrollableLayerGuid::ViewID& aScrollId, - const nsString& aEvent) override; + void NotifyMozMouseScrollEvent(const ScrollableLayerGuid::ViewID& aScrollId, + const nsString& aEvent) override; - virtual void NotifyFlushComplete() override; + void NotifyFlushComplete() override; - virtual void NotifyAsyncScrollbarDragInitiated( + void NotifyAsyncScrollbarDragInitiated( uint64_t aDragBlockId, const ScrollableLayerGuid::ViewID& aScrollId, ScrollDirection aDirection) override; - virtual void NotifyAsyncScrollbarDragRejected( + void NotifyAsyncScrollbarDragRejected( const ScrollableLayerGuid::ViewID& aScrollId) override; - virtual void NotifyAsyncAutoscrollRejected( + void NotifyAsyncAutoscrollRejected( const ScrollableLayerGuid::ViewID& aScrollId) override; - virtual void CancelAutoscroll(const ScrollableLayerGuid& aScrollId) override; + void CancelAutoscroll(const ScrollableLayerGuid& aScrollId) override; - virtual void ActorDestroy(ActorDestroyReason aWhy) override; + void ActorDestroy(ActorDestroyReason aWhy) override; - virtual void Destroy() override; + void Destroy() override; - virtual bool IsRemote() override; + bool IsRemote() override; private: MessageLoop* mCompositorThread; diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 02521b090db6..ea1305e32e3f 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -136,7 +136,7 @@ class Transaction { Transaction(const Transaction&); Transaction& operator=(const Transaction&); }; -struct AutoTxnEnd { +struct AutoTxnEnd final { explicit AutoTxnEnd(Transaction* aTxn) : mTxn(aTxn) {} ~AutoTxnEnd() { mTxn->End(); } Transaction* mTxn; diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index c5aeb43b836a..f68ad76b5375 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -217,7 +217,7 @@ class ShadowLayerForwarder final : public LayersIPCActor, bool DestroyInTransaction(PTextureChild* aTexture) override; bool DestroyInTransaction(const CompositableHandle& aHandle); - virtual void RemoveTextureFromCompositable( + void RemoveTextureFromCompositable( CompositableClient* aCompositable, TextureClient* aTexture, const Maybe& aRenderRoot) override; @@ -225,19 +225,19 @@ class ShadowLayerForwarder final : public LayersIPCActor, * Communicate to the compositor that aRegion in the texture identified by * aLayer and aIdentifier has been updated to aThebesBuffer. */ - virtual void UpdateTextureRegion(CompositableClient* aCompositable, - const ThebesBufferData& aThebesBufferData, - const nsIntRegion& aUpdatedRegion) override; + void UpdateTextureRegion(CompositableClient* aCompositable, + const ThebesBufferData& aThebesBufferData, + const nsIntRegion& aUpdatedRegion) override; /** * See CompositableForwarder::UseTextures */ - virtual void UseTextures(CompositableClient* aCompositable, - const nsTArray& aTextures, - const Maybe& aRenderRoot) override; - virtual void UseComponentAlphaTextures( - CompositableClient* aCompositable, TextureClient* aClientOnBlack, - TextureClient* aClientOnWhite) override; + void UseTextures(CompositableClient* aCompositable, + const nsTArray& aTextures, + const Maybe& aRenderRoot) override; + void UseComponentAlphaTextures(CompositableClient* aCompositable, + TextureClient* aClientOnBlack, + TextureClient* aClientOnWhite) override; /** * Used for debugging to tell the compositor how long this frame took to @@ -327,7 +327,7 @@ class ShadowLayerForwarder final : public LayersIPCActor, * buffer, and the double-buffer pair is gone. */ - virtual bool IPCOpen() const override; + bool IPCOpen() const override; /** * Construct a shadow of |aLayer| on the "other side", at the @@ -352,18 +352,18 @@ class ShadowLayerForwarder final : public LayersIPCActor, static void PlatformSyncBeforeUpdate(); - virtual bool AllocSurfaceDescriptor(const gfx::IntSize& aSize, - gfxContentType aContent, + bool AllocSurfaceDescriptor(const gfx::IntSize& aSize, + gfxContentType aContent, + SurfaceDescriptor* aBuffer) override; + + bool AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize, + gfxContentType aContent, uint32_t aCaps, SurfaceDescriptor* aBuffer) override; - virtual bool AllocSurfaceDescriptorWithCaps( - const gfx::IntSize& aSize, gfxContentType aContent, uint32_t aCaps, - SurfaceDescriptor* aBuffer) override; + void DestroySurfaceDescriptor(SurfaceDescriptor* aSurface) override; - virtual void DestroySurfaceDescriptor(SurfaceDescriptor* aSurface) override; - - virtual void UpdateFwdTransactionId() override; - virtual uint64_t GetFwdTransactionId() override; + void UpdateFwdTransactionId() override; + uint64_t GetFwdTransactionId() override; void UpdateTextureLocks(); void SyncTextures(const nsTArray& aSerials); @@ -394,9 +394,9 @@ class ShadowLayerForwarder final : public LayersIPCActor, nsIEventTarget* GetEventTarget() { return mEventTarget; }; - virtual bool IsThreadSafe() const override { return false; } + bool IsThreadSafe() const override { return false; } - virtual RefPtr GetForMedia() override; + RefPtr GetForMedia() override; protected: virtual ~ShadowLayerForwarder(); diff --git a/gfx/layers/ipc/SharedSurfacesChild.h b/gfx/layers/ipc/SharedSurfacesChild.h index e0f8a0ce4cbc..863cf9ab2ac2 100644 --- a/gfx/layers/ipc/SharedSurfacesChild.h +++ b/gfx/layers/ipc/SharedSurfacesChild.h @@ -44,7 +44,7 @@ class CompositorManagerChild; class ImageContainer; class RenderRootStateManager; -class SharedSurfacesChild final { +class SharedSurfacesChild { public: /** * Request that the surface be mapped into the compositor thread's memory @@ -116,7 +116,7 @@ class SharedSurfacesChild final { public: ImageKeyData(RenderRootStateManager* aManager, const wr::ImageKey& aImageKey); - ~ImageKeyData(); + virtual ~ImageKeyData(); ImageKeyData(ImageKeyData&& aOther); ImageKeyData& operator=(ImageKeyData&& aOther); @@ -194,7 +194,7 @@ class AnimationImageKeyData final : public SharedSurfacesChild::ImageKeyData { AnimationImageKeyData(RenderRootStateManager* aManager, const wr::ImageKey& aImageKey); - ~AnimationImageKeyData(); + virtual ~AnimationImageKeyData(); AnimationImageKeyData(AnimationImageKeyData&& aOther); AnimationImageKeyData& operator=(AnimationImageKeyData&& aOther); @@ -211,7 +211,7 @@ class SharedSurfacesAnimation final { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedSurfacesAnimation) - SharedSurfacesAnimation() {} + SharedSurfacesAnimation() = default; void Destroy(); diff --git a/gfx/layers/ipc/SynchronousTask.h b/gfx/layers/ipc/SynchronousTask.h index eeb56b5849e6..fc6acda81b09 100644 --- a/gfx/layers/ipc/SynchronousTask.h +++ b/gfx/layers/ipc/SynchronousTask.h @@ -38,7 +38,7 @@ class MOZ_STACK_CLASS SynchronousTask { bool mDone; }; -class MOZ_STACK_CLASS AutoCompleteTask { +class MOZ_STACK_CLASS AutoCompleteTask final { public: explicit AutoCompleteTask(SynchronousTask* aTask) : mTask(aTask), mAutoEnter(aTask->mMonitor) {} diff --git a/gfx/layers/ipc/TextureForwarder.h b/gfx/layers/ipc/TextureForwarder.h index 9f61a35edde5..078c15e3db32 100644 --- a/gfx/layers/ipc/TextureForwarder.h +++ b/gfx/layers/ipc/TextureForwarder.h @@ -59,7 +59,7 @@ class LayersIPCChannel : public LayersIPCActor, } protected: - virtual ~LayersIPCChannel() {} + virtual ~LayersIPCChannel() = default; }; /** diff --git a/gfx/layers/ipc/UiCompositorControllerChild.h b/gfx/layers/ipc/UiCompositorControllerChild.h index dff6ef463ad7..bb38c0fdbafe 100644 --- a/gfx/layers/ipc/UiCompositorControllerChild.h +++ b/gfx/layers/ipc/UiCompositorControllerChild.h @@ -56,7 +56,7 @@ class UiCompositorControllerChild final void ActorDestroy(ActorDestroyReason aWhy) override; void DeallocPUiCompositorControllerChild() override; void ProcessingError(Result aCode, const char* aReason) override; - virtual void HandleFatalError(const char* aMsg) const override; + void HandleFatalError(const char* aMsg) const override; mozilla::ipc::IPCResult RecvToolbarAnimatorMessageFromCompositor( const int32_t& aMessage); mozilla::ipc::IPCResult RecvRootFrameMetrics(const ScreenPoint& aScrollOffset, @@ -66,7 +66,7 @@ class UiCompositorControllerChild final private: explicit UiCompositorControllerChild(const uint64_t& aProcessToken); - ~UiCompositorControllerChild(); + virtual ~UiCompositorControllerChild(); void OpenForSameProcess(); void OpenForGPUProcess(Endpoint&& aEndpoint); void SendCachedValues(); diff --git a/gfx/layers/ipc/UiCompositorControllerParent.h b/gfx/layers/ipc/UiCompositorControllerParent.h index f48603a17a95..e96ffbcd17e6 100644 --- a/gfx/layers/ipc/UiCompositorControllerParent.h +++ b/gfx/layers/ipc/UiCompositorControllerParent.h @@ -71,7 +71,7 @@ class UiCompositorControllerParent final private: explicit UiCompositorControllerParent(const LayersId& aRootLayerTreeId); - ~UiCompositorControllerParent(); + virtual ~UiCompositorControllerParent(); void InitializeForSameProcess(); void InitializeForOutOfProcess(); void Initialize(); diff --git a/gfx/layers/ipc/VideoBridgeChild.h b/gfx/layers/ipc/VideoBridgeChild.h index 83da5b86d27b..7911d2552cc9 100644 --- a/gfx/layers/ipc/VideoBridgeChild.h +++ b/gfx/layers/ipc/VideoBridgeChild.h @@ -66,7 +66,7 @@ class VideoBridgeChild final : public PVideoBridgeChild, private: VideoBridgeChild(); - ~VideoBridgeChild(); + virtual ~VideoBridgeChild(); RefPtr mIPDLSelfRef; MessageLoop* mMessageLoop; diff --git a/gfx/layers/mlgpu/BufferCache.h b/gfx/layers/mlgpu/BufferCache.h index 2e1377c55a0c..5ad51db0ef53 100644 --- a/gfx/layers/mlgpu/BufferCache.h +++ b/gfx/layers/mlgpu/BufferCache.h @@ -19,7 +19,7 @@ class MLGBuffer; class MLGDevice; // Cache MLGBuffers based on how long ago they were last used. -class BufferCache { +class BufferCache final { public: explicit BufferCache(MLGDevice* aDevice); ~BufferCache(); diff --git a/gfx/layers/mlgpu/CanvasLayerMLGPU.h b/gfx/layers/mlgpu/CanvasLayerMLGPU.h index 947c1de3c370..6410bf05161a 100644 --- a/gfx/layers/mlgpu/CanvasLayerMLGPU.h +++ b/gfx/layers/mlgpu/CanvasLayerMLGPU.h @@ -27,7 +27,7 @@ class CanvasLayerMLGPU final : public CanvasLayer, public TexturedLayerMLGPU { explicit CanvasLayerMLGPU(LayerManagerMLGPU* aManager); protected: - ~CanvasLayerMLGPU() override; + virtual ~CanvasLayerMLGPU(); public: Layer* GetLayer() override; diff --git a/gfx/layers/mlgpu/ContainerLayerMLGPU.h b/gfx/layers/mlgpu/ContainerLayerMLGPU.h index ee73b8e2d947..cbe89cb49abe 100644 --- a/gfx/layers/mlgpu/ContainerLayerMLGPU.h +++ b/gfx/layers/mlgpu/ContainerLayerMLGPU.h @@ -19,7 +19,7 @@ class RenderViewMLGPU; class ContainerLayerMLGPU final : public ContainerLayer, public LayerMLGPU { public: explicit ContainerLayerMLGPU(LayerManagerMLGPU* aManager); - ~ContainerLayerMLGPU() override; + virtual ~ContainerLayerMLGPU(); MOZ_LAYER_DECL_NAME("ContainerLayerMLGPU", TYPE_CONTAINER) diff --git a/gfx/layers/mlgpu/ImageLayerMLGPU.h b/gfx/layers/mlgpu/ImageLayerMLGPU.h index 9e7d3cb988cd..33d2e4f3e920 100644 --- a/gfx/layers/mlgpu/ImageLayerMLGPU.h +++ b/gfx/layers/mlgpu/ImageLayerMLGPU.h @@ -36,7 +36,7 @@ class ImageLayerMLGPU final : public ImageLayer, public TexturedLayerMLGPU { MOZ_LAYER_DECL_NAME("ImageLayerMLGPU", TYPE_IMAGE) protected: - ~ImageLayerMLGPU() override; + virtual ~ImageLayerMLGPU(); void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; void CleanupResources(); diff --git a/gfx/layers/mlgpu/LayerMLGPU.h b/gfx/layers/mlgpu/LayerMLGPU.h index 87b83d8550c8..bf1947049f38 100644 --- a/gfx/layers/mlgpu/LayerMLGPU.h +++ b/gfx/layers/mlgpu/LayerMLGPU.h @@ -86,7 +86,7 @@ class LayerMLGPU : public HostLayer { virtual bool OnPrepareToRender(FrameBuilder* aBuilder) { return true; } virtual void ClearCachedResources() {} - virtual CompositableHost* GetCompositableHost() override { return nullptr; } + CompositableHost* GetCompositableHost() override { return nullptr; } protected: LayerMLGPU(LayerManagerMLGPU* aManager); @@ -120,7 +120,7 @@ class LayerMLGPU : public HostLayer { class RefLayerMLGPU final : public RefLayer, public LayerMLGPU { public: explicit RefLayerMLGPU(LayerManagerMLGPU* aManager); - ~RefLayerMLGPU() override; + virtual ~RefLayerMLGPU(); // Layer HostLayer* AsHostLayer() override { return this; } @@ -141,7 +141,7 @@ class RefLayerMLGPU final : public RefLayer, public LayerMLGPU { class ColorLayerMLGPU final : public ColorLayer, public LayerMLGPU { public: explicit ColorLayerMLGPU(LayerManagerMLGPU* aManager); - ~ColorLayerMLGPU() override; + virtual ~ColorLayerMLGPU(); // LayerMLGPU bool IsContentOpaque() override { return mColor.a >= 1.0f; } diff --git a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp index 1c0a49973d32..fe3fc7e0f4d5 100644 --- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp +++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp @@ -216,7 +216,7 @@ void LayerManagerMLGPU::BeginTransactionWithDrawTarget( } // Helper class for making sure textures are unlocked. -class MOZ_STACK_CLASS AutoUnlockAllTextures { +class MOZ_STACK_CLASS AutoUnlockAllTextures final { public: explicit AutoUnlockAllTextures(MLGDevice* aDevice) : mDevice(aDevice) {} ~AutoUnlockAllTextures() { mDevice->UnlockAllTextures(); } diff --git a/gfx/layers/mlgpu/LayerManagerMLGPU.h b/gfx/layers/mlgpu/LayerManagerMLGPU.h index 9f8d3231223b..af6dca454cd2 100644 --- a/gfx/layers/mlgpu/LayerManagerMLGPU.h +++ b/gfx/layers/mlgpu/LayerManagerMLGPU.h @@ -31,7 +31,7 @@ struct LayerProperties; class LayerManagerMLGPU final : public HostLayerManager { public: explicit LayerManagerMLGPU(widget::CompositorWidget* aWidget); - ~LayerManagerMLGPU(); + virtual ~LayerManagerMLGPU(); bool Initialize(); void Destroy() override; diff --git a/gfx/layers/mlgpu/MLGDevice.h b/gfx/layers/mlgpu/MLGDevice.h index e8c1cc98d026..f100ac16e668 100644 --- a/gfx/layers/mlgpu/MLGDevice.h +++ b/gfx/layers/mlgpu/MLGDevice.h @@ -68,7 +68,7 @@ class MLGRenderTarget { protected: explicit MLGRenderTarget(MLGRenderTargetFlags aFlags); - virtual ~MLGRenderTarget() {} + virtual ~MLGRenderTarget() = default; protected: MLGRenderTargetFlags mFlags; @@ -80,7 +80,7 @@ class MLGRenderTarget { class MLGSwapChain { protected: - virtual ~MLGSwapChain() {} + virtual ~MLGSwapChain() = default; public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MLGSwapChain) @@ -142,7 +142,7 @@ class MLGResource { virtual MLGResourceD3D11* AsResourceD3D11() { return nullptr; } protected: - virtual ~MLGResource() {} + virtual ~MLGResource() = default; }; // A buffer for use as a shader input. @@ -153,7 +153,7 @@ class MLGBuffer : public MLGResource { virtual size_t GetSize() const = 0; protected: - ~MLGBuffer() override {} + virtual ~MLGBuffer() = default; }; // This is a lower-level resource than a TextureSource. It wraps diff --git a/gfx/layers/mlgpu/MLGPUScreenshotGrabber.cpp b/gfx/layers/mlgpu/MLGPUScreenshotGrabber.cpp index 5cf3c8f6ec00..ef1597cf1e54 100644 --- a/gfx/layers/mlgpu/MLGPUScreenshotGrabber.cpp +++ b/gfx/layers/mlgpu/MLGPUScreenshotGrabber.cpp @@ -72,8 +72,6 @@ class MLGPUScreenshotGrabberImpl final { const IntSize mReadbackTextureSize; }; -MLGPUScreenshotGrabber::MLGPUScreenshotGrabber() {} - MLGPUScreenshotGrabber::~MLGPUScreenshotGrabber() {} void MLGPUScreenshotGrabber::MaybeGrabScreenshot(MLGDevice* aDevice, diff --git a/gfx/layers/mlgpu/MLGPUScreenshotGrabber.h b/gfx/layers/mlgpu/MLGPUScreenshotGrabber.h index 1be5c0f0fb8c..8d3107b45162 100644 --- a/gfx/layers/mlgpu/MLGPUScreenshotGrabber.h +++ b/gfx/layers/mlgpu/MLGPUScreenshotGrabber.h @@ -27,7 +27,7 @@ class MLGPUScreenshotGrabberImpl; */ class MLGPUScreenshotGrabber final { public: - MLGPUScreenshotGrabber(); + MLGPUScreenshotGrabber() = default; ~MLGPUScreenshotGrabber(); // Scale the contents of aTexture into an appropriately sized MLGTexture diff --git a/gfx/layers/mlgpu/MaskOperation.h b/gfx/layers/mlgpu/MaskOperation.h index a3bb8e328d03..2cf74196ea9d 100644 --- a/gfx/layers/mlgpu/MaskOperation.h +++ b/gfx/layers/mlgpu/MaskOperation.h @@ -62,7 +62,7 @@ typedef std::vector MaskTextureList; class MaskCombineOperation final : public MaskOperation { public: explicit MaskCombineOperation(FrameBuilder* aBuilder); - ~MaskCombineOperation() override; + virtual ~MaskCombineOperation(); void Init(const MaskTextureList& aTextures); diff --git a/gfx/layers/mlgpu/PaintedLayerMLGPU.h b/gfx/layers/mlgpu/PaintedLayerMLGPU.h index f0ceaf78ff24..4a15429f6235 100644 --- a/gfx/layers/mlgpu/PaintedLayerMLGPU.h +++ b/gfx/layers/mlgpu/PaintedLayerMLGPU.h @@ -21,12 +21,12 @@ class TiledLayerBufferComposite; class PaintedLayerMLGPU final : public PaintedLayer, public LayerMLGPU { public: explicit PaintedLayerMLGPU(LayerManagerMLGPU* aManager); - ~PaintedLayerMLGPU() override; + virtual ~PaintedLayerMLGPU(); // Layer HostLayer* AsHostLayer() override { return this; } PaintedLayerMLGPU* AsPaintedLayerMLGPU() override { return this; } - virtual Layer* GetLayer() override { return this; } + Layer* GetLayer() override { return this; } bool SetCompositableHost(CompositableHost*) override; CompositableHost* GetCompositableHost() override; void Disconnect() override; diff --git a/gfx/layers/mlgpu/RenderPassMLGPU.h b/gfx/layers/mlgpu/RenderPassMLGPU.h index 4c0a1e2c45bc..129e569104c1 100644 --- a/gfx/layers/mlgpu/RenderPassMLGPU.h +++ b/gfx/layers/mlgpu/RenderPassMLGPU.h @@ -41,11 +41,10 @@ enum class RenderOrder { static const uint32_t kInvalidResourceIndex = uint32_t(-1); -struct ItemInfo { - explicit ItemInfo(FrameBuilder* aBuilder, RenderViewMLGPU* aView, - LayerMLGPU* aLayer, int32_t aSortOrder, - const gfx::IntRect& aBounds, - Maybe&& aGeometry); +struct ItemInfo final { + ItemInfo(FrameBuilder* aBuilder, RenderViewMLGPU* aView, LayerMLGPU* aLayer, + int32_t aSortOrder, const gfx::IntRect& aBounds, + Maybe&& aGeometry); // Return true if a layer can be clipped by the vertex shader; false // otherwise. Any kind of textured mask or non-rectilinear transform @@ -150,7 +149,7 @@ class ShaderRenderPass : public RenderPassMLGPU { void PrepareForRendering() override; void ExecuteRendering() override; - virtual Maybe GetBlendState() const override { + Maybe GetBlendState() const override { return Some(MLGBlendState::Over); } @@ -211,7 +210,7 @@ class BatchRenderPass : public ShaderRenderPass { // reject the item, then redraw the same rect again in another batch. // To deal with this we use a transaction approach and reject the transaction // if we couldn't add everything. - class Txn { + class Txn final { public: explicit Txn(BatchRenderPass* aPass) : mPass(aPass), mPrevInstancePos(aPass->mInstances.GetPosition()) {} @@ -264,7 +263,7 @@ class TexturedRenderPass : public BatchRenderPass { explicit TexturedRenderPass(FrameBuilder* aBuilder, const ItemInfo& aItem); protected: - struct Info { + struct Info final { Info(const ItemInfo& aItem, PaintedLayerMLGPU* aLayer); Info(const ItemInfo& aItem, TexturedLayerMLGPU* aLayer); Info(const ItemInfo& aItem, ContainerLayerMLGPU* aLayer); diff --git a/gfx/layers/mlgpu/ShaderDefinitionsMLGPU.h b/gfx/layers/mlgpu/ShaderDefinitionsMLGPU.h index 02e2c0fb0609..9418a9a4a75f 100644 --- a/gfx/layers/mlgpu/ShaderDefinitionsMLGPU.h +++ b/gfx/layers/mlgpu/ShaderDefinitionsMLGPU.h @@ -103,7 +103,7 @@ static inline nsTArray ToRectArray(const T& aRegion) { } struct SimpleTraits { - explicit SimpleTraits(const ItemInfo& aItem, const gfx::Rect& aRect) + SimpleTraits(const ItemInfo& aItem, const gfx::Rect& aRect) : mItem(aItem), mRect(aRect) {} // Helper nonce structs so functions can break vertex data up by each diff --git a/gfx/layers/mlgpu/TextureSourceProviderMLGPU.h b/gfx/layers/mlgpu/TextureSourceProviderMLGPU.h index ee6a4e245f51..4210206c7298 100644 --- a/gfx/layers/mlgpu/TextureSourceProviderMLGPU.h +++ b/gfx/layers/mlgpu/TextureSourceProviderMLGPU.h @@ -19,7 +19,7 @@ class TextureSourceProviderMLGPU final : public TextureSourceProvider { public: TextureSourceProviderMLGPU(LayerManagerMLGPU* aLayerManager, MLGDevice* aDevice); - ~TextureSourceProviderMLGPU() override; + virtual ~TextureSourceProviderMLGPU(); already_AddRefed CreateDataTextureSource( TextureFlags aFlags) override; @@ -36,7 +36,7 @@ class TextureSourceProviderMLGPU final : public TextureSourceProvider { bool IsValid() const override; #ifdef XP_WIN - virtual ID3D11Device* GetD3D11Device() const override; + ID3D11Device* GetD3D11Device() const override; #endif void ReadUnlockTextures() { TextureSourceProvider::ReadUnlockTextures(); } diff --git a/gfx/layers/mlgpu/TexturedLayerMLGPU.h b/gfx/layers/mlgpu/TexturedLayerMLGPU.h index 807c11fc8c5b..e6b4e695870a 100644 --- a/gfx/layers/mlgpu/TexturedLayerMLGPU.h +++ b/gfx/layers/mlgpu/TexturedLayerMLGPU.h @@ -41,7 +41,7 @@ class TexturedLayerMLGPU : public LayerMLGPU { protected: explicit TexturedLayerMLGPU(LayerManagerMLGPU* aManager); - virtual ~TexturedLayerMLGPU() override; + virtual ~TexturedLayerMLGPU(); void AssignBigImage(FrameBuilder* aBuilder, RenderViewMLGPU* aView, BigImageIterator* aIter, @@ -77,7 +77,7 @@ class TempImageLayerMLGPU final : public ImageLayer, public TexturedLayerMLGPU { Layer* GetLayer() override { return this; } protected: - ~TempImageLayerMLGPU() override; + virtual ~TempImageLayerMLGPU(); private: gfx::SamplingFilter mFilter; diff --git a/gfx/layers/opengl/CompositingRenderTargetOGL.h b/gfx/layers/opengl/CompositingRenderTargetOGL.h index d66bb0b4605a..b97231e486d7 100644 --- a/gfx/layers/opengl/CompositingRenderTargetOGL.h +++ b/gfx/layers/opengl/CompositingRenderTargetOGL.h @@ -81,9 +81,7 @@ class CompositingRenderTargetOGL : public CompositingRenderTarget { ~CompositingRenderTargetOGL(); - virtual const char* Name() const override { - return "CompositingRenderTargetOGL"; - } + const char* Name() const override { return "CompositingRenderTargetOGL"; } /** * Create a render target around the default FBO, for rendering straight to @@ -148,7 +146,7 @@ class CompositingRenderTargetOGL : public CompositingRenderTarget { } #ifdef MOZ_DUMP_PAINTING - virtual already_AddRefed Dump( + already_AddRefed Dump( Compositor* aCompositor) override; #endif diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index c3fb146b03f8..3f12effebe56 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -84,7 +84,7 @@ class AsyncReadbackBufferOGL final : public AsyncReadbackBuffer { } protected: - ~AsyncReadbackBufferOGL() override; + virtual ~AsyncReadbackBufferOGL(); private: GLContext* mGL; diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index 33ddd780ce54..aaa0e6b5f12d 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -65,7 +65,7 @@ class GLBlitTextureImageHelper; */ class CompositorTexturePoolOGL { protected: - virtual ~CompositorTexturePoolOGL() {} + virtual ~CompositorTexturePoolOGL() = default; public: NS_INLINE_DECL_REFCOUNTING(CompositorTexturePoolOGL) @@ -86,11 +86,11 @@ class PerUnitTexturePoolOGL : public CompositorTexturePoolOGL { explicit PerUnitTexturePoolOGL(gl::GLContext* aGL); virtual ~PerUnitTexturePoolOGL(); - virtual void Clear() override { DestroyTextures(); } + void Clear() override { DestroyTextures(); } - virtual GLuint GetTexture(GLenum aTarget, GLenum aUnit) override; + GLuint GetTexture(GLenum aTarget, GLenum aUnit) override; - virtual void EndFrame() override {} + void EndFrame() override {} protected: void DestroyTextures(); @@ -111,31 +111,30 @@ class CompositorOGL final : public Compositor { std::map mPrograms; public: - explicit CompositorOGL(CompositorBridgeParent* aParent, - widget::CompositorWidget* aWidget, - int aSurfaceWidth = -1, int aSurfaceHeight = -1, - bool aUseExternalSurfaceSize = false); + CompositorOGL(CompositorBridgeParent* aParent, + widget::CompositorWidget* aWidget, int aSurfaceWidth = -1, + int aSurfaceHeight = -1, bool aUseExternalSurfaceSize = false); protected: virtual ~CompositorOGL(); public: - virtual CompositorOGL* AsCompositorOGL() override { return this; } + CompositorOGL* AsCompositorOGL() override { return this; } - virtual already_AddRefed CreateDataTextureSource( + already_AddRefed CreateDataTextureSource( TextureFlags aFlags = TextureFlags::NO_FLAGS) override; - virtual already_AddRefed - CreateDataTextureSourceAroundYCbCr(TextureHost* aTexture) override; + already_AddRefed CreateDataTextureSourceAroundYCbCr( + TextureHost* aTexture) override; - virtual already_AddRefed CreateDataTextureSourceAround( + already_AddRefed CreateDataTextureSourceAround( gfx::DataSourceSurface* aSurface) override; - virtual bool Initialize(nsCString* const out_failureReason) override; + bool Initialize(nsCString* const out_failureReason) override; - virtual void Destroy() override; + void Destroy() override; - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override { + TextureFactoryIdentifier GetTextureFactoryIdentifier() override { TextureFactoryIdentifier result = TextureFactoryIdentifier( LayersBackend::LAYERS_OPENGL, XRE_GetProcessType(), GetMaxTextureSize(), SupportsTextureDirectMapping(), false, @@ -144,87 +143,83 @@ class CompositorOGL final : public Compositor { return result; } - virtual already_AddRefed CreateRenderTarget( + already_AddRefed CreateRenderTarget( const gfx::IntRect& aRect, SurfaceInitMode aInit) override; - virtual already_AddRefed - CreateRenderTargetFromSource(const gfx::IntRect& aRect, - const CompositingRenderTarget* aSource, - const gfx::IntPoint& aSourcePoint) override; + already_AddRefed CreateRenderTargetFromSource( + const gfx::IntRect& aRect, const CompositingRenderTarget* aSource, + const gfx::IntPoint& aSourcePoint) override; - virtual void SetRenderTarget(CompositingRenderTarget* aSurface) override; - virtual already_AddRefed GetCurrentRenderTarget() + void SetRenderTarget(CompositingRenderTarget* aSurface) override; + already_AddRefed GetCurrentRenderTarget() const override; - virtual already_AddRefed GetWindowRenderTarget() + already_AddRefed GetWindowRenderTarget() const override; - virtual bool ReadbackRenderTarget(CompositingRenderTarget* aSource, - AsyncReadbackBuffer* aDest) override; + bool ReadbackRenderTarget(CompositingRenderTarget* aSource, + AsyncReadbackBuffer* aDest) override; - virtual already_AddRefed CreateAsyncReadbackBuffer( + already_AddRefed CreateAsyncReadbackBuffer( const gfx::IntSize& aSize) override; - virtual bool BlitRenderTarget(CompositingRenderTarget* aSource, - const gfx::IntSize& aSourceSize, - const gfx::IntSize& aDestSize) override; + bool BlitRenderTarget(CompositingRenderTarget* aSource, + const gfx::IntSize& aSourceSize, + const gfx::IntSize& aDestSize) override; - virtual void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect, - const EffectChain& aEffectChain, gfx::Float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::Rect& aVisibleRect) override; + void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect, + const EffectChain& aEffectChain, gfx::Float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::Rect& aVisibleRect) override; - virtual void DrawTriangles(const nsTArray& aTriangles, - const gfx::Rect& aRect, - const gfx::IntRect& aClipRect, - const EffectChain& aEffectChain, - gfx::Float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::Rect& aVisibleRect) override; + void DrawTriangles(const nsTArray& aTriangles, + const gfx::Rect& aRect, const gfx::IntRect& aClipRect, + const EffectChain& aEffectChain, gfx::Float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::Rect& aVisibleRect) override; - virtual bool SupportsLayerGeometry() const override; + bool SupportsLayerGeometry() const override; - virtual void EndFrame() override; + void EndFrame() override; - virtual bool SupportsPartialTextureUpdate() override; + bool SupportsPartialTextureUpdate() override; - virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override { + bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override { if (!mGLContext) return false; int32_t maxSize = GetMaxTextureSize(); return aSize <= gfx::IntSize(maxSize, maxSize); } - virtual int32_t GetMaxTextureSize() const override; + int32_t GetMaxTextureSize() const override; /** * Set the size of the EGL surface we're rendering to, if we're rendering to * an EGL surface. */ - virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override; + void SetDestinationSurfaceSize(const gfx::IntSize& aSize) override; - virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) override { + void SetScreenRenderOffset(const ScreenPoint& aOffset) override { mRenderOffset = aOffset; } - virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) override; + void MakeCurrent(MakeCurrentFlags aFlags = 0) override; #ifdef MOZ_DUMP_PAINTING - virtual const char* Name() const override { return "OGL"; } + const char* Name() const override { return "OGL"; } #endif // MOZ_DUMP_PAINTING - virtual LayersBackend GetBackendType() const override { + LayersBackend GetBackendType() const override { return LayersBackend::LAYERS_OPENGL; } - virtual void Pause() override; - virtual bool Resume() override; + void Pause() override; + bool Resume() override; GLContext* gl() const { return mGLContext; } GLContext* GetGLContext() const override { return mGLContext; } #ifdef XP_DARWIN - virtual void MaybeUnlockBeforeNextComposition( - TextureHost* aTextureHost) override; - virtual void TryUnlockTextures() override; + void MaybeUnlockBeforeNextComposition(TextureHost* aTextureHost) override; + void TryUnlockTextures() override; #endif /** @@ -337,17 +332,17 @@ class CompositorOGL final : public Compositor { /* * Clear aRect on current render target. */ - virtual void ClearRect(const gfx::Rect& aRect) override; + void ClearRect(const gfx::Rect& aRect) override; /* Start a new frame. If aClipRectIn is null and aClipRectOut is non-null, * sets *aClipRectOut to the screen dimensions. */ - virtual void BeginFrame(const nsIntRegion& aInvalidRegion, - const gfx::IntRect* aClipRectIn, - const gfx::IntRect& aRenderBounds, - const nsIntRegion& aOpaqueRegion, - gfx::IntRect* aClipRectOut = nullptr, - gfx::IntRect* aRenderBoundsOut = nullptr) override; + void BeginFrame(const nsIntRegion& aInvalidRegion, + const gfx::IntRect* aClipRectIn, + const gfx::IntRect& aRenderBounds, + const nsIntRegion& aOpaqueRegion, + gfx::IntRect* aClipRectOut = nullptr, + gfx::IntRect* aRenderBoundsOut = nullptr) override; ShaderConfigOGL GetShaderConfigFor( Effect* aEffect, TextureSourceOGL* aSourceMask = nullptr, diff --git a/gfx/layers/opengl/GLManager.cpp b/gfx/layers/opengl/GLManager.cpp index 154db584efc6..f8b61f7002b7 100644 --- a/gfx/layers/opengl/GLManager.cpp +++ b/gfx/layers/opengl/GLManager.cpp @@ -25,25 +25,24 @@ class GLManagerCompositor : public GLManager { explicit GLManagerCompositor(CompositorOGL* aCompositor) : mImpl(aCompositor) {} - virtual GLContext* gl() const override { return mImpl->gl(); } + GLContext* gl() const override { return mImpl->gl(); } - virtual void ActivateProgram(ShaderProgramOGL* aProg) override { + void ActivateProgram(ShaderProgramOGL* aProg) override { mImpl->ActivateProgram(aProg); } - virtual ShaderProgramOGL* GetProgram(GLenum aTarget, - gfx::SurfaceFormat aFormat) override { + ShaderProgramOGL* GetProgram(GLenum aTarget, + gfx::SurfaceFormat aFormat) override { ShaderConfigOGL config = ShaderConfigFromTargetAndFormat(aTarget, aFormat); return mImpl->GetShaderProgramFor(config); } - virtual const gfx::Matrix4x4& GetProjMatrix() const override { + const gfx::Matrix4x4& GetProjMatrix() const override { return mImpl->GetProjMatrix(); } - virtual void BindAndDrawQuad(ShaderProgramOGL* aProg, - const gfx::Rect& aLayerRect, - const gfx::Rect& aTextureRect) override { + void BindAndDrawQuad(ShaderProgramOGL* aProg, const gfx::Rect& aLayerRect, + const gfx::Rect& aTextureRect) override { mImpl->BindAndDrawQuad(aProg, aLayerRect, aTextureRect); } diff --git a/gfx/layers/opengl/GLManager.h b/gfx/layers/opengl/GLManager.h index b57e2c76d160..85f19767f72d 100644 --- a/gfx/layers/opengl/GLManager.h +++ b/gfx/layers/opengl/GLManager.h @@ -30,7 +30,7 @@ class GLManager { public: static GLManager* CreateGLManager(LayerManagerComposite* aManager); - virtual ~GLManager() {} + virtual ~GLManager() = default; virtual gl::GLContext* gl() const = 0; virtual ShaderProgramOGL* GetProgram(GLenum aTarget, diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h index bf4343180e1f..bfee241b4ec7 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h +++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h @@ -25,21 +25,21 @@ class MacIOSurfaceTextureData : public TextureData { ~MacIOSurfaceTextureData(); - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual bool Lock(OpenMode) override; + bool Lock(OpenMode) override; - virtual void Unlock() override; + void Unlock() override; - virtual already_AddRefed BorrowDrawTarget() override; + already_AddRefed BorrowDrawTarget() override; - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - virtual void Deallocate(LayersIPCChannel*) override; + void Deallocate(LayersIPCChannel*) override; - virtual void Forget(LayersIPCChannel*) override; + void Forget(LayersIPCChannel*) override; - virtual bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; + bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; // For debugging purposes only. already_AddRefed GetAsSurface(); diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h index 0a55836c4289..672737459bba 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h @@ -7,10 +7,10 @@ #ifndef MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H #define MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H +#include "MacIOSurfaceHelpers.h" +#include "mozilla/gfx/2D.h" #include "mozilla/layers/CompositorOGL.h" #include "mozilla/layers/TextureHostOGL.h" -#include "mozilla/gfx/2D.h" -#include "MacIOSurfaceHelpers.h" class MacIOSurface; @@ -29,23 +29,21 @@ class MacIOSurfaceTextureHostOGL : public TextureHost { virtual ~MacIOSurfaceTextureHostOGL(); // MacIOSurfaceTextureSourceOGL doesn't own any GL texture - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual gfx::SurfaceFormat GetFormat() const override; - virtual gfx::SurfaceFormat GetReadFormat() const override; + gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetReadFormat() const override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override { + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override { aTexture = mTextureSource; return !!aTexture; } - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { RefPtr surf = CreateSourceSurfaceFromMacIOSurface(GetMacIOSurface()); return surf->GetDataSurface(); @@ -53,33 +51,32 @@ class MacIOSurfaceTextureHostOGL : public TextureHost { gl::GLContext* gl() const; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; #ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "MacIOSurfaceTextureHostOGL"; } + const char* Name() override { return "MacIOSurfaceTextureHostOGL"; } #endif - virtual MacIOSurfaceTextureHostOGL* AsMacIOSurfaceTextureHost() override { + MacIOSurfaceTextureHostOGL* AsMacIOSurfaceTextureHost() override { return this; } - virtual MacIOSurface* GetMacIOSurface() override { return mSurface; } + MacIOSurface* GetMacIOSurface() override { return mSurface; } - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual uint32_t NumSubTextures() const override; + uint32_t NumSubTextures() const override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; gfx::YUVColorSpace GetYUVColorSpace() const override; diff --git a/gfx/layers/opengl/TextureClientOGL.h b/gfx/layers/opengl/TextureClientOGL.h index 80dbd5077287..f1abf015cc59 100644 --- a/gfx/layers/opengl/TextureClientOGL.h +++ b/gfx/layers/opengl/TextureClientOGL.h @@ -41,19 +41,19 @@ class AndroidSurfaceTextureData : public TextureData { gl::OriginPos aOriginPos, bool aHasAlpha, LayersIPCChannel* aAllocator, TextureFlags aFlags); - ~AndroidSurfaceTextureData(); + virtual ~AndroidSurfaceTextureData(); - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; // Useless functions. - virtual bool Lock(OpenMode) override { return true; } + bool Lock(OpenMode) override { return true; } - virtual void Unlock() override {} + void Unlock() override {} // Our data is always owned externally. - virtual void Deallocate(LayersIPCChannel*) override {} + void Deallocate(LayersIPCChannel*) override {} protected: AndroidSurfaceTextureData(AndroidSurfaceTextureHandle aHandle, @@ -71,19 +71,19 @@ class AndroidNativeWindowTextureData : public TextureData { static AndroidNativeWindowTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat); - virtual void FillInfo(TextureData::Info& aInfo) const override; + void FillInfo(TextureData::Info& aInfo) const override; - virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override; + bool Serialize(SurfaceDescriptor& aOutDescriptor) override; - virtual bool Lock(OpenMode) override; - virtual void Unlock() override; + bool Lock(OpenMode) override; + void Unlock() override; - virtual void Forget(LayersIPCChannel*) override; - virtual void Deallocate(LayersIPCChannel*) override {} + void Forget(LayersIPCChannel*) override; + void Deallocate(LayersIPCChannel*) override {} - virtual already_AddRefed BorrowDrawTarget() override; + already_AddRefed BorrowDrawTarget() override; - virtual void OnForwardedToHost() override; + void OnForwardedToHost() override; protected: AndroidNativeWindowTextureData(java::GeckoSurface::Param aSurface, diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h index 543665a60c97..0d335671a87f 100644 --- a/gfx/layers/opengl/TextureHostOGL.h +++ b/gfx/layers/opengl/TextureHostOGL.h @@ -144,59 +144,54 @@ class TextureImageTextureSourceOGL final : public DataTextureSource, explicit TextureImageTextureSourceOGL( CompositorOGL* aCompositor, TextureFlags aFlags = TextureFlags::DEFAULT); - virtual const char* Name() const override { - return "TextureImageTextureSourceOGL"; - } + const char* Name() const override { return "TextureImageTextureSourceOGL"; } // DataTextureSource - virtual bool Update(gfx::DataSourceSurface* aSurface, - nsIntRegion* aDestRegion = nullptr, - gfx::IntPoint* aSrcOffset = nullptr) override; + bool Update(gfx::DataSourceSurface* aSurface, + nsIntRegion* aDestRegion = nullptr, + gfx::IntPoint* aSrcOffset = nullptr) override; void EnsureBuffer(const gfx::IntSize& aSize, gfxContentType aContentType); - virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() override { + TextureImageTextureSourceOGL* AsTextureImageTextureSource() override { return this; } // TextureSource - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual TextureSourceOGL* AsSourceOGL() override { return this; } + TextureSourceOGL* AsSourceOGL() override { return this; } - virtual void BindTexture(GLenum aTextureUnit, - gfx::SamplingFilter aSamplingFilter) override; + void BindTexture(GLenum aTextureUnit, + gfx::SamplingFilter aSamplingFilter) override; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual bool IsValid() const override { return !!mTexImage; } + bool IsValid() const override { return !!mTexImage; } - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual GLenum GetWrapMode() const override { - return mTexImage->GetWrapMode(); - } + GLenum GetWrapMode() const override { return mTexImage->GetWrapMode(); } // BigImageIterator - virtual BigImageIterator* AsBigImageIterator() override { return this; } + BigImageIterator* AsBigImageIterator() override { return this; } - virtual void BeginBigImageIteration() override { + void BeginBigImageIteration() override { mTexImage->BeginBigImageIteration(); mIterating = true; } - virtual void EndBigImageIteration() override { mIterating = false; } + void EndBigImageIteration() override { mIterating = false; } - virtual gfx::IntRect GetTileRect() override; + gfx::IntRect GetTileRect() override; - virtual size_t GetTileCount() override { return mTexImage->GetTileCount(); } + size_t GetTileCount() override { return mTexImage->GetTileCount(); } - virtual bool NextTile() override { return mTexImage->NextTile(); } + bool NextTile() override { return mTexImage->NextTile(); } protected: ~TextureImageTextureSourceOGL(); @@ -224,29 +219,28 @@ class GLTextureSource : public DataTextureSource, public TextureSourceOGL { virtual ~GLTextureSource(); - virtual const char* Name() const override { return "GLTextureSource"; } + const char* Name() const override { return "GLTextureSource"; } - virtual GLTextureSource* AsGLTextureSource() override { return this; } + GLTextureSource* AsGLTextureSource() override { return this; } - virtual TextureSourceOGL* AsSourceOGL() override { return this; } + TextureSourceOGL* AsSourceOGL() override { return this; } - virtual void BindTexture(GLenum activetex, - gfx::SamplingFilter aSamplingFilter) override; + void BindTexture(GLenum activetex, + gfx::SamplingFilter aSamplingFilter) override; - virtual bool IsValid() const override; + bool IsValid() const override; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; } + gfx::SurfaceFormat GetFormat() const override { return mFormat; } - virtual GLenum GetTextureTarget() const override { return mTextureTarget; } + GLenum GetTextureTarget() const override { return mTextureTarget; } - virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; } + GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; } - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; void SetSize(gfx::IntSize aSize) { mSize = aSize; } @@ -256,9 +250,9 @@ class GLTextureSource : public DataTextureSource, public TextureSourceOGL { gl::GLContext* gl() const { return mGL; } - virtual bool Update(gfx::DataSourceSurface* aSurface, - nsIntRegion* aDestRegion = nullptr, - gfx::IntPoint* aSrcOffset = nullptr) override { + bool Update(gfx::DataSourceSurface* aSurface, + nsIntRegion* aDestRegion = nullptr, + gfx::IntPoint* aSrcOffset = nullptr) override { return false; } @@ -284,18 +278,18 @@ class DirectMapTextureSource : public GLTextureSource { gfx::DataSourceSurface* aSurface); ~DirectMapTextureSource(); - virtual bool Update(gfx::DataSourceSurface* aSurface, - nsIntRegion* aDestRegion = nullptr, - gfx::IntPoint* aSrcOffset = nullptr) override; + bool Update(gfx::DataSourceSurface* aSurface, + nsIntRegion* aDestRegion = nullptr, + gfx::IntPoint* aSrcOffset = nullptr) override; - virtual bool IsDirectMap() override { return true; } + bool IsDirectMap() override { return true; } // If aBlocking is false, check if this texture is no longer being used // by the GPU - if aBlocking is true, this will block until the GPU is // done with it. - virtual bool Sync(bool aBlocking) override; + bool Sync(bool aBlocking) override; - virtual void MaybeFenceTexture() override; + void MaybeFenceTexture() override; private: bool UpdateInternal(gfx::DataSourceSurface* aSurface, @@ -313,32 +307,30 @@ class GLTextureHost : public TextureHost { virtual ~GLTextureHost(); // We don't own anything. - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override {} + void Unlock() override {} - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override { + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override { aTexture = mTextureSource; return !!aTexture; } - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) } gl::GLContext* gl() const; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual const char* Name() override { return "GLTextureHost"; } + const char* Name() override { return "GLTextureHost"; } protected: const GLuint mTexture; @@ -362,29 +354,28 @@ class SurfaceTextureSource : public TextureSource, public TextureSourceOGL { GLenum aWrapMode, gfx::IntSize aSize, bool aIgnoreTransform); - virtual const char* Name() const override { return "SurfaceTextureSource"; } + const char* Name() const override { return "SurfaceTextureSource"; } - virtual TextureSourceOGL* AsSourceOGL() override { return this; } + TextureSourceOGL* AsSourceOGL() override { return this; } - virtual void BindTexture(GLenum activetex, - gfx::SamplingFilter aSamplingFilter) override; + void BindTexture(GLenum activetex, + gfx::SamplingFilter aSamplingFilter) override; - virtual bool IsValid() const override; + bool IsValid() const override; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; } + gfx::SurfaceFormat GetFormat() const override { return mFormat; } - virtual gfx::Matrix4x4 GetTextureTransform() override; + gfx::Matrix4x4 GetTextureTransform() override; - virtual GLenum GetTextureTarget() const override { return mTextureTarget; } + GLenum GetTextureTarget() const override { return mTextureTarget; } - virtual GLenum GetWrapMode() const override { return mWrapMode; } + GLenum GetWrapMode() const override { return mWrapMode; } - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; gl::GLContext* gl() const { return mGL; } @@ -407,51 +398,47 @@ class SurfaceTextureHost : public TextureHost { virtual ~SurfaceTextureHost(); - virtual void PrepareTextureSource( - CompositableTextureSourceRef& aTexture) override; + void PrepareTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual void NotifyNotUsed() override; + void NotifyNotUsed() override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override { + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override { aTexture = mTextureSource; return !!aTexture; } - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) } gl::GLContext* gl() const; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual const char* Name() override { return "SurfaceTextureHost"; } + const char* Name() override { return "SurfaceTextureHost"; } - virtual SurfaceTextureHost* AsSurfaceTextureHost() override { return this; } + SurfaceTextureHost* AsSurfaceTextureHost() override { return this; } - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; protected: bool EnsureAttached(); @@ -476,30 +463,29 @@ class EGLImageTextureSource : public TextureSource, public TextureSourceOGL { gfx::SurfaceFormat aFormat, GLenum aTarget, GLenum aWrapMode, gfx::IntSize aSize); - virtual const char* Name() const override { return "EGLImageTextureSource"; } + const char* Name() const override { return "EGLImageTextureSource"; } - virtual TextureSourceOGL* AsSourceOGL() override { return this; } + TextureSourceOGL* AsSourceOGL() override { return this; } - virtual void BindTexture(GLenum activetex, - gfx::SamplingFilter aSamplingFilter) override; + void BindTexture(GLenum activetex, + gfx::SamplingFilter aSamplingFilter) override; - virtual bool IsValid() const override; + bool IsValid() const override; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; } + gfx::SurfaceFormat GetFormat() const override { return mFormat; } - virtual gfx::Matrix4x4 GetTextureTransform() override; + gfx::Matrix4x4 GetTextureTransform() override; - virtual GLenum GetTextureTarget() const override { return mTextureTarget; } + GLenum GetTextureTarget() const override { return mTextureTarget; } - virtual GLenum GetWrapMode() const override { return mWrapMode; } + GLenum GetWrapMode() const override { return mWrapMode; } // We don't own anything. - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; gl::GLContext* gl() const { return mGL; } @@ -521,45 +507,43 @@ class EGLImageTextureHost final : public TextureHost { virtual ~EGLImageTextureHost(); // We don't own anything. - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override { + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override { aTexture = mTextureSource; return !!aTexture; } - virtual already_AddRefed GetAsSurface() override { + already_AddRefed GetAsSurface() override { return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) } gl::GLContext* gl() const; - virtual gfx::IntSize GetSize() const override { return mSize; } + gfx::IntSize GetSize() const override { return mSize; } - virtual const char* Name() override { return "EGLImageTextureHost"; } + const char* Name() override { return "EGLImageTextureHost"; } - virtual void CreateRenderTexture( + void CreateRenderTexture( const wr::ExternalImageId& aExternalImageId) override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; protected: const EGLImage mImage; diff --git a/gfx/layers/opengl/X11TextureSourceOGL.h b/gfx/layers/opengl/X11TextureSourceOGL.h index 0359c5e01cd2..34ab8d5638b6 100644 --- a/gfx/layers/opengl/X11TextureSourceOGL.h +++ b/gfx/layers/opengl/X11TextureSourceOGL.h @@ -23,29 +23,26 @@ class X11TextureSourceOGL : public TextureSourceOGL, public X11TextureSource { X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface); ~X11TextureSourceOGL(); - virtual X11TextureSourceOGL* AsSourceOGL() override { return this; } + X11TextureSourceOGL* AsSourceOGL() override { return this; } - virtual bool IsValid() const override { return !!gl(); }; + bool IsValid() const override { return !!gl(); }; - virtual void BindTexture(GLenum aTextureUnit, - gfx::SamplingFilter aSamplingFilter) override; + void BindTexture(GLenum aTextureUnit, + gfx::SamplingFilter aSamplingFilter) override; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; - virtual GLenum GetTextureTarget() const override { - return LOCAL_GL_TEXTURE_2D; - } + GLenum GetTextureTarget() const override { return LOCAL_GL_TEXTURE_2D; } - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; - virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; } + GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; } - virtual void DeallocateDeviceData() override; + void DeallocateDeviceData() override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual void Updated() override { mUpdated = true; } + void Updated() override { mUpdated = true; } gl::GLContext* gl() const { return mGL; } diff --git a/gfx/layers/wr/WebRenderBridgeChild.h b/gfx/layers/wr/WebRenderBridgeChild.h index 34c33ba17d26..f61448fb6fc8 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.h +++ b/gfx/layers/wr/WebRenderBridgeChild.h @@ -166,9 +166,9 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild, ipc::IShmemAllocator* GetShmemAllocator(); - virtual bool IsThreadSafe() const override { return false; } + bool IsThreadSafe() const override { return false; } - virtual RefPtr GetForMedia() override; + RefPtr GetForMedia() override; /// Alloc a specific type of shmem that is intended for use in /// IpcResourceUpdateQueue only, and cache at most one of them, diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index a2aeab715741..dbc6612ac7cc 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -182,7 +182,7 @@ class ScheduleObserveLayersUpdate : public wr::NotificationHandler { mObserverEpoch(aEpoch), mIsActive(aIsActive) {} - virtual void Notify(wr::Checkpoint) override { + void Notify(wr::Checkpoint) override { CompositorThreadHolder::Loop()->PostTask( NewRunnableMethod( "ObserveLayersUpdate", mBridge, @@ -199,11 +199,11 @@ class ScheduleObserveLayersUpdate : public wr::NotificationHandler { class SceneBuiltNotification : public wr::NotificationHandler { public: - explicit SceneBuiltNotification(WebRenderBridgeParent* aParent, - wr::Epoch aEpoch, TimeStamp aTxnStartTime) + SceneBuiltNotification(WebRenderBridgeParent* aParent, wr::Epoch aEpoch, + TimeStamp aTxnStartTime) : mParent(aParent), mEpoch(aEpoch), mTxnStartTime(aTxnStartTime) {} - virtual void Notify(wr::Checkpoint) override { + void Notify(wr::Checkpoint) override { auto startTime = this->mTxnStartTime; RefPtr parent = mParent; wr::Epoch epoch = mEpoch; @@ -217,9 +217,9 @@ class SceneBuiltNotification : public wr::NotificationHandler { ContentFullPaintPayload(const mozilla::TimeStamp& aStartTime, const mozilla::TimeStamp& aEndTime) : ProfilerMarkerPayload(aStartTime, aEndTime) {} - virtual void StreamPayload(SpliceableJSONWriter& aWriter, - const TimeStamp& aProcessStartTime, - UniqueStacks& aUniqueStacks) override { + void StreamPayload(SpliceableJSONWriter& aWriter, + const TimeStamp& aProcessStartTime, + UniqueStacks& aUniqueStacks) override { StreamCommonProps("CONTENT_FULL_PAINT_TIME", aWriter, aProcessStartTime, aUniqueStacks); } @@ -267,7 +267,7 @@ class WebRenderBridgeParent::ScheduleSharedSurfaceRelease final nsTArray mSurfaces; }; -class MOZ_STACK_CLASS AutoWebRenderBridgeParentAsyncMessageSender { +class MOZ_STACK_CLASS AutoWebRenderBridgeParentAsyncMessageSender final { public: explicit AutoWebRenderBridgeParentAsyncMessageSender( WebRenderBridgeParent* aWebRenderBridgeParent, @@ -357,8 +357,6 @@ WebRenderBridgeParent* WebRenderBridgeParent::CreateDestroyed( return new WebRenderBridgeParent(aPipelineId); } -WebRenderBridgeParent::~WebRenderBridgeParent() {} - mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEnsureConnected( TextureFactoryIdentifier* aTextureFactoryIdentifier, MaybeIdNamespace* aMaybeIdNamespace) { diff --git a/gfx/layers/wr/WebRenderBridgeParent.h b/gfx/layers/wr/WebRenderBridgeParent.h index 4c4b27d900ed..769be9abc989 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.h +++ b/gfx/layers/wr/WebRenderBridgeParent.h @@ -271,7 +271,7 @@ class WebRenderBridgeParent final class ScheduleSharedSurfaceRelease; explicit WebRenderBridgeParent(const wr::PipelineId& aPipelineId); - virtual ~WebRenderBridgeParent(); + virtual ~WebRenderBridgeParent() = default; wr::WebRenderAPI* Api(wr::RenderRoot aRenderRoot) { if (IsRootWebRenderBridgeParent()) { diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index a919876a831f..d59f3248fd4f 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -1071,12 +1071,11 @@ void WebRenderScrollDataCollection::AppendScrollData( class WebRenderGroupData : public WebRenderUserData { public: - explicit WebRenderGroupData(RenderRootStateManager* aWRManager, - nsDisplayItem* aItem); + WebRenderGroupData(RenderRootStateManager* aWRManager, nsDisplayItem* aItem); virtual ~WebRenderGroupData(); - virtual WebRenderGroupData* AsGroupData() override { return this; } - virtual UserDataType GetType() override { return UserDataType::eGroup; } + WebRenderGroupData* AsGroupData() override { return this; } + UserDataType GetType() override { return UserDataType::eGroup; } static UserDataType Type() { return UserDataType::eGroup; } DIGroup mSubGroup; @@ -2340,7 +2339,7 @@ class WebRenderMaskData : public WebRenderUserData { mBlobKey.reset(); } - virtual UserDataType GetType() override { return UserDataType::eMask; } + UserDataType GetType() override { return UserDataType::eMask; } static UserDataType Type() { return UserDataType::eMask; } Maybe mBlobKey; diff --git a/gfx/layers/wr/WebRenderCommandBuilder.h b/gfx/layers/wr/WebRenderCommandBuilder.h index 729db52f9f2f..68e343def23b 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.h +++ b/gfx/layers/wr/WebRenderCommandBuilder.h @@ -76,7 +76,7 @@ class WebRenderScrollDataCollection { wr::RenderRootArray mSeenRenderRoot; }; -class WebRenderCommandBuilder { +class WebRenderCommandBuilder final { typedef nsTHashtable> WebRenderUserDataRefTable; typedef nsTHashtable> CanvasDataSet; diff --git a/gfx/layers/wr/WebRenderDrawEventRecorder.h b/gfx/layers/wr/WebRenderDrawEventRecorder.h index d8a4a57735c7..b08ff5b959e9 100644 --- a/gfx/layers/wr/WebRenderDrawEventRecorder.h +++ b/gfx/layers/wr/WebRenderDrawEventRecorder.h @@ -30,7 +30,7 @@ class WebRenderDrawEventRecorder final : public gfx::DrawEventRecorderMemory { const char* aReason) final; private: - ~WebRenderDrawEventRecorder() override {} + virtual ~WebRenderDrawEventRecorder() = default; }; class WebRenderTranslator final : public gfx::InlineTranslator { diff --git a/gfx/layers/wr/WebRenderImageHost.h b/gfx/layers/wr/WebRenderImageHost.h index 41849d15c61b..dc29b4369faf 100644 --- a/gfx/layers/wr/WebRenderImageHost.h +++ b/gfx/layers/wr/WebRenderImageHost.h @@ -22,53 +22,48 @@ class WebRenderBridgeParent; class WebRenderImageHost : public CompositableHost, public ImageComposite { public: explicit WebRenderImageHost(const TextureInfo& aTextureInfo); - ~WebRenderImageHost(); + virtual ~WebRenderImageHost(); - virtual CompositableType GetType() override { - return mTextureInfo.mCompositableType; - } + CompositableType GetType() override { return mTextureInfo.mCompositableType; } - virtual void Composite( - Compositor* aCompositor, LayerComposite* aLayer, - EffectChain& aEffectChain, float aOpacity, - const gfx::Matrix4x4& aTransform, - const gfx::SamplingFilter aSamplingFilter, const gfx::IntRect& aClipRect, - const nsIntRegion* aVisibleRegion = nullptr, - const Maybe& aGeometry = Nothing()) override; + void Composite(Compositor* aCompositor, LayerComposite* aLayer, + EffectChain& aEffectChain, float aOpacity, + const gfx::Matrix4x4& aTransform, + const gfx::SamplingFilter aSamplingFilter, + const gfx::IntRect& aClipRect, + const nsIntRegion* aVisibleRegion = nullptr, + const Maybe& aGeometry = Nothing()) override; - virtual void UseTextureHost(const nsTArray& aTextures) override; - virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack, - TextureHost* aTextureOnWhite) override; - virtual void RemoveTextureHost(TextureHost* aTexture) override; + void UseTextureHost(const nsTArray& aTextures) override; + void UseComponentAlphaTextures(TextureHost* aTextureOnBlack, + TextureHost* aTextureOnWhite) override; + void RemoveTextureHost(TextureHost* aTexture) override; - virtual TextureHost* GetAsTextureHost( - gfx::IntRect* aPictureRect = nullptr) override; + TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) override; - virtual void Attach(Layer* aLayer, TextureSourceProvider* aProvider, - AttachFlags aFlags = NO_FLAGS) override; + void Attach(Layer* aLayer, TextureSourceProvider* aProvider, + AttachFlags aFlags = NO_FLAGS) override; - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; gfx::IntSize GetImageSize() override; - virtual void PrintInfo(std::stringstream& aStream, - const char* aPrefix) override; + void PrintInfo(std::stringstream& aStream, const char* aPrefix) override; - virtual void Dump(std::stringstream& aStream, const char* aPrefix = "", - bool aDumpHtml = false) override; + void Dump(std::stringstream& aStream, const char* aPrefix = "", + bool aDumpHtml = false) override; - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual void CleanupResources() override; + void CleanupResources() override; uint32_t GetDroppedFrames() override { return GetDroppedFramesAndReset(); } - virtual WebRenderImageHost* AsWebRenderImageHost() override { return this; } + WebRenderImageHost* AsWebRenderImageHost() override { return this; } TextureHost* GetAsTextureHostForComposite(); @@ -80,7 +75,7 @@ class WebRenderImageHost : public CompositableHost, public ImageComposite { protected: // ImageComposite - virtual TimeStamp GetCompositionTime() const override; + TimeStamp GetCompositionTime() const override; void SetCurrentTextureHost(TextureHost* aTexture); diff --git a/gfx/layers/wr/WebRenderLayerManager.h b/gfx/layers/wr/WebRenderLayerManager.h index 40f819e4f751..cae88990c59e 100644 --- a/gfx/layers/wr/WebRenderLayerManager.h +++ b/gfx/layers/wr/WebRenderLayerManager.h @@ -57,7 +57,7 @@ class WebRenderLayerManager final : public LayerManager { bool Initialize(PCompositorBridgeChild* aCBChild, wr::PipelineId aLayersId, TextureFactoryIdentifier* aTextureFactoryIdentifier); - virtual void Destroy() override; + void Destroy() override; void DoDestroy(bool aIsSync); @@ -65,35 +65,31 @@ class WebRenderLayerManager final : public LayerManager { virtual ~WebRenderLayerManager(); public: - virtual KnowsCompositor* AsKnowsCompositor() override; + KnowsCompositor* AsKnowsCompositor() override; WebRenderLayerManager* AsWebRenderLayerManager() override { return this; } - virtual CompositorBridgeChild* GetCompositorBridgeChild() override; + CompositorBridgeChild* GetCompositorBridgeChild() override; // WebRender can handle images larger than the max texture size via tiling. - virtual int32_t GetMaxTextureSize() const override { return INT32_MAX; } + int32_t GetMaxTextureSize() const override { return INT32_MAX; } - virtual bool BeginTransactionWithTarget(gfxContext* aTarget, - const nsCString& aURL) override; - virtual bool BeginTransaction(const nsCString& aURL) override; - virtual bool EndEmptyTransaction( - EndTransactionFlags aFlags = END_DEFAULT) override; + bool BeginTransactionWithTarget(gfxContext* aTarget, + const nsCString& aURL) override; + bool BeginTransaction(const nsCString& aURL) override; + bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override; void EndTransactionWithoutLayer( nsDisplayList* aDisplayList, nsDisplayListBuilder* aDisplayListBuilder, WrFiltersHolder&& aFilters = WrFiltersHolder(), WebRenderBackgroundData* aBackground = nullptr); - virtual void EndTransaction( - DrawPaintedLayerCallback aCallback, void* aCallbackData, - EndTransactionFlags aFlags = END_DEFAULT) override; + void EndTransaction(DrawPaintedLayerCallback aCallback, void* aCallbackData, + EndTransactionFlags aFlags = END_DEFAULT) override; - virtual LayersBackend GetBackendType() override { - return LayersBackend::LAYERS_WR; - } - virtual void GetBackendName(nsAString& name) override { + LayersBackend GetBackendType() override { return LayersBackend::LAYERS_WR; } + void GetBackendName(nsAString& name) override { name.AssignLiteral("WebRender"); } - virtual const char* Name() const override { return "WebRender"; } + const char* Name() const override { return "WebRender"; } - virtual void SetRoot(Layer* aLayer) override; + void SetRoot(Layer* aLayer) override; already_AddRefed CreatePaintedLayer() override { return nullptr; @@ -105,46 +101,42 @@ class WebRenderLayerManager final : public LayerManager { already_AddRefed CreateColorLayer() override { return nullptr; } already_AddRefed CreateCanvasLayer() override { return nullptr; } - virtual bool NeedsWidgetInvalidation() override { return false; } + bool NeedsWidgetInvalidation() override { return false; } - virtual void SetLayersObserverEpoch(LayersObserverEpoch aEpoch) override; + void SetLayersObserverEpoch(LayersObserverEpoch aEpoch) override; - virtual void DidComposite(TransactionId aTransactionId, - const mozilla::TimeStamp& aCompositeStart, - const mozilla::TimeStamp& aCompositeEnd) override; + void DidComposite(TransactionId aTransactionId, + const mozilla::TimeStamp& aCompositeStart, + const mozilla::TimeStamp& aCompositeEnd) override; - virtual void ClearCachedResources(Layer* aSubtree = nullptr) override; - virtual void UpdateTextureFactoryIdentifier( + void ClearCachedResources(Layer* aSubtree = nullptr) override; + void UpdateTextureFactoryIdentifier( const TextureFactoryIdentifier& aNewIdentifier) override; - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override; + TextureFactoryIdentifier GetTextureFactoryIdentifier() override; - virtual void SetTransactionIdAllocator( - TransactionIdAllocator* aAllocator) override; - virtual TransactionId GetLastTransactionId() override; + void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) override; + TransactionId GetLastTransactionId() override; - virtual void AddDidCompositeObserver( - DidCompositeObserver* aObserver) override; - virtual void RemoveDidCompositeObserver( - DidCompositeObserver* aObserver) override; + void AddDidCompositeObserver(DidCompositeObserver* aObserver) override; + void RemoveDidCompositeObserver(DidCompositeObserver* aObserver) override; - virtual void FlushRendering() override; - virtual void WaitOnTransactionProcessed() override; + void FlushRendering() override; + void WaitOnTransactionProcessed() override; - virtual void SendInvalidRegion(const nsIntRegion& aRegion) override; + void SendInvalidRegion(const nsIntRegion& aRegion) override; - virtual void ScheduleComposite() override; + void ScheduleComposite() override; - virtual void SetNeedsComposite(bool aNeedsComposite) override { + void SetNeedsComposite(bool aNeedsComposite) override { mNeedsComposite = aNeedsComposite; } - virtual bool NeedsComposite() const override { return mNeedsComposite; } - virtual void SetIsFirstPaint() override { mIsFirstPaint = true; } - virtual bool GetIsFirstPaint() const override { return mIsFirstPaint; } - virtual void SetFocusTarget(const FocusTarget& aFocusTarget) override; + bool NeedsComposite() const override { return mNeedsComposite; } + void SetIsFirstPaint() override { mIsFirstPaint = true; } + bool GetIsFirstPaint() const override { return mIsFirstPaint; } + void SetFocusTarget(const FocusTarget& aFocusTarget) override; - virtual already_AddRefed - CreatePersistentBufferProvider(const gfx::IntSize& aSize, - gfx::SurfaceFormat aFormat) override; + already_AddRefed CreatePersistentBufferProvider( + const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) override; bool AsyncPanZoomEnabled() const override; diff --git a/gfx/layers/wr/WebRenderScrollData.cpp b/gfx/layers/wr/WebRenderScrollData.cpp index 6356397e403d..c49ba5fc4acd 100644 --- a/gfx/layers/wr/WebRenderScrollData.cpp +++ b/gfx/layers/wr/WebRenderScrollData.cpp @@ -144,8 +144,6 @@ WebRenderScrollData::WebRenderScrollData() WebRenderScrollData::WebRenderScrollData(WebRenderLayerManager* aManager) : mManager(aManager), mIsFirstPaint(false), mPaintSequenceNumber(0) {} -WebRenderScrollData::~WebRenderScrollData() {} - WebRenderLayerManager* WebRenderScrollData::GetManager() const { return mManager; } diff --git a/gfx/layers/wr/WebRenderScrollData.h b/gfx/layers/wr/WebRenderScrollData.h index 5159fa4b9cb1..5924d614271f 100644 --- a/gfx/layers/wr/WebRenderScrollData.h +++ b/gfx/layers/wr/WebRenderScrollData.h @@ -40,7 +40,7 @@ class WebRenderScrollData; // each layer in the layer tree and sent over PWebRenderBridge to the APZ code. // Each WebRenderLayerScrollData is conceptually associated with an "owning" // WebRenderScrollData. -class WebRenderLayerScrollData { +class WebRenderLayerScrollData final { public: WebRenderLayerScrollData(); // needed for IPC purposes ~WebRenderLayerScrollData(); @@ -161,11 +161,10 @@ class WebRenderLayerScrollData { // is created for each transaction sent over PWebRenderBridge. It is populated // with information from the WebRender layer tree on the client side and the // information is used by APZ on the parent side. -class WebRenderScrollData { +class WebRenderScrollData final { public: WebRenderScrollData(); explicit WebRenderScrollData(WebRenderLayerManager* aManager); - ~WebRenderScrollData(); WebRenderLayerManager* GetManager() const; diff --git a/gfx/layers/wr/WebRenderScrollDataWrapper.h b/gfx/layers/wr/WebRenderScrollDataWrapper.h index adc88b6c4aa2..fb1e02d49d2b 100644 --- a/gfx/layers/wr/WebRenderScrollDataWrapper.h +++ b/gfx/layers/wr/WebRenderScrollDataWrapper.h @@ -40,7 +40,7 @@ namespace layers { * * Refer to LayerMetricsWrapper.h for actual documentation on the exposed API. */ -class MOZ_STACK_CLASS WebRenderScrollDataWrapper { +class MOZ_STACK_CLASS WebRenderScrollDataWrapper final { public: // Basic constructor for external callers. Starts the walker at the root of // the tree. diff --git a/gfx/layers/wr/WebRenderTextureHost.h b/gfx/layers/wr/WebRenderTextureHost.h index 115eff8182e7..cf4d3b623f10 100644 --- a/gfx/layers/wr/WebRenderTextureHost.h +++ b/gfx/layers/wr/WebRenderTextureHost.h @@ -28,16 +28,15 @@ class WebRenderTextureHost : public TextureHost { wr::ExternalImageId& aExternalImageId); virtual ~WebRenderTextureHost(); - virtual void DeallocateDeviceData() override {} + void DeallocateDeviceData() override {} - virtual void SetTextureSourceProvider( - TextureSourceProvider* aProvider) override; + void SetTextureSourceProvider(TextureSourceProvider* aProvider) override; - virtual bool Lock() override; + bool Lock() override; - virtual void Unlock() override; + void Unlock() override; - virtual gfx::SurfaceFormat GetFormat() const override; + gfx::SurfaceFormat GetFormat() const override; virtual void NotifyNotUsed() override; @@ -45,24 +44,21 @@ class WebRenderTextureHost : public TextureHost { // textureHosts use their special data representation internally, but we could // treat these textureHost as the read-format when we read them. // Please check TextureHost::GetReadFormat(). - virtual gfx::SurfaceFormat GetReadFormat() const override; + gfx::SurfaceFormat GetReadFormat() const override; - virtual bool BindTextureSource( - CompositableTextureSourceRef& aTexture) override; + bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; - virtual already_AddRefed GetAsSurface() override; + already_AddRefed GetAsSurface() override; - virtual gfx::YUVColorSpace GetYUVColorSpace() const override; + gfx::YUVColorSpace GetYUVColorSpace() const override; - virtual gfx::IntSize GetSize() const override; + gfx::IntSize GetSize() const override; #ifdef MOZ_LAYERS_HAVE_LOG - virtual const char* Name() override { return "WebRenderTextureHost"; } + const char* Name() override { return "WebRenderTextureHost"; } #endif - virtual WebRenderTextureHost* AsWebRenderTextureHost() override { - return this; - } + WebRenderTextureHost* AsWebRenderTextureHost() override { return this; } virtual void PrepareForUse(); @@ -70,22 +66,21 @@ class WebRenderTextureHost : public TextureHost { int32_t GetRGBStride(); - virtual bool HasIntermediateBuffer() const override; + bool HasIntermediateBuffer() const override; - virtual uint32_t NumSubTextures() const override; + uint32_t NumSubTextures() const override; - virtual void PushResourceUpdates(wr::TransactionBuilder& aResources, - ResourceUpdateOp aOp, - const Range& aImageKeys, - const wr::ExternalImageId& aExtID) override; + void PushResourceUpdates(wr::TransactionBuilder& aResources, + ResourceUpdateOp aOp, + const Range& aImageKeys, + const wr::ExternalImageId& aExtID) override; - virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder, - const wr::LayoutRect& aBounds, - const wr::LayoutRect& aClip, - wr::ImageRendering aFilter, - const Range& aImageKeys) override; + void PushDisplayItems(wr::DisplayListBuilder& aBuilder, + const wr::LayoutRect& aBounds, + const wr::LayoutRect& aClip, wr::ImageRendering aFilter, + const Range& aImageKeys) override; - virtual bool SupportsWrNativeTexture() override; + bool SupportsWrNativeTexture() override; protected: void CreateRenderTextureHost(const SurfaceDescriptor& aDesc, diff --git a/gfx/layers/wr/WebRenderUserData.h b/gfx/layers/wr/WebRenderUserData.h index 4f81c01f95ef..fd219c11350a 100644 --- a/gfx/layers/wr/WebRenderUserData.h +++ b/gfx/layers/wr/WebRenderUserData.h @@ -134,8 +134,8 @@ class WebRenderImageData : public WebRenderUserData { nsIFrame* aFrame); virtual ~WebRenderImageData(); - virtual WebRenderImageData* AsImageData() override { return this; } - virtual UserDataType GetType() override { return UserDataType::eImage; } + WebRenderImageData* AsImageData() override { return this; } + UserDataType GetType() override { return UserDataType::eImage; } static UserDataType Type() { return UserDataType::eImage; } Maybe GetImageKey() { return mKey; } void SetImageKey(const wr::ImageKey& aKey); @@ -182,8 +182,8 @@ class WebRenderFallbackData : public WebRenderUserData { WebRenderFallbackData(RenderRootStateManager* aManager, nsDisplayItem* aItem); virtual ~WebRenderFallbackData(); - virtual WebRenderFallbackData* AsFallbackData() override { return this; } - virtual UserDataType GetType() override { return UserDataType::eFallback; } + WebRenderFallbackData* AsFallbackData() override { return this; } + UserDataType GetType() override { return UserDataType::eFallback; } static UserDataType Type() { return UserDataType::eFallback; } void SetInvalid(bool aInvalid) { mInvalid = aInvalid; } @@ -222,7 +222,7 @@ class WebRenderAnimationData : public WebRenderUserData { nsDisplayItem* aItem); virtual ~WebRenderAnimationData(); - virtual UserDataType GetType() override { return UserDataType::eAnimation; } + UserDataType GetType() override { return UserDataType::eAnimation; } static UserDataType Type() { return UserDataType::eAnimation; } AnimationInfo& GetAnimationInfo() { return mAnimationInfo; } @@ -235,8 +235,8 @@ class WebRenderCanvasData : public WebRenderUserData { WebRenderCanvasData(RenderRootStateManager* aManager, nsDisplayItem* aItem); virtual ~WebRenderCanvasData(); - virtual WebRenderCanvasData* AsCanvasData() override { return this; } - virtual UserDataType GetType() override { return UserDataType::eCanvas; } + WebRenderCanvasData* AsCanvasData() override { return this; } + UserDataType GetType() override { return UserDataType::eCanvas; } static UserDataType Type() { return UserDataType::eCanvas; } void ClearCanvasRenderer(); @@ -253,7 +253,7 @@ class WebRenderRenderRootData : public WebRenderUserData { nsDisplayItem* aItem); virtual ~WebRenderRenderRootData(); - virtual UserDataType GetType() override { return UserDataType::eRenderRoot; } + UserDataType GetType() override { return UserDataType::eRenderRoot; } static UserDataType Type() { return UserDataType::eRenderRoot; } RenderRootBoundary& EnsureHasBoundary(wr::RenderRoot aChildType); diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index cc9b9a845a86..0856f6588d08 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -38,7 +38,7 @@ class ObserverToDestroyFeaturesAlreadyReported final : public nsIObserver { ObserverToDestroyFeaturesAlreadyReported() {} private: - virtual ~ObserverToDestroyFeaturesAlreadyReported() {} + virtual ~ObserverToDestroyFeaturesAlreadyReported() = default; }; NS_IMPL_ISUPPORTS(ObserverToDestroyFeaturesAlreadyReported, nsIObserver) diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index d618b9df7a31..a864389f4201 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -26,8 +26,6 @@ nsFont::nsFont(StyleGenericFontFamily aGenericType, nscoord aSize) nsFont::nsFont(const nsFont& aOther) = default; -nsFont::nsFont() {} - nsFont::~nsFont() {} bool nsFont::Equals(const nsFont& aOther) const { diff --git a/gfx/src/nsFont.h b/gfx/src/nsFont.h index 52fd875d2196..c69f2478a0f6 100644 --- a/gfx/src/nsFont.h +++ b/gfx/src/nsFont.h @@ -22,7 +22,7 @@ struct gfxFontStyle; // Font structure. -struct nsFont { +struct nsFont final { typedef mozilla::FontStretch FontStretch; typedef mozilla::FontSlantStyle FontSlantStyle; typedef mozilla::FontWeight FontWeight; @@ -108,8 +108,7 @@ struct nsFont { nsFont(const nsFont& aFont); // leave members uninitialized - nsFont(); - + nsFont() = default; ~nsFont(); bool operator==(const nsFont& aOther) const { return Equals(aOther); } diff --git a/gfx/src/nsRegion.h b/gfx/src/nsRegion.h index 657e44a3e6dd..6732b682fa51 100644 --- a/gfx/src/nsRegion.h +++ b/gfx/src/nsRegion.h @@ -537,7 +537,7 @@ class nsRegion { #ifdef DEBUG_REGIONS class OperationStringGenerator { public: - virtual ~OperationStringGenerator() {} + virtual ~OperationStringGenerator() = default; virtual void OutputOp() = 0; }; diff --git a/gfx/tests/gtest/TestArena.cpp b/gfx/tests/gtest/TestArena.cpp index 1939163f3de5..455ccac97be5 100644 --- a/gfx/tests/gtest/TestArena.cpp +++ b/gfx/tests/gtest/TestArena.cpp @@ -29,7 +29,7 @@ class B; class Base { public: - virtual ~Base() {} + virtual ~Base() = default; virtual A* AsA() { return nullptr; } virtual B* AsB() { return nullptr; } }; diff --git a/gfx/tests/gtest/TestLayers.h b/gfx/tests/gtest/TestLayers.h index ac1099a0c6df..9812a39ff54e 100644 --- a/gfx/tests/gtest/TestLayers.h +++ b/gfx/tests/gtest/TestLayers.h @@ -15,8 +15,8 @@ namespace layers { class TestSurfaceAllocator final : public ISurfaceAllocator { public: - TestSurfaceAllocator() {} - ~TestSurfaceAllocator() override {} + TestSurfaceAllocator() = default; + virtual ~TestSurfaceAllocator() = default; bool IsSameProcess() const override { return true; } }; diff --git a/gfx/thebes/PrintTargetPDF.h b/gfx/thebes/PrintTargetPDF.h index 2c1e875dddd2..489f6b373abc 100644 --- a/gfx/thebes/PrintTargetPDF.h +++ b/gfx/thebes/PrintTargetPDF.h @@ -21,8 +21,8 @@ class PrintTargetPDF final : public PrintTarget { static already_AddRefed CreateOrNull( nsIOutputStream* aStream, const IntSize& aSizeInPoints); - virtual nsresult EndPage() override; - virtual void Finish() override; + nsresult EndPage() override; + void Finish() override; private: PrintTargetPDF(cairo_surface_t* aCairoSurface, const IntSize& aSize, diff --git a/gfx/thebes/PrintTargetPS.h b/gfx/thebes/PrintTargetPS.h index 7d0e43960207..82079927485c 100644 --- a/gfx/thebes/PrintTargetPS.h +++ b/gfx/thebes/PrintTargetPS.h @@ -27,10 +27,10 @@ class PrintTargetPS final : public PrintTarget { virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName, int32_t aStartPage, int32_t aEndPage) override; - virtual nsresult EndPage() override; - virtual void Finish() override; + nsresult EndPage() override; + void Finish() override; - virtual bool GetRotateForLandscape() { return (mOrientation == LANDSCAPE); } + bool GetRotateForLandscape() { return (mOrientation == LANDSCAPE); } private: PrintTargetPS(cairo_surface_t* aCairoSurface, const IntSize& aSize, diff --git a/gfx/thebes/PrintTargetRecording.h b/gfx/thebes/PrintTargetRecording.h index cf579132a040..dccf35e61568 100644 --- a/gfx/thebes/PrintTargetRecording.h +++ b/gfx/thebes/PrintTargetRecording.h @@ -23,7 +23,7 @@ class PrintTargetRecording final : public PrintTarget { static already_AddRefed CreateOrNull( const IntSize& aSize); - virtual already_AddRefed MakeDrawTarget( + already_AddRefed MakeDrawTarget( const IntSize& aSize, DrawEventRecorder* aRecorder = nullptr) override; private: diff --git a/gfx/thebes/PrintTargetSkPDF.h b/gfx/thebes/PrintTargetSkPDF.h index e4a3920405af..fe7b33f100b6 100644 --- a/gfx/thebes/PrintTargetSkPDF.h +++ b/gfx/thebes/PrintTargetSkPDF.h @@ -27,14 +27,14 @@ class PrintTargetSkPDF final : public PrintTarget { static already_AddRefed CreateOrNull( UniquePtr aStream, const IntSize& aSizeInPoints); - virtual nsresult BeginPrinting(const nsAString& aTitle, - const nsAString& aPrintToFileName, - int32_t aStartPage, int32_t aEndPage) override; - virtual nsresult EndPrinting() override; - virtual void Finish() override; + nsresult BeginPrinting(const nsAString& aTitle, + const nsAString& aPrintToFileName, int32_t aStartPage, + int32_t aEndPage) override; + nsresult EndPrinting() override; + void Finish() override; - virtual nsresult BeginPage() override; - virtual nsresult EndPage() override; + nsresult BeginPage() override; + nsresult EndPage() override; already_AddRefed MakeDrawTarget( const IntSize& aSize, DrawEventRecorder* aRecorder = nullptr) final; diff --git a/gfx/thebes/PrintTargetThebes.h b/gfx/thebes/PrintTargetThebes.h index d132927b2269..1a3b72365dfe 100644 --- a/gfx/thebes/PrintTargetThebes.h +++ b/gfx/thebes/PrintTargetThebes.h @@ -28,16 +28,16 @@ class PrintTargetThebes final : public PrintTarget { static already_AddRefed CreateOrNull( gfxASurface* aSurface); - virtual nsresult BeginPrinting(const nsAString& aTitle, - const nsAString& aPrintToFileName, - int32_t aStartPage, int32_t aEndPage) override; - virtual nsresult EndPrinting() override; - virtual nsresult AbortPrinting() override; - virtual nsresult BeginPage() override; - virtual nsresult EndPage() override; - virtual void Finish() override; + nsresult BeginPrinting(const nsAString& aTitle, + const nsAString& aPrintToFileName, int32_t aStartPage, + int32_t aEndPage) override; + nsresult EndPrinting() override; + nsresult AbortPrinting() override; + nsresult BeginPage() override; + nsresult EndPage() override; + void Finish() override; - virtual already_AddRefed MakeDrawTarget( + already_AddRefed MakeDrawTarget( const IntSize& aSize, DrawEventRecorder* aRecorder = nullptr) override; already_AddRefed GetReferenceDrawTarget() final; diff --git a/gfx/thebes/PrintTargetWindows.h b/gfx/thebes/PrintTargetWindows.h index 215addaf499d..4080835e685e 100644 --- a/gfx/thebes/PrintTargetWindows.h +++ b/gfx/thebes/PrintTargetWindows.h @@ -21,13 +21,13 @@ class PrintTargetWindows final : public PrintTarget { public: static already_AddRefed CreateOrNull(HDC aDC); - virtual nsresult BeginPrinting(const nsAString& aTitle, - const nsAString& aPrintToFileName, - int32_t aStartPage, int32_t aEndPage) override; - virtual nsresult EndPrinting() override; - virtual nsresult AbortPrinting() override; - virtual nsresult BeginPage() override; - virtual nsresult EndPage() override; + nsresult BeginPrinting(const nsAString& aTitle, + const nsAString& aPrintToFileName, int32_t aStartPage, + int32_t aEndPage) override; + nsresult EndPrinting() override; + nsresult AbortPrinting() override; + nsresult BeginPage() override; + nsresult EndPage() override; private: PrintTargetWindows(cairo_surface_t* aCairoSurface, const IntSize& aSize, diff --git a/gfx/thebes/SoftwareVsyncSource.h b/gfx/thebes/SoftwareVsyncSource.h index f9b28a755627..538b50d356e3 100644 --- a/gfx/thebes/SoftwareVsyncSource.h +++ b/gfx/thebes/SoftwareVsyncSource.h @@ -19,19 +19,17 @@ class SoftwareDisplay final : public mozilla::gfx::VsyncSource::Display { public: SoftwareDisplay(); - virtual void EnableVsync() override; - virtual void DisableVsync() override; - virtual bool IsVsyncEnabled() override; + void EnableVsync() override; + void DisableVsync() override; + bool IsVsyncEnabled() override; bool IsInSoftwareVsyncThread(); - virtual void NotifyVsync(mozilla::TimeStamp aVsyncTimestamp) override; - virtual mozilla::TimeDuration GetVsyncRate() override; + void NotifyVsync(mozilla::TimeStamp aVsyncTimestamp) override; + mozilla::TimeDuration GetVsyncRate() override; void ScheduleNextVsync(mozilla::TimeStamp aVsyncTimestamp); void Shutdown() override; - protected: - ~SoftwareDisplay(); - private: + virtual ~SoftwareDisplay(); mozilla::TimeDuration mVsyncRate; // Use a chromium thread because nsITimers* fire on the main thread base::Thread* mVsyncThread; @@ -46,9 +44,9 @@ class SoftwareDisplay final : public mozilla::gfx::VsyncSource::Display { class SoftwareVsyncSource : public mozilla::gfx::VsyncSource { public: SoftwareVsyncSource(); - ~SoftwareVsyncSource(); + virtual ~SoftwareVsyncSource(); - virtual Display& GetGlobalDisplay() override { + Display& GetGlobalDisplay() override { MOZ_ASSERT(mGlobalDisplay != nullptr); return *mGlobalDisplay; } diff --git a/gfx/thebes/VsyncSource.h b/gfx/thebes/VsyncSource.h index 0a58b387619b..ae06e1abaf7c 100644 --- a/gfx/thebes/VsyncSource.h +++ b/gfx/thebes/VsyncSource.h @@ -91,7 +91,7 @@ class VsyncSource { void Shutdown(); protected: - virtual ~VsyncSource() {} + virtual ~VsyncSource() = default; }; } // namespace gfx diff --git a/gfx/thebes/gfxASurface.h b/gfx/thebes/gfxASurface.h index 084c3a1529d3..e6b248cca013 100644 --- a/gfx/thebes/gfxASurface.h +++ b/gfx/thebes/gfxASurface.h @@ -182,8 +182,8 @@ class gfxUnknownSurface : public gfxASurface { Init(surf, true); } - virtual ~gfxUnknownSurface() {} - virtual const mozilla::gfx::IntSize GetSize() const override { return mSize; } + virtual ~gfxUnknownSurface() = default; + const mozilla::gfx::IntSize GetSize() const override { return mSize; } private: mozilla::gfx::IntSize mSize; diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp index b66c99afb9fd..cd74131d95f1 100644 --- a/gfx/thebes/gfxAndroidPlatform.cpp +++ b/gfx/thebes/gfxAndroidPlatform.cpp @@ -356,7 +356,7 @@ class AndroidVsyncSource final : public VsyncSource { Display& GetGlobalDisplay() final { return GetDisplayInstance(); } private: - virtual ~AndroidVsyncSource() {} + virtual ~AndroidVsyncSource() = default; static Display& GetDisplayInstance() { static Display globalDisplay; diff --git a/gfx/thebes/gfxAndroidPlatform.h b/gfx/thebes/gfxAndroidPlatform.h index 41f7ea1cc399..e251dea116ab 100644 --- a/gfx/thebes/gfxAndroidPlatform.h +++ b/gfx/thebes/gfxAndroidPlatform.h @@ -27,22 +27,19 @@ class gfxAndroidPlatform : public gfxPlatform { return (gfxAndroidPlatform*)gfxPlatform::GetPlatform(); } - virtual already_AddRefed CreateOffscreenSurface( + already_AddRefed CreateOffscreenSurface( const IntSize& aSize, gfxImageFormat aFormat) override; - virtual gfxImageFormat GetOffscreenFormat() override { - return mOffscreenFormat; - } + gfxImageFormat GetOffscreenFormat() override { return mOffscreenFormat; } // to support IPC font list (sharing between chrome and content) void GetSystemFontList(InfallibleTArray* retValue); // platform implementations of font functions - virtual gfxPlatformFontList* CreatePlatformFontList() override; + gfxPlatformFontList* CreatePlatformFontList() override; - virtual void GetCommonFallbackFonts( - uint32_t aCh, uint32_t aNextCh, Script aRunScript, - nsTArray& aFontList) override; + void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, Script aRunScript, + nsTArray& aFontList) override; gfxFontGroup* CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList, const gfxFontStyle* aStyle, @@ -50,13 +47,13 @@ class gfxAndroidPlatform : public gfxPlatform { gfxUserFontSet* aUserFontSet, gfxFloat aDevToCssSize) override; - virtual bool FontHintingEnabled() override; - virtual bool RequiresLinearZoom() override; + bool FontHintingEnabled() override; + bool RequiresLinearZoom() override; FT_Library GetFTLibrary() override; - virtual already_AddRefed - CreateHardwareVsyncSource() override; + already_AddRefed CreateHardwareVsyncSource() + override; protected: bool AccelerateLayersByDefault() override { return true; } diff --git a/gfx/thebes/gfxBlur.cpp b/gfx/thebes/gfxBlur.cpp index c0e8a3bb79d2..fb1c1dc1997a 100644 --- a/gfx/thebes/gfxBlur.cpp +++ b/gfx/thebes/gfxBlur.cpp @@ -22,8 +22,6 @@ using namespace mozilla; using namespace mozilla::gfx; -gfxAlphaBoxBlur::gfxAlphaBoxBlur() : mData(nullptr), mAccelerated(false) {} - gfxAlphaBoxBlur::~gfxAlphaBoxBlur() {} already_AddRefed gfxAlphaBoxBlur::Init(gfxContext* aDestinationCtx, diff --git a/gfx/thebes/gfxBlur.h b/gfx/thebes/gfxBlur.h index 8e4e713bf751..24759e1d19e3 100644 --- a/gfx/thebes/gfxBlur.h +++ b/gfx/thebes/gfxBlur.h @@ -43,13 +43,13 @@ class DrawTarget; * any desired content onto the context acquired through GetContext, and lastly * calls Paint to apply the blurred content as an alpha mask. */ -class gfxAlphaBoxBlur { +class gfxAlphaBoxBlur final { typedef mozilla::gfx::Color Color; typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::RectCornerRadii RectCornerRadii; public: - gfxAlphaBoxBlur(); + gfxAlphaBoxBlur() = default; ~gfxAlphaBoxBlur(); @@ -189,7 +189,7 @@ class gfxAlphaBoxBlur { /** * The temporary alpha surface. */ - uint8_t* mData; + uint8_t* mData = nullptr; /** * The object that actually does the blurring for us. @@ -199,7 +199,7 @@ class gfxAlphaBoxBlur { /** * Indicates using DrawTarget-accelerated blurs. */ - bool mAccelerated; + bool mAccelerated = false; }; #endif /* GFX_BLUR_H */ diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index daebc6c7f466..1288cab316e7 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -1505,7 +1505,7 @@ class DirectWriteFontInfo : public FontInfoData { { } - virtual ~DirectWriteFontInfo() {} + virtual ~DirectWriteFontInfo() = default; // loads font data for all members of a given family virtual void LoadFontFamilyData(const nsACString& aFamilyName); @@ -1729,7 +1729,7 @@ class BundledFontFileEnumerator : public IDWriteFontFileEnumerator { BundledFontFileEnumerator(const BundledFontFileEnumerator&) = delete; BundledFontFileEnumerator& operator=(const BundledFontFileEnumerator&) = delete; - virtual ~BundledFontFileEnumerator() {} + virtual ~BundledFontFileEnumerator() = default; RefPtr mFactory; @@ -1788,7 +1788,7 @@ class BundledFontLoader : public IDWriteFontCollectionLoader { private: BundledFontLoader(const BundledFontLoader&) = delete; BundledFontLoader& operator=(const BundledFontLoader&) = delete; - virtual ~BundledFontLoader() {} + virtual ~BundledFontLoader() = default; }; IFACEMETHODIMP diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index 39be403a1dcf..133ffd265570 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -194,7 +194,7 @@ class gfxDWriteFontEntry : public gfxFontEntry { virtual ~gfxDWriteFontEntry(); - virtual hb_blob_t* GetFontTable(uint32_t aTableTag) override; + hb_blob_t* GetFontTable(uint32_t aTableTag) override; nsresult ReadCMAP(FontInfoData* aFontInfoData = nullptr); @@ -366,7 +366,7 @@ class gfxDWriteFontList : public gfxPlatformFontList { } // initialize font lists - virtual nsresult InitFontListForPlatform() override; + nsresult InitFontListForPlatform() override; gfxFontFamily* CreateFontFamily(const nsACString& aName) const override; diff --git a/gfx/thebes/gfxDWriteFonts.h b/gfx/thebes/gfxDWriteFonts.h index 5619f7e786cd..7b3dce2ff673 100644 --- a/gfx/thebes/gfxDWriteFonts.h +++ b/gfx/thebes/gfxDWriteFonts.h @@ -38,41 +38,41 @@ class gfxDWriteFont : public gfxFont { mozilla::UniquePtr CopyWithAntialiasOption( AntialiasOption anAAOption) override; - virtual uint32_t GetSpaceGlyph() override; + uint32_t GetSpaceGlyph() override; - virtual bool SetupCairoFont(DrawTarget *aDrawTarget) override; + bool SetupCairoFont(DrawTarget *aDrawTarget) override; - virtual bool AllowSubpixelAA() override { return mAllowManualShowGlyphs; } + bool AllowSubpixelAA() override { return mAllowManualShowGlyphs; } bool IsValid() const; IDWriteFontFace *GetFontFace(); /* override Measure to add padding for antialiasing */ - virtual RunMetrics Measure( - const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, - BoundingBoxType aBoundingBoxType, - DrawTarget *aDrawTargetForTightBoundingBox, Spacing *aSpacing, - mozilla::gfx::ShapedTextFlags aOrientation) override; + RunMetrics Measure(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, + BoundingBoxType aBoundingBoxType, + DrawTarget *aDrawTargetForTightBoundingBox, + Spacing *aSpacing, + mozilla::gfx::ShapedTextFlags aOrientation) override; - virtual bool ProvidesGlyphWidths() const override; + bool ProvidesGlyphWidths() const override; - virtual int32_t GetGlyphWidth(uint16_t aGID) override; + int32_t GetGlyphWidth(uint16_t aGID) override; - virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes *aSizes) const override; - virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes *aSizes) const override; + void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontCacheSizes *aSizes) const override; + void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontCacheSizes *aSizes) const override; - virtual FontType GetType() const override { return FONT_TYPE_DWRITE; } + FontType GetType() const override { return FONT_TYPE_DWRITE; } - virtual already_AddRefed GetScaledFont( + already_AddRefed GetScaledFont( mozilla::gfx::DrawTarget *aTarget) override; protected: cairo_scaled_font_t *InitCairoScaledFont(); - virtual const Metrics &GetHorizontalMetrics() override; + const Metrics &GetHorizontalMetrics() override; bool GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics); diff --git a/gfx/thebes/gfxDrawable.cpp b/gfx/thebes/gfxDrawable.cpp index e44d853826c3..23baa1cc2abb 100644 --- a/gfx/thebes/gfxDrawable.cpp +++ b/gfx/thebes/gfxDrawable.cpp @@ -164,7 +164,7 @@ class DrawingCallbackFromDrawable : public gfxDrawingCallback { NS_ASSERTION(aDrawable, "aDrawable is null!"); } - ~DrawingCallbackFromDrawable() override = default; + virtual ~DrawingCallbackFromDrawable() = default; bool operator()(gfxContext* aContext, const gfxRect& aFillRect, const SamplingFilter aSamplingFilter, diff --git a/gfx/thebes/gfxDrawable.h b/gfx/thebes/gfxDrawable.h index cf467ae4bed6..b0d47e3691a5 100644 --- a/gfx/thebes/gfxDrawable.h +++ b/gfx/thebes/gfxDrawable.h @@ -56,7 +56,7 @@ class gfxDrawable { protected: // Protected destructor, to discourage deletion outside of Release(): - virtual ~gfxDrawable() {} + virtual ~gfxDrawable() = default; const mozilla::gfx::IntSize mSize; }; @@ -70,7 +70,7 @@ class gfxSurfaceDrawable : public gfxDrawable { gfxSurfaceDrawable(mozilla::gfx::SourceSurface* aSurface, const mozilla::gfx::IntSize aSize, const gfxMatrix aTransform = gfxMatrix()); - virtual ~gfxSurfaceDrawable() {} + virtual ~gfxSurfaceDrawable() = default; virtual bool Draw(gfxContext* aContext, const gfxRect& aFillRect, mozilla::gfx::ExtendMode aExtendMode, @@ -106,7 +106,7 @@ class gfxDrawingCallback { NS_INLINE_DECL_REFCOUNTING(gfxDrawingCallback) protected: // Protected destructor, to discourage deletion outside of Release(): - virtual ~gfxDrawingCallback() {} + virtual ~gfxDrawingCallback() = default; public: /** @@ -129,7 +129,7 @@ class gfxCallbackDrawable : public gfxDrawable { public: gfxCallbackDrawable(gfxDrawingCallback* aCallback, const mozilla::gfx::IntSize aSize); - virtual ~gfxCallbackDrawable() {} + virtual ~gfxCallbackDrawable() = default; virtual bool Draw(gfxContext* aContext, const gfxRect& aFillRect, mozilla::gfx::ExtendMode aExtendMode, diff --git a/gfx/thebes/gfxFT2FontBase.h b/gfx/thebes/gfxFT2FontBase.h index e694a4b3d5d8..3d17286f549a 100644 --- a/gfx/thebes/gfxFT2FontBase.h +++ b/gfx/thebes/gfxFT2FontBase.h @@ -24,16 +24,16 @@ class gfxFT2FontBase : public gfxFont { uint32_t GetGlyph(uint32_t aCharCode); void GetGlyphExtents(uint32_t aGlyph, cairo_text_extents_t* aExtents); - virtual uint32_t GetSpaceGlyph() override; - virtual bool ProvidesGetGlyph() const override { return true; } + uint32_t GetSpaceGlyph() override; + bool ProvidesGetGlyph() const override { return true; } virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector) override; - virtual bool ProvidesGlyphWidths() const override { return true; } - virtual int32_t GetGlyphWidth(uint16_t aGID) override; + bool ProvidesGlyphWidths() const override { return true; } + int32_t GetGlyphWidth(uint16_t aGID) override; - virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override; + bool SetupCairoFont(DrawTarget* aDrawTarget) override; - virtual FontType GetType() const override { return FONT_TYPE_FT2; } + FontType GetType() const override { return FONT_TYPE_FT2; } static void SetupVarCoords(FT_MM_Var* aMMVar, const nsTArray& aVariations, @@ -51,7 +51,7 @@ class gfxFT2FontBase : public gfxFont { void InitMetrics(); protected: - virtual const Metrics& GetHorizontalMetrics() override; + const Metrics& GetHorizontalMetrics() override; uint32_t mSpaceGlyph; Metrics mMetrics; diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 3f49896f6d5a..91169e59c88e 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -877,7 +877,7 @@ class WillShutdownObserver : public nsIObserver { } protected: - virtual ~WillShutdownObserver() {} + virtual ~WillShutdownObserver() = default; gfxFT2FontList* mFontList; }; diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index ba6a2f583f12..c0023a02aa4a 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -70,10 +70,10 @@ class FT2FontEntry : public gfxFontEntry { nsresult ReadCMAP(FontInfoData* aFontInfoData = nullptr) override; - virtual hb_blob_t* GetFontTable(uint32_t aTableTag) override; + hb_blob_t* GetFontTable(uint32_t aTableTag) override; - virtual nsresult CopyFontTable(uint32_t aTableTag, - nsTArray& aBuffer) override; + nsresult CopyFontTable(uint32_t aTableTag, + nsTArray& aBuffer) override; bool HasVariations() override; void GetVariationAxes( @@ -87,10 +87,10 @@ class FT2FontEntry : public gfxFontEntry { FT_MM_Var* GetMMVar() override; - virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontListSizes* aSizes) const override; - virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontListSizes* aSizes) const override; + void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontListSizes* aSizes) const override; + void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontListSizes* aSizes) const override; FT_Face mFTFace; cairo_font_face_t* mFontFace; @@ -120,16 +120,17 @@ class gfxFT2FontList : public gfxPlatformFontList { gfxFT2FontList(); virtual ~gfxFT2FontList(); - virtual gfxFontEntry* LookupLocalFont( - const nsACString& aFontName, WeightRange aWeightForEntry, - StretchRange aStretchForEntry, SlantStyleRange aStyleForEntry) override; + gfxFontEntry* LookupLocalFont(const nsACString& aFontName, + WeightRange aWeightForEntry, + StretchRange aStretchForEntry, + SlantStyleRange aStyleForEntry) override; - virtual gfxFontEntry* MakePlatformFont(const nsACString& aFontName, - WeightRange aWeightForEntry, - StretchRange aStretchForEntry, - SlantStyleRange aStyleForEntry, - const uint8_t* aFontData, - uint32_t aLength) override; + gfxFontEntry* MakePlatformFont(const nsACString& aFontName, + WeightRange aWeightForEntry, + StretchRange aStretchForEntry, + SlantStyleRange aStyleForEntry, + const uint8_t* aFontData, + uint32_t aLength) override; void GetSystemFontList(InfallibleTArray* retValue); @@ -138,7 +139,7 @@ class gfxFT2FontList : public gfxPlatformFontList { gfxPlatformFontList::PlatformFontList()); } - virtual void GetFontFamilyList( + void GetFontFamilyList( nsTArray >& aFamilyArray) override; gfxFontFamily* CreateFontFamily(const nsACString& aName) const override; @@ -149,7 +150,7 @@ class gfxFT2FontList : public gfxPlatformFontList { typedef enum { kUnknown, kStandard } StandardFile; // initialize font lists - virtual nsresult InitFontListForPlatform() override; + nsresult InitFontListForPlatform() override; void AppendFaceFromFontListEntry(const FontListEntry& aFLE, StandardFile aStdFile); diff --git a/gfx/thebes/gfxFT2Fonts.h b/gfx/thebes/gfxFT2Fonts.h index c5019012ac16..0abfaabe9fe1 100644 --- a/gfx/thebes/gfxFT2Fonts.h +++ b/gfx/thebes/gfxFT2Fonts.h @@ -26,13 +26,13 @@ class gfxFT2Font : public gfxFT2FontBase { FT2FontEntry *GetFontEntry(); - virtual already_AddRefed GetScaledFont( + already_AddRefed GetScaledFont( DrawTarget *aTarget) override; - virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes *aSizes) const override; - virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes *aSizes) const override; + void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontCacheSizes *aSizes) const override; + void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontCacheSizes *aSizes) const override; protected: struct CachedGlyphData { diff --git a/gfx/thebes/gfxFcPlatformFontList.h b/gfx/thebes/gfxFcPlatformFontList.h index 8076c6aaf055..1e33acdf695f 100644 --- a/gfx/thebes/gfxFcPlatformFontList.h +++ b/gfx/thebes/gfxFcPlatformFontList.h @@ -54,7 +54,7 @@ class nsAutoRefTraits : public nsPointerRefTraits { // each cairo font created from that font entry contains a // FTUserFontDataRef with a refptr to that same FTUserFontData object. -class FTUserFontData { +class FTUserFontData final { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FTUserFontData) @@ -248,7 +248,7 @@ class gfxFontconfigFont : public gfxFT2FontBase { gfxFloat aAdjustedSize, gfxFontEntry* aFontEntry, const gfxFontStyle* aFontStyle); - virtual FontType GetType() const override { return FONT_TYPE_FONTCONFIG; } + FontType GetType() const override { return FONT_TYPE_FONTCONFIG; } virtual FcPattern* GetPattern() const { return mPattern; } virtual already_AddRefed GetScaledFont( @@ -269,7 +269,7 @@ class gfxFcPlatformFontList : public gfxPlatformFontList { } // initialize font lists - virtual nsresult InitFontListForPlatform() override; + nsresult InitFontListForPlatform() override; void GetFontList(nsAtom* aLangGroup, const nsACString& aGenericFamily, nsTArray& aListOfFonts) override; diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 6b89260e832f..bca5235ac1f1 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -367,7 +367,7 @@ class gfxFontCache final : private gfxFontCacheExpirationTracker { // This gets called when the timeout has expired on a zero-refcount // font; we just delete it. - virtual void NotifyExpiredLocked(gfxFont* aFont, const AutoLock&) override { + void NotifyExpiredLocked(gfxFont* aFont, const AutoLock&) override { NotifyExpired(aFont); } @@ -635,7 +635,7 @@ class gfxFontShaper { NS_ASSERTION(aFont, "shaper requires a valid font!"); } - virtual ~gfxFontShaper() {} + virtual ~gfxFontShaper() = default; // Shape a piece of text and store the resulting glyph data into // aShapedText. Parameters aOffset/aLength indicate the range of @@ -691,7 +691,7 @@ class gfxShapedText { mFlags(aFlags), mAppUnitsPerDevUnit(aAppUnitsPerDevUnit) {} - virtual ~gfxShapedText() {} + virtual ~gfxShapedText() = default; /** * This class records the information associated with a character in the @@ -1254,10 +1254,10 @@ class gfxShapedWord final : public gfxShapedText { // allocated via malloc. void operator delete(void* p) { free(p); } - virtual const CompressedGlyph* GetCharacterGlyphs() const override { + const CompressedGlyph* GetCharacterGlyphs() const override { return &mCharGlyphsStorage[0]; } - virtual CompressedGlyph* GetCharacterGlyphs() override { + CompressedGlyph* GetCharacterGlyphs() override { return &mCharGlyphsStorage[0]; } diff --git a/gfx/thebes/gfxFontInfoLoader.cpp b/gfx/thebes/gfxFontInfoLoader.cpp index 27ced8cbfd1e..6e1bc614a28d 100644 --- a/gfx/thebes/gfxFontInfoLoader.cpp +++ b/gfx/thebes/gfxFontInfoLoader.cpp @@ -39,7 +39,7 @@ void FontInfoData::Load() { } class FontInfoLoadCompleteEvent : public Runnable { - virtual ~FontInfoLoadCompleteEvent() {} + virtual ~FontInfoLoadCompleteEvent() = default; public: NS_INLINE_DECL_REFCOUNTING_INHERITED(FontInfoLoadCompleteEvent, Runnable) @@ -54,7 +54,7 @@ class FontInfoLoadCompleteEvent : public Runnable { }; class AsyncFontInfoLoader : public Runnable { - virtual ~AsyncFontInfoLoader() {} + virtual ~AsyncFontInfoLoader() = default; public: NS_INLINE_DECL_REFCOUNTING_INHERITED(AsyncFontInfoLoader, Runnable) @@ -72,7 +72,7 @@ class AsyncFontInfoLoader : public Runnable { }; class ShutdownThreadEvent : public Runnable { - virtual ~ShutdownThreadEvent() {} + virtual ~ShutdownThreadEvent() = default; public: NS_INLINE_DECL_REFCOUNTING_INHERITED(ShutdownThreadEvent, Runnable) diff --git a/gfx/thebes/gfxFontInfoLoader.h b/gfx/thebes/gfxFontInfoLoader.h index d7975db4685b..0befb0be30ae 100644 --- a/gfx/thebes/gfxFontInfoLoader.h +++ b/gfx/thebes/gfxFontInfoLoader.h @@ -182,7 +182,7 @@ class gfxFontInfoLoader { explicit ShutdownObserver(gfxFontInfoLoader* aLoader) : mLoader(aLoader) {} protected: - virtual ~ShutdownObserver() {} + virtual ~ShutdownObserver() = default; gfxFontInfoLoader* mLoader; }; diff --git a/gfx/thebes/gfxGDIFont.h b/gfx/thebes/gfxGDIFont.h index a140b0f20685..d8c0c206fa77 100644 --- a/gfx/thebes/gfxGDIFont.h +++ b/gfx/thebes/gfxGDIFont.h @@ -28,19 +28,19 @@ class gfxGDIFont : public gfxFont { cairo_font_face_t *CairoFontFace() { return mFontFace; } /* overrides for the pure virtual methods in gfxFont */ - virtual uint32_t GetSpaceGlyph() override; + uint32_t GetSpaceGlyph() override; - virtual bool SetupCairoFont(DrawTarget *aDrawTarget) override; + bool SetupCairoFont(DrawTarget *aDrawTarget) override; - virtual already_AddRefed GetScaledFont( + already_AddRefed GetScaledFont( DrawTarget *aTarget) override; /* override Measure to add padding for antialiasing */ - virtual RunMetrics Measure( - const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, - BoundingBoxType aBoundingBoxType, - DrawTarget *aDrawTargetForTightBoundingBox, Spacing *aSpacing, - mozilla::gfx::ShapedTextFlags aOrientation) override; + RunMetrics Measure(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, + BoundingBoxType aBoundingBoxType, + DrawTarget *aDrawTargetForTightBoundingBox, + Spacing *aSpacing, + mozilla::gfx::ShapedTextFlags aOrientation) override; /* required for MathML to suppress effects of ClearType "padding" */ mozilla::UniquePtr CopyWithAntialiasOption( @@ -48,26 +48,24 @@ class gfxGDIFont : public gfxFont { // If the font has a cmap table, we handle it purely with harfbuzz; // but if not (e.g. .fon fonts), we'll use a GDI callback to get glyphs. - virtual bool ProvidesGetGlyph() const override { - return !mFontEntry->HasCmapTable(); - } + bool ProvidesGetGlyph() const override { return !mFontEntry->HasCmapTable(); } - virtual uint32_t GetGlyph(uint32_t aUnicode, uint32_t aVarSelector) override; + uint32_t GetGlyph(uint32_t aUnicode, uint32_t aVarSelector) override; - virtual bool ProvidesGlyphWidths() const override { return true; } + bool ProvidesGlyphWidths() const override { return true; } // get hinted glyph width in pixels as 16.16 fixed-point value - virtual int32_t GetGlyphWidth(uint16_t aGID) override; + int32_t GetGlyphWidth(uint16_t aGID) override; - virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes *aSizes) const; - virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, - FontCacheSizes *aSizes) const; + void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontCacheSizes *aSizes) const; + void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf, + FontCacheSizes *aSizes) const; - virtual FontType GetType() const override { return FONT_TYPE_GDI; } + FontType GetType() const override { return FONT_TYPE_GDI; } protected: - virtual const Metrics &GetHorizontalMetrics() override; + const Metrics &GetHorizontalMetrics() override; /* override to ensure the cairo font is set up properly */ bool ShapeText(DrawTarget *aDrawTarget, const char16_t *aText, diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 96479fa00cd9..a2434adb2d4f 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -894,7 +894,7 @@ class GDIFontInfo : public FontInfoData { GDIFontInfo(bool aLoadOtherNames, bool aLoadFaceNames, bool aLoadCmaps) : FontInfoData(aLoadOtherNames, aLoadFaceNames, aLoadCmaps) {} - virtual ~GDIFontInfo() {} + virtual ~GDIFontInfo() = default; virtual void Load() { mHdc = GetDC(nullptr); diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index 195bea36d575..b6f6fa393e7f 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -712,7 +712,7 @@ class gfxMacFontFamily : public gfxFontFamily { explicit gfxMacFontFamily(const nsACString& aName, double aSizeHint) : gfxFontFamily(aName), mSizeHint(aSizeHint) {} - virtual ~gfxMacFontFamily() {} + virtual ~gfxMacFontFamily() = default; virtual void LocalizedName(nsACString& aLocalizedName); @@ -876,7 +876,7 @@ class gfxSingleFaceMacFontFamily : public gfxFontFamily { mFaceNamesInitialized = true; // omit from face name lists } - virtual ~gfxSingleFaceMacFontFamily() {} + virtual ~gfxSingleFaceMacFontFamily() = default; virtual void LocalizedName(nsACString& aLocalizedName); @@ -1538,7 +1538,7 @@ class MacFontInfo : public FontInfoData { MacFontInfo(bool aLoadOtherNames, bool aLoadFaceNames, bool aLoadCmaps) : FontInfoData(aLoadOtherNames, aLoadFaceNames, aLoadCmaps) {} - virtual ~MacFontInfo() {} + virtual ~MacFontInfo() = default; virtual void Load() { nsAutoreleasePool localPool; diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 294b7e89d012..c0530ba44d2d 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -295,7 +295,7 @@ void CrashStatsLogForwarder::UpdateCrashReport() { } class LogForwarderEvent : public Runnable { - ~LogForwarderEvent() override = default; + virtual ~LogForwarderEvent() = default; public: NS_INLINE_DECL_REFCOUNTING_INHERITED(LogForwarderEvent, Runnable) @@ -348,7 +348,7 @@ void CrashStatsLogForwarder::Log(const std::string& aString) { } class CrashTelemetryEvent : public Runnable { - ~CrashTelemetryEvent() override = default; + virtual ~CrashTelemetryEvent() = default; public: NS_INLINE_DECL_REFCOUNTING_INHERITED(CrashTelemetryEvent, Runnable) diff --git a/gfx/thebes/gfxPlatformFontList.h b/gfx/thebes/gfxPlatformFontList.h index 8b366d7dbcd4..e3ab6f5229d6 100644 --- a/gfx/thebes/gfxPlatformFontList.h +++ b/gfx/thebes/gfxPlatformFontList.h @@ -335,7 +335,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader { return NS_OK; } - virtual nsresult Cancel() override { + nsresult Cancel() override { mIsCanceled = true; return NS_OK; @@ -479,9 +479,9 @@ class gfxPlatformFontList : public gfxFontInfoLoader { nsAtom* GetLangGroup(nsAtom* aLanguage); // gfxFontInfoLoader overrides, used to load in font cmaps - virtual void InitLoader() override; - virtual bool LoadFontInfo() override; - virtual void CleanupLoader() override; + void InitLoader() override; + bool LoadFontInfo() override; + void CleanupLoader() override; // read the loader initialization prefs, and start it void GetPrefsAndStartLoader(); diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 0a6ecc42342d..34717634956a 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -619,7 +619,7 @@ class GtkVsyncSource final : public VsyncSource { } private: - virtual ~GLXDisplay() {} + virtual ~GLXDisplay() = default; void RunVsync() { MOZ_ASSERT(!NS_IsMainThread()); diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h index 3fc2ec4d06cb..173b1ae08514 100644 --- a/gfx/thebes/gfxPlatformGtk.h +++ b/gfx/thebes/gfxPlatformGtk.h @@ -34,20 +34,18 @@ class gfxPlatformGtk : public gfxPlatform { void ReadSystemFontList( InfallibleTArray* retValue) override; - virtual already_AddRefed CreateOffscreenSurface( + already_AddRefed CreateOffscreenSurface( const IntSize& aSize, gfxImageFormat aFormat) override; - virtual nsresult GetFontList(nsAtom* aLangGroup, - const nsACString& aGenericFamily, - nsTArray& aListOfFonts) override; + nsresult GetFontList(nsAtom* aLangGroup, const nsACString& aGenericFamily, + nsTArray& aListOfFonts) override; - virtual nsresult UpdateFontList() override; + nsresult UpdateFontList() override; - virtual void GetCommonFallbackFonts( - uint32_t aCh, uint32_t aNextCh, Script aRunScript, - nsTArray& aFontList) override; + void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, Script aRunScript, + nsTArray& aFontList) override; - virtual gfxPlatformFontList* CreatePlatformFontList() override; + gfxPlatformFontList* CreatePlatformFontList() override; gfxFontGroup* CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList, const gfxFontStyle* aStyle, @@ -58,7 +56,7 @@ class gfxPlatformGtk : public gfxPlatform { /** * Calls XFlush if xrender is enabled. */ - virtual void FlushContentDrawing() override; + void FlushContentDrawing() override; FT_Library GetFTLibrary() override; @@ -66,7 +64,7 @@ class gfxPlatformGtk : public gfxPlatform { static double GetFontScaleFactor(); #ifdef MOZ_X11 - virtual void GetAzureBackendInfo(mozilla::widget::InfoObject& aObj) override { + void GetAzureBackendInfo(mozilla::widget::InfoObject& aObj) override { gfxPlatform::GetAzureBackendInfo(aObj); aObj.DefineProperty("CairoUseXRender", mozilla::gfx::gfxVars::UseXRender()); } @@ -74,7 +72,7 @@ class gfxPlatformGtk : public gfxPlatform { bool UseImageOffscreenSurfaces(); - virtual gfxImageFormat GetOffscreenFormat() override; + gfxImageFormat GetOffscreenFormat() override; bool SupportsApzWheelInput() const override { return true; } @@ -113,7 +111,7 @@ class gfxPlatformGtk : public gfxPlatform { int8_t mMaxGenericSubstitutions; private: - virtual void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override; + void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override; #ifdef MOZ_X11 Display* mCompositorDisplay; diff --git a/gfx/thebes/gfxPlatformMac.cpp b/gfx/thebes/gfxPlatformMac.cpp index 7998ce70d200..f1b5bd6dff6a 100644 --- a/gfx/thebes/gfxPlatformMac.cpp +++ b/gfx/thebes/gfxPlatformMac.cpp @@ -375,7 +375,7 @@ class OSXVsyncSource final : public VsyncSource { mTimer = NS_NewTimer(); } - ~OSXDisplay() override { MOZ_ASSERT(NS_IsMainThread()); } + virtual ~OSXDisplay() { MOZ_ASSERT(NS_IsMainThread()); } static void RetryEnableVsync(nsITimer* aTimer, void* aOsxDisplay) { MOZ_ASSERT(NS_IsMainThread()); @@ -493,7 +493,7 @@ class OSXVsyncSource final : public VsyncSource { }; // OSXDisplay private: - ~OSXVsyncSource() override = default; + virtual ~OSXVsyncSource() = default; OSXDisplay mGlobalDisplay; }; // OSXVsyncSource diff --git a/gfx/thebes/gfxPlatformMac.h b/gfx/thebes/gfxPlatformMac.h index 34e08c261118..e6bc282044a8 100644 --- a/gfx/thebes/gfxPlatformMac.h +++ b/gfx/thebes/gfxPlatformMac.h @@ -29,7 +29,7 @@ class gfxPlatformMac : public gfxPlatform { bool UsesTiling() const override; bool ContentUsesTiling() const override; - virtual already_AddRefed CreateOffscreenSurface( + already_AddRefed CreateOffscreenSurface( const IntSize& aSize, gfxImageFormat aFormat) override; gfxFontGroup* CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList, @@ -38,16 +38,15 @@ class gfxPlatformMac : public gfxPlatform { gfxUserFontSet* aUserFontSet, gfxFloat aDevToCssSize) override; - virtual gfxPlatformFontList* CreatePlatformFontList() override; + gfxPlatformFontList* CreatePlatformFontList() override; void ReadSystemFontList( InfallibleTArray* aFontList) override; bool IsFontFormatSupported(uint32_t aFormatFlags) override; - virtual void GetCommonFallbackFonts( - uint32_t aCh, uint32_t aNextCh, Script aRunScript, - nsTArray& aFontList) override; + void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, Script aRunScript, + nsTArray& aFontList) override; // lookup the system font for a particular system font type and set // the name and style characteristics @@ -55,7 +54,7 @@ class gfxPlatformMac : public gfxPlatform { nsACString& aSystemFontName, gfxFontStyle& aFontStyle); - virtual bool SupportsApzWheelInput() const override { return true; } + bool SupportsApzWheelInput() const override { return true; } bool RespectsFontStyleSmoothing() const override { // gfxMacFont respects the font smoothing hint. @@ -69,8 +68,8 @@ class gfxPlatformMac : public gfxPlatform { return true; } - virtual already_AddRefed - CreateHardwareVsyncSource() override; + already_AddRefed CreateHardwareVsyncSource() + override; // lower threshold on font anti-aliasing uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; } @@ -83,7 +82,7 @@ class gfxPlatformMac : public gfxPlatform { bool CheckVariationFontSupport() override; private: - virtual void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override; + void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override; // read in the pref value for the lower threshold on font anti-aliasing static uint32_t ReadAntiAliasingThreshold(); diff --git a/gfx/thebes/gfxSVGGlyphs.h b/gfx/thebes/gfxSVGGlyphs.h index 05ada8aa70d1..60960d0be644 100644 --- a/gfx/thebes/gfxSVGGlyphs.h +++ b/gfx/thebes/gfxSVGGlyphs.h @@ -47,7 +47,7 @@ class gfxSVGGlyphsDocument final : public nsAPostRefreshObserver { ~gfxSVGGlyphsDocument(); - virtual void DidRefresh() override; + void DidRefresh() override; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; diff --git a/gfx/thebes/gfxUserFontSet.h b/gfx/thebes/gfxUserFontSet.h index 604f0f92e44b..6614ec1be04d 100644 --- a/gfx/thebes/gfxUserFontSet.h +++ b/gfx/thebes/gfxUserFontSet.h @@ -34,7 +34,7 @@ class gfxFontFaceBufferSource { virtual void TakeBuffer(uint8_t*& aBuffer, uint32_t& aLength) = 0; protected: - virtual ~gfxFontFaceBufferSource() {} + virtual ~gfxFontFaceBufferSource() = default; }; // parsed CSS @font-face rule information @@ -106,7 +106,7 @@ class gfxUserFontData { mCompression(kUnknownCompression), mPrivate(false), mIsBuffer(false) {} - virtual ~gfxUserFontData() {} + virtual ~gfxUserFontData() = default; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; @@ -327,7 +327,7 @@ class gfxUserFontSet { // Helper that we use to observe the empty-cache notification // from nsICacheService. class Flusher : public nsIObserver { - virtual ~Flusher() {} + virtual ~Flusher() = default; public: NS_DECL_ISUPPORTS diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 1eda5ee25f87..3fddf36c8078 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -1922,7 +1922,7 @@ class D3DVsyncSource final : public VsyncSource { virtual Display& GetGlobalDisplay() override { return *mPrimaryDisplay; } private: - virtual ~D3DVsyncSource() {} + virtual ~D3DVsyncSource() = default; RefPtr mPrimaryDisplay; }; // end D3DVsyncSource diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index e9276851c23c..ee1effc0a9fc 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -105,10 +105,10 @@ class gfxWindowsPlatform : public gfxPlatform { return (gfxWindowsPlatform*)gfxPlatform::GetPlatform(); } - virtual void EnsureDevicesInitialized() override; - virtual bool DevicesInitialized() override; + void EnsureDevicesInitialized() override; + bool DevicesInitialized() override; - virtual gfxPlatformFontList* CreatePlatformFontList() override; + gfxPlatformFontList* CreatePlatformFontList() override; virtual already_AddRefed CreateOffscreenSurface( const IntSize& aSize, gfxImageFormat aFormat) override; @@ -148,9 +148,8 @@ class gfxWindowsPlatform : public gfxPlatform { */ void VerifyD2DDevice(bool aAttemptForce); - virtual void GetCommonFallbackFonts( - uint32_t aCh, uint32_t aNextCh, Script aRunScript, - nsTArray& aFontList) override; + void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, Script aRunScript, + nsTArray& aFontList) override; gfxFontGroup* CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList, const gfxFontStyle* aStyle, @@ -158,9 +157,9 @@ class gfxWindowsPlatform : public gfxPlatform { gfxUserFontSet* aUserFontSet, gfxFloat aDevToCssSize) override; - virtual bool CanUseHardwareVideoDecoding() override; + bool CanUseHardwareVideoDecoding() override; - virtual void CompositorUpdated() override; + void CompositorUpdated() override; bool DidRenderingDeviceReset( DeviceResetReason* aResetReason = nullptr) override; @@ -177,7 +176,7 @@ class gfxWindowsPlatform : public gfxPlatform { // returns ClearType tuning information for each display static void GetCleartypeParams(nsTArray& aParams); - virtual void FontsPrefsChanged(const char* aPref) override; + void FontsPrefsChanged(const char* aPref) override; void SetupClearTypeParams(); @@ -204,8 +203,8 @@ class gfxWindowsPlatform : public gfxPlatform { bool HandleDeviceReset(); void UpdateBackendPrefs(); - virtual already_AddRefed - CreateHardwareVsyncSource() override; + already_AddRefed CreateHardwareVsyncSource() + override; static mozilla::Atomic sD3D11SharedTextures; static mozilla::Atomic sD3D9SharedTextures; @@ -219,7 +218,7 @@ class gfxWindowsPlatform : public gfxPlatform { bool AccelerateLayersByDefault() override { return true; } void GetAcceleratedCompositorBackends( nsTArray& aBackends) override; - virtual void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override; + void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override; void ImportGPUDeviceData(const mozilla::gfx::GPUDeviceData& aData) override; void ImportContentDeviceData( diff --git a/gfx/thebes/gfxXlibSurface.h b/gfx/thebes/gfxXlibSurface.h index a23f6ffc20fb..4b0ed9261551 100644 --- a/gfx/thebes/gfxXlibSurface.h +++ b/gfx/thebes/gfxXlibSurface.h @@ -55,11 +55,11 @@ class gfxXlibSurface final : public gfxASurface { virtual ~gfxXlibSurface(); - virtual already_AddRefed CreateSimilarSurface( + already_AddRefed CreateSimilarSurface( gfxContentType aType, const mozilla::gfx::IntSize& aSize) override; - virtual void Finish() override; + void Finish() override; - virtual const mozilla::gfx::IntSize GetSize() const override; + const mozilla::gfx::IntSize GetSize() const override; Display* XDisplay() { return mDisplay; } ::Screen* XScreen(); diff --git a/gfx/vr/gfxVRExternal.h b/gfx/vr/gfxVRExternal.h index 662a128dd023..a1ebb8b47404 100644 --- a/gfx/vr/gfxVRExternal.h +++ b/gfx/vr/gfxVRExternal.h @@ -86,22 +86,22 @@ class VRSystemManagerExternal : public VRSystemManager { static already_AddRefed Create( VRExternalShmem* aAPIShmem = nullptr); - virtual void Destroy() override; - virtual void Shutdown() override; - virtual void Run100msTasks() override; - virtual void Enumerate() override; - virtual bool ShouldInhibitEnumeration() override; - virtual void GetHMDs(nsTArray>& aHMDResult) override; - virtual bool GetIsPresenting() override; - virtual void HandleInput() override; - virtual void GetControllers( + void Destroy() override; + void Shutdown() override; + void Run100msTasks() override; + void Enumerate() override; + bool ShouldInhibitEnumeration() override; + void GetHMDs(nsTArray>& aHMDResult) override; + bool GetIsPresenting() override; + void HandleInput() override; + void GetControllers( nsTArray>& aControllerResult) override; - virtual void ScanForControllers() override; - virtual void RemoveControllers() override; - virtual void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex, - double aIntensity, double aDuration, - const VRManagerPromise& aPromise) override; - virtual void StopVibrateHaptic(uint32_t aControllerIdx) override; + void ScanForControllers() override; + void RemoveControllers() override; + void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex, + double aIntensity, double aDuration, + const VRManagerPromise& aPromise) override; + void StopVibrateHaptic(uint32_t aControllerIdx) override; #if defined(MOZ_WIDGET_ANDROID) bool PullState(VRDisplayState* aDisplayState, VRHMDSensorState* aSensorState = nullptr, diff --git a/gfx/vr/gfxVRPuppet.h b/gfx/vr/gfxVRPuppet.h index b01f854f5a32..43a2d257dcab 100644 --- a/gfx/vr/gfxVRPuppet.h +++ b/gfx/vr/gfxVRPuppet.h @@ -36,9 +36,9 @@ class VRDisplayPuppet : public VRDisplayLocal { void ZeroSensor() override; protected: - virtual VRHMDSensorState& GetSensorState() override; - virtual void StartPresentation() override; - virtual void StopPresentation() override; + VRHMDSensorState& GetSensorState() override; + void StartPresentation() override; + void StopPresentation() override; #if defined(XP_WIN) virtual bool SubmitFrame(ID3D11Texture2D* aSource, const IntSize& aSize, const gfx::Rect& aLeftEyeRect, @@ -117,22 +117,22 @@ class VRSystemManagerPuppet : public VRSystemManager { void SetPuppetDisplaySensorState(const uint32_t& aDeviceID, const VRHMDSensorState& aSensorState); - virtual void Destroy() override; - virtual void Shutdown() override; - virtual void Enumerate() override; - virtual void GetHMDs(nsTArray>& aHMDResult) override; - virtual bool GetIsPresenting() override; - virtual void HandleInput() override; - virtual void GetControllers( + void Destroy() override; + void Shutdown() override; + void Enumerate() override; + void GetHMDs(nsTArray>& aHMDResult) override; + bool GetIsPresenting() override; + void HandleInput() override; + void GetControllers( nsTArray>& aControllerResult) override; - virtual void ScanForControllers() override; - virtual void RemoveControllers() override; - virtual void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex, - double aIntensity, double aDuration, - const VRManagerPromise& aPromise) override; - virtual void StopVibrateHaptic(uint32_t aControllerIdx) override; - virtual void NotifyVSync() override; - virtual void Run10msTasks() override; + void ScanForControllers() override; + void RemoveControllers() override; + void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex, + double aIntensity, double aDuration, + const VRManagerPromise& aPromise) override; + void StopVibrateHaptic(uint32_t aControllerIdx) override; + void NotifyVSync() override; + void Run10msTasks() override; protected: VRSystemManagerPuppet(); diff --git a/gfx/webrender_bindings/RenderAndroidSurfaceTextureHostOGL.h b/gfx/webrender_bindings/RenderAndroidSurfaceTextureHostOGL.h index 70707305db77..ae7186823702 100644 --- a/gfx/webrender_bindings/RenderAndroidSurfaceTextureHostOGL.h +++ b/gfx/webrender_bindings/RenderAndroidSurfaceTextureHostOGL.h @@ -25,8 +25,8 @@ class RenderAndroidSurfaceTextureHostOGL final : public RenderTextureHostOGL { wr::ImageRendering aRendering) override; void Unlock() override; - virtual gfx::IntSize GetSize(uint8_t aChannelIndex) const override; - virtual GLuint GetGLHandle(uint8_t aChannelIndex) const override; + gfx::IntSize GetSize(uint8_t aChannelIndex) const override; + GLuint GetGLHandle(uint8_t aChannelIndex) const override; virtual void PrepareForUse() override; virtual void NotifyNotUsed() override; diff --git a/gfx/webrender_bindings/RenderD3D11TextureHostOGL.h b/gfx/webrender_bindings/RenderD3D11TextureHostOGL.h index 0dd084e5a700..ef169b8dece2 100644 --- a/gfx/webrender_bindings/RenderD3D11TextureHostOGL.h +++ b/gfx/webrender_bindings/RenderD3D11TextureHostOGL.h @@ -65,7 +65,7 @@ class RenderDXGIYCbCrTextureHostOGL final : public RenderTextureHostOGL { wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL, wr::ImageRendering aRendering) override; - virtual void Unlock() override; + void Unlock() override; void ClearCachedResources() override; virtual gfx::IntSize GetSize(uint8_t aChannelIndex) const; diff --git a/gfx/webrender_bindings/RenderEGLImageTextureHost.h b/gfx/webrender_bindings/RenderEGLImageTextureHost.h index 2fad29dfb88d..df2feebb3044 100644 --- a/gfx/webrender_bindings/RenderEGLImageTextureHost.h +++ b/gfx/webrender_bindings/RenderEGLImageTextureHost.h @@ -24,8 +24,8 @@ class RenderEGLImageTextureHost final : public RenderTextureHostOGL { wr::ImageRendering aRendering) override; void Unlock() override; - virtual gfx::IntSize GetSize(uint8_t aChannelIndex) const override; - virtual GLuint GetGLHandle(uint8_t aChannelIndex) const override; + gfx::IntSize GetSize(uint8_t aChannelIndex) const override; + GLuint GetGLHandle(uint8_t aChannelIndex) const override; private: virtual ~RenderEGLImageTextureHost(); diff --git a/gfx/webrender_bindings/RenderMacIOSurfaceTextureHostOGL.h b/gfx/webrender_bindings/RenderMacIOSurfaceTextureHostOGL.h index c00cbe75282d..695773204e55 100644 --- a/gfx/webrender_bindings/RenderMacIOSurfaceTextureHostOGL.h +++ b/gfx/webrender_bindings/RenderMacIOSurfaceTextureHostOGL.h @@ -27,8 +27,8 @@ class RenderMacIOSurfaceTextureHostOGL final : public RenderTextureHostOGL { wr::ImageRendering aRendering) override; void Unlock() override; - virtual gfx::IntSize GetSize(uint8_t aChannelIndex) const override; - virtual GLuint GetGLHandle(uint8_t aChannelIndex) const override; + gfx::IntSize GetSize(uint8_t aChannelIndex) const override; + GLuint GetGLHandle(uint8_t aChannelIndex) const override; private: virtual ~RenderMacIOSurfaceTextureHostOGL(); diff --git a/gfx/webrender_bindings/RenderSharedSurfaceTextureHost.h b/gfx/webrender_bindings/RenderSharedSurfaceTextureHost.h index 8c0deee820e8..66f41841fba9 100644 --- a/gfx/webrender_bindings/RenderSharedSurfaceTextureHost.h +++ b/gfx/webrender_bindings/RenderSharedSurfaceTextureHost.h @@ -31,7 +31,7 @@ class RenderSharedSurfaceTextureHost final : public RenderTextureHost { void Unlock() override; private: - ~RenderSharedSurfaceTextureHost() override; + virtual ~RenderSharedSurfaceTextureHost(); RefPtr mSurface; gfx::DataSourceSurface::MappedSurface mMap; diff --git a/gfx/webrender_bindings/RenderTextureHostWrapper.h b/gfx/webrender_bindings/RenderTextureHostWrapper.h index b39000a06c50..1d4ea2f1599c 100644 --- a/gfx/webrender_bindings/RenderTextureHostWrapper.h +++ b/gfx/webrender_bindings/RenderTextureHostWrapper.h @@ -30,7 +30,7 @@ class RenderTextureHostWrapper final : public RenderTextureHost { bool IsInited() { return mInited; } private: - ~RenderTextureHostWrapper() override; + virtual ~RenderTextureHostWrapper(); bool mInited; bool mLocked; diff --git a/gfx/webrender_bindings/RenderThread.h b/gfx/webrender_bindings/RenderThread.h index 5c4a717c0619..83eb753e1698 100644 --- a/gfx/webrender_bindings/RenderThread.h +++ b/gfx/webrender_bindings/RenderThread.h @@ -52,7 +52,7 @@ class WebRenderThreadPool { wr::WrThreadPool* mThreadPool; }; -class WebRenderProgramCache { +class WebRenderProgramCache final { public: explicit WebRenderProgramCache(wr::WrThreadPool* aThreadPool); @@ -64,7 +64,7 @@ class WebRenderProgramCache { wr::WrProgramCache* mProgramCache; }; -class WebRenderShaders { +class WebRenderShaders final { public: WebRenderShaders(gl::GLContext* gl, WebRenderProgramCache* programCache); ~WebRenderShaders(); @@ -76,7 +76,7 @@ class WebRenderShaders { wr::WrShaders* mShaders; }; -class WebRenderPipelineInfo { +class WebRenderPipelineInfo final { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderPipelineInfo); public: @@ -96,7 +96,7 @@ class WebRenderPipelineInfo { /// messages to preserve ordering. class RendererEvent { public: - virtual ~RendererEvent() {} + virtual ~RendererEvent() = default; virtual void Run(RenderThread& aRenderThread, wr::WindowId aWindow) = 0; }; diff --git a/gfx/webrender_bindings/WebRenderAPI.cpp b/gfx/webrender_bindings/WebRenderAPI.cpp index 9007d8b9c125..e6aae734708c 100644 --- a/gfx/webrender_bindings/WebRenderAPI.cpp +++ b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -54,7 +54,7 @@ class NewRenderer : public RendererEvent { ~NewRenderer() { MOZ_COUNT_DTOR(NewRenderer); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { layers::AutoCompleteTask complete(mTask); UniquePtr compositor = @@ -130,9 +130,9 @@ class RemoveRenderer : public RendererEvent { MOZ_COUNT_CTOR(RemoveRenderer); } - ~RemoveRenderer() { MOZ_COUNT_DTOR(RemoveRenderer); } + virtual ~RemoveRenderer() { MOZ_COUNT_DTOR(RemoveRenderer); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { aRenderThread.RemoveRenderer(aWindowId); layers::AutoCompleteTask complete(mTask); } @@ -394,9 +394,9 @@ void WebRenderAPI::Readback(const TimeStamp& aStartTime, gfx::IntSize size, MOZ_COUNT_CTOR(Readback); } - ~Readback() { MOZ_COUNT_DTOR(Readback); } + virtual ~Readback() { MOZ_COUNT_DTOR(Readback); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { aRenderThread.UpdateAndRender(aWindowId, VsyncId(), mStartTime, /* aRender */ true, Some(mSize), Some(mBuffer), false); @@ -434,9 +434,9 @@ void WebRenderAPI::Pause() { MOZ_COUNT_CTOR(PauseEvent); } - ~PauseEvent() { MOZ_COUNT_DTOR(PauseEvent); } + virtual ~PauseEvent() { MOZ_COUNT_DTOR(PauseEvent); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { aRenderThread.Pause(aWindowId); layers::AutoCompleteTask complete(mTask); } @@ -462,9 +462,9 @@ bool WebRenderAPI::Resume() { MOZ_COUNT_CTOR(ResumeEvent); } - ~ResumeEvent() { MOZ_COUNT_DTOR(ResumeEvent); } + virtual ~ResumeEvent() { MOZ_COUNT_DTOR(ResumeEvent); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { *mResult = aRenderThread.Resume(aWindowId); layers::AutoCompleteTask complete(mTask); } @@ -506,9 +506,9 @@ void WebRenderAPI::WaitFlushed() { MOZ_COUNT_CTOR(WaitFlushedEvent); } - ~WaitFlushedEvent() { MOZ_COUNT_DTOR(WaitFlushedEvent); } + virtual ~WaitFlushedEvent() { MOZ_COUNT_DTOR(WaitFlushedEvent); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { layers::AutoCompleteTask complete(mTask); } @@ -643,9 +643,9 @@ class FrameStartTime : public RendererEvent { MOZ_COUNT_CTOR(FrameStartTime); } - ~FrameStartTime() { MOZ_COUNT_DTOR(FrameStartTime); } + virtual ~FrameStartTime() { MOZ_COUNT_DTOR(FrameStartTime); } - virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override { + void Run(RenderThread& aRenderThread, WindowId aWindowId) override { auto renderer = aRenderThread.GetRenderer(aWindowId); if (renderer) { renderer->SetFrameStartTime(mTime); diff --git a/gfx/webrender_bindings/WebRenderAPI.h b/gfx/webrender_bindings/WebRenderAPI.h index 27e2f1767593..586fa038bb69 100644 --- a/gfx/webrender_bindings/WebRenderAPI.h +++ b/gfx/webrender_bindings/WebRenderAPI.h @@ -73,7 +73,7 @@ class NotificationHandler { virtual ~NotificationHandler() = default; }; -class TransactionBuilder { +class TransactionBuilder final { public: explicit TransactionBuilder(bool aUseSceneBuilderThread = true); @@ -183,7 +183,7 @@ class TransactionBuilder { Transaction* mTxn; }; -class TransactionWrapper { +class TransactionWrapper final { public: explicit TransactionWrapper(Transaction* aTxn); @@ -199,7 +199,7 @@ class TransactionWrapper { Transaction* mTxn; }; -class WebRenderAPI { +class WebRenderAPI final { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderAPI); public: @@ -346,12 +346,11 @@ struct MOZ_STACK_CLASS StackingContextParams : public WrStackingContextParams { /// This is a simple C++ wrapper around WrState defined in the rust bindings. /// We may want to turn this into a direct wrapper on top of /// WebRenderFrameBuilder instead, so the interface may change a bit. -class DisplayListBuilder { +class DisplayListBuilder final { public: - explicit DisplayListBuilder(wr::PipelineId aId, - const wr::LayoutSize& aContentSize, - size_t aCapacity = 0, - RenderRoot aRenderRoot = RenderRoot::Default); + DisplayListBuilder(wr::PipelineId aId, const wr::LayoutSize& aContentSize, + size_t aCapacity = 0, + RenderRoot aRenderRoot = RenderRoot::Default); DisplayListBuilder(DisplayListBuilder&&) = default; ~DisplayListBuilder(); @@ -568,7 +567,7 @@ class DisplayListBuilder { // A chain of RAII objects, each holding a (ASR, ViewID) tuple of data. The // topmost object is pointed to by the mActiveFixedPosTracker pointer in // the wr::DisplayListBuilder. - class MOZ_RAII FixedPosScrollTargetTracker { + class MOZ_RAII FixedPosScrollTargetTracker final { public: FixedPosScrollTargetTracker(DisplayListBuilder& aBuilder, const ActiveScrolledRoot* aAsr, @@ -625,7 +624,7 @@ class DisplayListBuilder { // This is a RAII class that overrides the current Wr's SpatialId and // ClipChainId. -class MOZ_RAII SpaceAndClipChainHelper { +class MOZ_RAII SpaceAndClipChainHelper final { public: SpaceAndClipChainHelper(DisplayListBuilder& aBuilder, wr::WrSpaceAndClipChain aSpaceAndClipChain diff --git a/gfx/webrender_bindings/WebRenderTypes.h b/gfx/webrender_bindings/WebRenderTypes.h index e354bef07804..31cf083a1228 100644 --- a/gfx/webrender_bindings/WebRenderTypes.h +++ b/gfx/webrender_bindings/WebRenderTypes.h @@ -730,7 +730,7 @@ template struct Vec; template <> -struct Vec { +struct Vec final { wr::WrVecU8 inner; Vec() { SetEmpty(); } Vec(Vec&) = delete;