Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 605
606 void AudioParamTimeline::cancelScheduledValues(double startTime, 606 void AudioParamTimeline::cancelScheduledValues(double startTime,
607 ExceptionState& exceptionState) { 607 ExceptionState& exceptionState) {
608 DCHECK(isMainThread()); 608 DCHECK(isMainThread());
609 609
610 MutexLocker locker(m_eventsLock); 610 MutexLocker locker(m_eventsLock);
611 611
612 // Remove all events starting at startTime. 612 // Remove all events starting at startTime.
613 for (unsigned i = 0; i < m_events.size(); ++i) { 613 for (unsigned i = 0; i < m_events.size(); ++i) {
614 if (m_events[i]->time() >= startTime) { 614 if (m_events[i]->time() >= startTime) {
615 m_events.remove(i, m_events.size() - i); 615 m_events.erase(i, m_events.size() - i);
616 break; 616 break;
617 } 617 }
618 } 618 }
619 } 619 }
620 620
621 void AudioParamTimeline::cancelAndHoldAtTime(double cancelTime, 621 void AudioParamTimeline::cancelAndHoldAtTime(double cancelTime,
622 ExceptionState& exceptionState) { 622 ExceptionState& exceptionState) {
623 DCHECK(isMainThread()); 623 DCHECK(isMainThread());
624 624
625 if (!isNonNegativeAudioParamTime(cancelTime, exceptionState)) 625 if (!isNonNegativeAudioParamTime(cancelTime, exceptionState))
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 case ParamEvent::CancelValues: 717 case ParamEvent::CancelValues:
718 // Nothing needs to be done for a SetValue or CancelValues event. 718 // Nothing needs to be done for a SetValue or CancelValues event.
719 break; 719 break;
720 case ParamEvent::LastType: 720 case ParamEvent::LastType:
721 NOTREACHED(); 721 NOTREACHED();
722 break; 722 break;
723 } 723 }
724 724
725 // Now remove all the following events from the timeline. 725 // Now remove all the following events from the timeline.
726 if (cancelledEventIndex < m_events.size()) 726 if (cancelledEventIndex < m_events.size())
727 m_events.remove(cancelledEventIndex, m_events.size() - cancelledEventIndex); 727 m_events.erase(cancelledEventIndex, m_events.size() - cancelledEventIndex);
728 728
729 // Insert the new event, if any. 729 // Insert the new event, if any.
730 if (newEvent) { 730 if (newEvent) {
731 insertEvent(std::move(newEvent), exceptionState); 731 insertEvent(std::move(newEvent), exceptionState);
732 if (newSetValueEvent) 732 if (newSetValueEvent)
733 insertEvent(std::move(newSetValueEvent), exceptionState); 733 insertEvent(std::move(newSetValueEvent), exceptionState);
734 } 734 }
735 } 735 }
736 736
737 float AudioParamTimeline::valueForContextTime( 737 float AudioParamTimeline::valueForContextTime(
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 break; 960 break;
961 } 961 }
962 } 962 }
963 } 963 }
964 964
965 // If we skipped over any events (because they are in the past), we can 965 // If we skipped over any events (because they are in the past), we can
966 // remove them so we don't have to check them ever again. (This MUST be 966 // remove them so we don't have to check them ever again. (This MUST be
967 // running with the m_events lock so we can safely modify the m_events 967 // running with the m_events lock so we can safely modify the m_events
968 // array.) 968 // array.)
969 if (lastSkippedEventIndex > 0) 969 if (lastSkippedEventIndex > 0)
970 m_events.remove(0, lastSkippedEventIndex - 1); 970 m_events.erase(0, lastSkippedEventIndex - 1);
971 971
972 // If there's any time left after processing the last event then just 972 // If there's any time left after processing the last event then just
973 // propagate the last value to the end of the values buffer. 973 // propagate the last value to the end of the values buffer.
974 writeIndex = fillWithDefault(values, value, numberOfValues, writeIndex); 974 writeIndex = fillWithDefault(values, value, numberOfValues, writeIndex);
975 975
976 // This value is used to set the .value attribute of the AudioParam. it 976 // This value is used to set the .value attribute of the AudioParam. it
977 // should be the last computed value. 977 // should be the last computed value.
978 return values[numberOfValues - 1]; 978 return values[numberOfValues - 1];
979 } 979 }
980 980
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 unsigned writeIndex) { 1744 unsigned writeIndex) {
1745 size_t index = writeIndex; 1745 size_t index = writeIndex;
1746 1746
1747 for (; index < endFrame; ++index) 1747 for (; index < endFrame; ++index)
1748 values[index] = defaultValue; 1748 values[index] = defaultValue;
1749 1749
1750 return index; 1750 return index;
1751 } 1751 }
1752 1752
1753 } // namespace blink 1753 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698