OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // TODO: Given that we assume that ranges are correctly ordered, this could be | 137 // TODO: Given that we assume that ranges are correctly ordered, this could be |
138 // optimized. | 138 // optimized. |
139 | 139 |
140 for (overlappingArcIndex = 0; overlappingArcIndex < m_ranges.size(); | 140 for (overlappingArcIndex = 0; overlappingArcIndex < m_ranges.size(); |
141 overlappingArcIndex++) { | 141 overlappingArcIndex++) { |
142 if (addedRange.isOverlappingRange(m_ranges[overlappingArcIndex]) || | 142 if (addedRange.isOverlappingRange(m_ranges[overlappingArcIndex]) || |
143 addedRange.isContiguousWithRange(m_ranges[overlappingArcIndex])) { | 143 addedRange.isContiguousWithRange(m_ranges[overlappingArcIndex])) { |
144 // We need to merge the addedRange and that range. | 144 // We need to merge the addedRange and that range. |
145 addedRange = addedRange.unionWithOverlappingOrContiguousRange( | 145 addedRange = addedRange.unionWithOverlappingOrContiguousRange( |
146 m_ranges[overlappingArcIndex]); | 146 m_ranges[overlappingArcIndex]); |
147 m_ranges.remove(overlappingArcIndex); | 147 m_ranges.erase(overlappingArcIndex); |
148 overlappingArcIndex--; | 148 overlappingArcIndex--; |
149 } else { | 149 } else { |
150 // Check the case for which there is no more to do | 150 // Check the case for which there is no more to do |
151 if (!overlappingArcIndex) { | 151 if (!overlappingArcIndex) { |
152 if (addedRange.isBeforeRange(m_ranges[0])) { | 152 if (addedRange.isBeforeRange(m_ranges[0])) { |
153 // First index, and we are completely before that range (and not | 153 // First index, and we are completely before that range (and not |
154 // contiguous, nor overlapping). We just need to be inserted here. | 154 // contiguous, nor overlapping). We just need to be inserted here. |
155 break; | 155 break; |
156 } | 156 } |
157 } else { | 157 } else { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 std::abs(currentPlaybackPosition - match) < | 204 std::abs(currentPlaybackPosition - match) < |
205 std::abs(currentPlaybackPosition - bestMatch))) { | 205 std::abs(currentPlaybackPosition - bestMatch))) { |
206 bestDelta = delta; | 206 bestDelta = delta; |
207 bestMatch = match; | 207 bestMatch = match; |
208 } | 208 } |
209 } | 209 } |
210 return bestMatch; | 210 return bestMatch; |
211 } | 211 } |
212 | 212 |
213 } // namespace blink | 213 } // namespace blink |
OLD | NEW |