Back out 6a5dcf166f09 (bug 836072) for build bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 07 Feb 2013 21:35:08 -0800
changeset 121263 09796dfecc53b123917dd44e3c4f5b2f53037124
parent 121262 6a5dcf166f090f4a3f6995b7e030f6852cd028de
child 121264 ded7b4099975b7dc5e8971ef8b32ffb86af41a32
push id24278
push useremorley@mozilla.com
push dateFri, 08 Feb 2013 11:01:12 +0000
treeherdermozilla-central@fcf79680a057 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs836072
milestone21.0a1
backs out6a5dcf166f090f4a3f6995b7e030f6852cd028de
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
Back out 6a5dcf166f09 (bug 836072) for build bustage CLOSED TREE
content/media/AudioEventTimeline.h
content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp
--- a/content/media/AudioEventTimeline.h
+++ b/content/media/AudioEventTimeline.h
@@ -289,57 +289,16 @@ public:
   }
 
   static float ExponentialApproach(double t0, double v0, float v1, double timeConstant, double t)
   {
     return v1 + (v0 - v1) * expf(-(t - t0) / timeConstant);
   }
 
 private:
-  const Event* GetPreviousEvent(double aTime) const
-  {
-    const Event* previous = nullptr;
-    const Event* next = nullptr;
-
-    bool bailOut = false;
-    for (unsigned i = 0; !bailOut && i < mEvents.Length(); ++i) {
-      switch (mEvents[i].mType) {
-      case Event::SetValue:
-      case Event::SetTarget:
-      case Event::LinearRamp:
-      case Event::ExponentialRamp:
-        if (aTime == mEvents[i].mTime) {
-          // Find the last event with the same time
-          do {
-            ++i;
-          } while (i < mEvents.Length() &&
-                   aTime == mEvents[i].mTime);
-          return &mEvents[i - 1];
-        }
-        previous = next;
-        next = &mEvents[i];
-        if (aTime < mEvents[i].mTime) {
-          bailOut = true;
-        }
-        break;
-      case Event::SetValueCurve:
-        // TODO: implement
-        break;
-      default:
-        MOZ_ASSERT(false, "unreached");
-      }
-    }
-    // Handle the case where the time is past all of the events
-    if (!bailOut) {
-      previous = next;
-    }
-
-    return previous;
-  }
-
   void InsertEvent(const Event& aEvent, ErrorResult& aRv)
   {
     if (!aEvent.IsValid()) {
       aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
       return;
     }
 
     // Make sure that non-curve events don't fall within the duration of a
@@ -360,36 +319,16 @@ private:
         if (mEvents[i].mTime >= aEvent.mTime &&
             mEvents[i].mTime <= (aEvent.mTime + aEvent.mDuration)) {
           aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
           return;
         }
       }
     }
 
-    // Make sure that invalid values are not used for exponential curves
-    if (aEvent.mType == Event::ExponentialRamp) {
-      if (aEvent.mValue <= 0.f) {
-        aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
-        return;
-      }
-      const Event* previousEvent = GetPreviousEvent(aEvent.mTime);
-      if (previousEvent) {
-        if (previousEvent->mValue <= 0.f) {
-          aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
-          return;
-        }
-      } else {
-        if (mValue <= 0.f) {
-          aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
-          return;
-        }
-      }
-    }
-
     for (unsigned i = 0; i < mEvents.Length(); ++i) {
       if (aEvent.mTime == mEvents[i].mTime) {
         if (aEvent.mType == mEvents[i].mType) {
           // If times and types are equal, replace the event
           mEvents.ReplaceElementAt(i, aEvent);
         } else {
           // Otherwise, place the element after the last event of another type
           do {
--- a/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp
+++ b/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp
@@ -65,22 +65,16 @@ public:
     mRv = aRv;
   }
 
   operator nsresult() const
   {
     return mRv;
   }
 
-  ErrorResultMock& operator=(nsresult aRv)
-  {
-    mRv = aRv;
-    return *this;
-  }
-
 private:
   nsresult mRv;
 };
 
 typedef AudioEventTimeline<ErrorResultMock> Timeline;
 
 void TestSpecExample()
 {
@@ -155,18 +149,16 @@ void TestInvalidEvents()
   timeline.LinearRampToValueAtTime(-Infinity, 0.2, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.ExponentialRampToValueAtTime(NaN, 0.3, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.ExponentialRampToValueAtTime(Infinity, 0.3, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.ExponentialRampToValueAtTime(-Infinity, 0.4, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
-  timeline.ExponentialRampToValueAtTime(0, 0.5, rv);
-  is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.SetTargetAtTime(NaN, 0.4, 1.0, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.SetTargetAtTime(Infinity, 0.4, 1.0, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.SetTargetAtTime(-Infinity, 0.4, 1.0, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.SetTargetAtTime(0.4f, NaN, 1.0, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
@@ -319,42 +311,16 @@ void TestSetTargetZeroTimeConstant()
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetTargetAtTime(20.0f, 1.0, 0.0, rv);
   is(timeline.GetValueAtTime(10.f), 20.f, "Should get the correct value with timeConstant == 0");
 }
 
-void TestExponentialInvalidPreviousZeroValue()
-{
-  Timeline timeline(0.f);
-
-  ErrorResultMock rv;
-
-  timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv);
-  is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
-  timeline.SetValue(1.f);
-  rv = NS_OK;
-  timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv);
-  is(rv, NS_OK, "Should succeed this time");
-  timeline.CancelScheduledValues(0.0);
-  is(timeline.GetEventCount(), 0, "Should have no events scheduled");
-  rv = NS_OK;
-  timeline.SetValueAtTime(0.f, 0.5, rv);
-  is(rv, NS_OK, "Should succeed");
-  timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv);
-  is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
-  timeline.CancelScheduledValues(0.0);
-  is(timeline.GetEventCount(), 0, "Should have no events scheduled");
-  rv = NS_OK;
-  timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv);
-  is(rv, NS_OK, "Should succeed this time");
-}
-
 int main()
 {
   ScopedXPCOM xpcom("TestAudioEventTimeline");
   if (xpcom.failed()) {
     return 1;
   }
 
   TestSpecExample();
@@ -366,13 +332,12 @@ int main()
   TestAfterLastTargetValueEvent();
   TestAfterLastTargetValueEventWithValueSet();
   TestValue();
   TestLinearRampAtZero();
   TestExponentialRampAtZero();
   TestLinearRampAtSameTime();
   TestExponentialRampAtSameTime();
   TestSetTargetZeroTimeConstant();
-  TestExponentialInvalidPreviousZeroValue();
 
   return gFailCount > 0;
 }