Bug 903543 - eliminate static constructors from SMIL types (and destructors, in opt builds); r=dholbert

This commit is contained in:
Nathan Froyd 2013-08-09 14:08:31 -04:00
parent 71abcfec30
commit 9ebfa27137
18 changed files with 62 additions and 17 deletions

View File

@ -42,8 +42,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SMILBoolType() {} MOZ_CONSTEXPR SMILBoolType() {}
#ifdef DEBUG
~SMILBoolType() {} ~SMILBoolType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -43,8 +43,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SMILEnumType() {} MOZ_CONSTEXPR SMILEnumType() {}
#ifdef DEBUG
~SMILEnumType() {} ~SMILEnumType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -37,7 +37,10 @@ public:
} }
private: private:
SMILIntegerType() {} MOZ_CONSTEXPR SMILIntegerType() {}
#ifdef DEBUG
~SMILIntegerType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -43,8 +43,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SMILStringType() {} MOZ_CONSTEXPR SMILStringType() {}
#ifdef DEBUG
~SMILStringType() {} ~SMILStringType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -6,6 +6,7 @@
#ifndef NS_ISMILTYPE_H_ #ifndef NS_ISMILTYPE_H_
#define NS_ISMILTYPE_H_ #define NS_ISMILTYPE_H_
#include "mozilla/Attributes.h"
#include "nscore.h" #include "nscore.h"
class nsSMILValue; class nsSMILValue;
@ -212,8 +213,17 @@ protected:
* Protected destructor, to ensure that no one accidentally deletes an * Protected destructor, to ensure that no one accidentally deletes an
* instance of this class. * instance of this class.
* (The only instances in existence should be singletons - one per subclass.) * (The only instances in existence should be singletons - one per subclass.)
*
* This destructor and the destructors of subclasses are only defined in
* debug builds. For non-debug builds, we let the compiler define the
* default (public) constructor. The compiler understands that the default
* destructor doesn't necessarily need to be invoked (e.g. if there are no
* members to destroy) and so will avoid creating static destructors (and
* registering them with static *constructors*) in non-debug builds.
*/ */
#ifdef DEBUG
~nsISMILType() {} ~nsISMILType() {}
#endif
}; };
#endif // NS_ISMILTYPE_H_ #endif // NS_ISMILTYPE_H_

View File

@ -100,8 +100,10 @@ public:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
nsSMILCSSValueType() {} MOZ_CONSTEXPR nsSMILCSSValueType() {}
#ifdef DEBUG
~nsSMILCSSValueType() {} ~nsSMILCSSValueType() {}
#endif
}; };
#endif // NS_SMILCSSVALUETYPE_H_ #endif // NS_SMILCSSVALUETYPE_H_

View File

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

View File

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

View File

@ -45,8 +45,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGIntegerPairSMILType() {} MOZ_CONSTEXPR SVGIntegerPairSMILType() {}
#ifdef DEBUG
~SVGIntegerPairSMILType() {} ~SVGIntegerPairSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -93,8 +93,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGLengthListSMILType() {} MOZ_CONSTEXPR SVGLengthListSMILType() {}
#ifdef DEBUG
~SVGLengthListSMILType() {} ~SVGLengthListSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

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

View File

@ -47,8 +47,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGNumberListSMILType() {} MOZ_CONSTEXPR SVGNumberListSMILType() {}
#ifdef DEBUG
~SVGNumberListSMILType() {} ~SVGNumberListSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -40,8 +40,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGNumberPairSMILType() {} MOZ_CONSTEXPR SVGNumberPairSMILType() {}
#ifdef DEBUG
~SVGNumberPairSMILType() {} ~SVGNumberPairSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -60,8 +60,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGOrientSMILType() {} MOZ_CONSTEXPR SVGOrientSMILType() {}
#ifdef DEBUG
~SVGOrientSMILType() {} ~SVGOrientSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -51,8 +51,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGPathSegListSMILType() {} MOZ_CONSTEXPR SVGPathSegListSMILType() {}
#ifdef DEBUG
~SVGPathSegListSMILType() {} ~SVGPathSegListSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

@ -47,8 +47,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGPointListSMILType() {} MOZ_CONSTEXPR SVGPointListSMILType() {}
#ifdef DEBUG
~SVGPointListSMILType() {} ~SVGPointListSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla

View File

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

View File

@ -40,8 +40,10 @@ protected:
private: private:
// Private constructor & destructor: prevent instances beyond my singleton, // Private constructor & destructor: prevent instances beyond my singleton,
// and prevent others from deleting my singleton. // and prevent others from deleting my singleton.
SVGViewBoxSMILType() {} MOZ_CONSTEXPR SVGViewBoxSMILType() {}
#ifdef DEBUG
~SVGViewBoxSMILType() {} ~SVGViewBoxSMILType() {}
#endif
}; };
} // namespace mozilla } // namespace mozilla