Bug 853398: Disable TimeDuration::operator* (double) using MOZ_DELETE. r=bz
authorAvi Halachmi <avihpit@yahoo.com>
Fri, 22 Mar 2013 16:51:08 +0100
changeset 125932 90e1cafdd9c6a262dbc84ecd4a18c31cd5a546d4
parent 125931 ed753b70773f96658a3783f22f15a91bbb2c54a0
child 125933 b43bbab312e72bc0c20db30a86bdee0b82e0fd2d
push id25176
push uservdjeric@mozilla.com
push dateFri, 22 Mar 2013 16:12:28 +0000
treeherdermozilla-inbound@90e1cafdd9c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs853398
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 853398: Disable TimeDuration::operator* (double) using MOZ_DELETE. r=bz
xpcom/ds/TimeStamp.h
--- a/xpcom/ds/TimeStamp.h
+++ b/xpcom/ds/TimeStamp.h
@@ -87,18 +87,25 @@ public:
   TimeDuration& operator+=(const TimeDuration& aOther) {
     mValue += aOther.mValue;
     return *this;
   }
   TimeDuration& operator-=(const TimeDuration& aOther) {
     mValue -= aOther.mValue;
     return *this;
   }
-  TimeDuration operator*(const double aMultiplier) const {
-    return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
+
+private:
+  // Block double multiplier (slower, imprecise if long duration) - Bug 853398.
+  // If required, use MultDouble explicitly and with care.
+  TimeDuration operator*(const double aMultiplier) const MOZ_DELETE;
+
+public:
+  TimeDuration MultDouble(double aMultiplier) const {
+    return TimeDuration::FromTicks(static_cast<int64_t>(mValue * aMultiplier));
   }
   TimeDuration operator*(const int32_t aMultiplier) const {
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
   TimeDuration operator*(const uint32_t aMultiplier) const {
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
   TimeDuration operator*(const int64_t aMultiplier) const {