bug 1257718 replace bailOut variable with more descriptive timeMatchesEventIndex r?padenot draft
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 21 Jun 2016 17:48:31 +1200
changeset 380509 18f932bca942254f181e0299cbb9f6120c21a6a2
parent 380508 bdc1239c8b42893a139b9a6f74932e8b6cb0fe06
child 380510 34e7fec6e732145a7aa4d735fec54dfde9de8dc9
push id21234
push userktomlinson@mozilla.com
push dateWed, 22 Jun 2016 05:11:59 +0000
reviewerspadenot
bugs1257718
milestone50.0a1
bug 1257718 replace bailOut variable with more descriptive timeMatchesEventIndex r?padenot with the new variable matching the loop exit status of interest. MozReview-Commit-ID: 8xy5ipo4trp
dom/media/webaudio/AudioEventTimeline.cpp
--- a/dom/media/webaudio/AudioEventTimeline.cpp
+++ b/dom/media/webaudio/AudioEventTimeline.cpp
@@ -155,28 +155,27 @@ AudioEventTimeline::GetValuesAtTimeHelpe
   // Let's remove old events except the last one: we need it to calculate some curves.
   while (mEvents.Length() > 1 &&
          aTime > TimeOf(mEvents[1])) {
     mEvents.RemoveElementAt(0);
   }
 
   for (size_t bufferIndex = 0; bufferIndex < aSize; ++bufferIndex, ++aTime) {
 
-    bool bailOut = false;
+    bool timeMatchesEventIndex = false;
     const AudioTimelineEvent* next;
     for (; ; ++eventIndex) {
 
       if (eventIndex >= mEvents.Length()) {
         next = nullptr;
         break;
       }
 
       next = &mEvents[eventIndex];
       if (aTime < TimeOf(*next)) {
-        bailOut = true;
         break;
       }
 
 #ifdef DEBUG
       MOZ_ASSERT(next->mType == AudioTimelineEvent::SetValueAtTime ||
                  next->mType == AudioTimelineEvent::SetTarget ||
                  next->mType == AudioTimelineEvent::LinearRamp ||
                  next->mType == AudioTimelineEvent::ExponentialRamp ||
@@ -185,23 +184,24 @@ AudioEventTimeline::GetValuesAtTimeHelpe
 
       if (TimesEqual(aTime, TimeOf(*next))) {
         mLastComputedValue = mComputedValue;
         // Find the last event with the same time
         while (eventIndex < mEvents.Length() - 1 &&
                TimesEqual(aTime, TimeOf(mEvents[eventIndex + 1]))) {
           ++eventIndex;
         }
+        timeMatchesEventIndex = true;
         break;
       }
 
       previous = next;
     }
 
-    if (!bailOut && eventIndex < mEvents.Length()) {
+    if (timeMatchesEventIndex) {
       // The time matches one of the events exactly.
       MOZ_ASSERT(TimesEqual(aTime, TimeOf(mEvents[eventIndex])));
 
       // SetTarget nodes can be handled no matter what their next node is (if they have one)
       if (mEvents[eventIndex].mType == AudioTimelineEvent::SetTarget) {
         // Follow the curve, without regard to the next event, starting at
         // the last value of the last event.
         aBuffer[bufferIndex] = ExponentialApproach(TimeOf(mEvents[eventIndex]),