Bug 903543 - eliminate static constructors for SMIL type singletons; r=dholbert

Add MOZ_CONSTEXPR to the constructors to inform the compiler the constructors
can be folded away.  Remove protected/private destructors so that static
destructors don't have to be registered with static constructors.
This commit is contained in:
Nathan Froyd 2013-08-12 10:13:34 -04:00
parent 400a5f7467
commit f2686f1332
18 changed files with 34 additions and 72 deletions

View File

@ -40,10 +40,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SMILBoolType() {}
~SMILBoolType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SMILBoolType() {}
};
} // namespace mozilla

View File

@ -41,10 +41,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SMILEnumType() {}
~SMILEnumType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SMILEnumType() {}
};
} // namespace mozilla

View File

@ -37,7 +37,7 @@ public:
}
private:
SMILIntegerType() {}
MOZ_CONSTEXPR SMILIntegerType() {}
};
} // namespace mozilla

View File

@ -41,10 +41,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SMILStringType() {}
~SMILStringType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SMILStringType() {}
};
} // namespace mozilla

View File

@ -6,6 +6,7 @@
#ifndef NS_ISMILTYPE_H_
#define NS_ISMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nscore.h"
class nsSMILValue;
@ -207,13 +208,6 @@ protected:
const nsSMILValue& aEndVal,
double aUnitDistance,
nsSMILValue& aResult) const = 0;
/**
* Protected destructor, to ensure that no one accidentally deletes an
* instance of this class.
* (The only instances in existence should be singletons - one per subclass.)
*/
~nsISMILType() {}
};
#endif // NS_ISMILTYPE_H_

View File

@ -98,10 +98,8 @@ public:
static bool ValueToString(const nsSMILValue& aValue, nsAString& aString);
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
nsSMILCSSValueType() {}
~nsSMILCSSValueType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR nsSMILCSSValueType() {}
};
#endif // NS_SMILCSSVALUETYPE_H_

View File

@ -39,10 +39,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
nsSMILFloatType() {}
~nsSMILFloatType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR nsSMILFloatType() {}
};
#endif // NS_SMILFLOATTYPE_H_

View File

@ -42,10 +42,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
nsSMILNullType() {}
~nsSMILNullType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR nsSMILNullType() {}
};
#endif // NS_SMILNULLTYPE_H_

View File

@ -43,10 +43,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGIntegerPairSMILType() {}
~SVGIntegerPairSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGIntegerPairSMILType() {}
};
} // namespace mozilla

View File

@ -91,10 +91,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGLengthListSMILType() {}
~SVGLengthListSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGLengthListSMILType() {}
};
} // namespace mozilla

View File

@ -71,10 +71,8 @@ public:
float aRotateAngle);
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGMotionSMILType() {}
~SVGMotionSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGMotionSMILType() {}
};
} // namespace mozilla

View File

@ -45,10 +45,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGNumberListSMILType() {}
~SVGNumberListSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGNumberListSMILType() {}
};
} // namespace mozilla

View File

@ -38,10 +38,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGNumberPairSMILType() {}
~SVGNumberPairSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGNumberPairSMILType() {}
};
} // namespace mozilla

View File

@ -58,10 +58,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGOrientSMILType() {}
~SVGOrientSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGOrientSMILType() {}
};
} // namespace mozilla

View File

@ -49,10 +49,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGPathSegListSMILType() {}
~SVGPathSegListSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGPathSegListSMILType() {}
};
} // namespace mozilla

View File

@ -45,10 +45,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGPointListSMILType() {}
~SVGPointListSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGPointListSMILType() {}
};
} // namespace mozilla

View File

@ -121,10 +121,8 @@ public:
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGTransformListSMILType() {}
~SVGTransformListSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGTransformListSMILType() {}
};
} // end namespace mozilla

View File

@ -38,10 +38,8 @@ protected:
nsSMILValue& aResult) const MOZ_OVERRIDE;
private:
// Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton.
SVGViewBoxSMILType() {}
~SVGViewBoxSMILType() {}
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGViewBoxSMILType() {}
};
} // namespace mozilla