OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return TimeRanges::create(m_webSourceBuffer->buffered()); | 168 return TimeRanges::create(m_webSourceBuffer->buffered()); |
169 } | 169 } |
170 | 170 |
171 double SourceBuffer::timestampOffset() const | 171 double SourceBuffer::timestampOffset() const |
172 { | 172 { |
173 return m_timestampOffset; | 173 return m_timestampOffset; |
174 } | 174 } |
175 | 175 |
176 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& exceptionSt
ate) | 176 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& exceptionSt
ate) |
177 { | 177 { |
178 // Enforce throwing an exception on restricted double values. | |
179 if (!std::isfinite(offset)) { | |
180 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(offset
)); | |
181 return; | |
182 } | |
183 | |
184 // Section 3.1 timestampOffset attribute setter steps. | 178 // Section 3.1 timestampOffset attribute setter steps. |
| 179 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.
html#widl-SourceBuffer-timestampOffset |
185 // 1. Let new timestamp offset equal the new value being assigned to this at
tribute. | 180 // 1. Let new timestamp offset equal the new value being assigned to this at
tribute. |
186 // 2. If this object has been removed from the sourceBuffers attribute of th
e parent media source, then throw an | 181 // 2. If this object has been removed from the sourceBuffers attribute of th
e parent media source, then throw an |
187 // InvalidStateError exception and abort these steps. | 182 // InvalidStateError exception and abort these steps. |
188 // 3. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 183 // 3. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
189 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat
e)) | 184 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat
e)) |
190 return; | 185 return; |
191 | 186 |
192 // 4. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: | 187 // 4. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: |
193 // 4.1 Set the readyState attribute of the parent media source to "open" | 188 // 4.1 Set the readyState attribute of the parent media source to "open" |
194 // 4.2 Queue a task to fire a simple event named sourceopen at the parent me
dia source. | 189 // 4.2 Queue a task to fire a simple event named sourceopen at the parent me
dia source. |
(...skipping 10 matching lines...) Expand all Loading... |
205 m_timestampOffset = offset; | 200 m_timestampOffset = offset; |
206 } | 201 } |
207 | 202 |
208 double SourceBuffer::appendWindowStart() const | 203 double SourceBuffer::appendWindowStart() const |
209 { | 204 { |
210 return m_appendWindowStart; | 205 return m_appendWindowStart; |
211 } | 206 } |
212 | 207 |
213 void SourceBuffer::setAppendWindowStart(double start, ExceptionState& exceptionS
tate) | 208 void SourceBuffer::setAppendWindowStart(double start, ExceptionState& exceptionS
tate) |
214 { | 209 { |
215 // Enforce throwing an exception on restricted double values. | |
216 if (!std::isfinite(start)) { | |
217 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(start)
); | |
218 return; | |
219 } | |
220 | |
221 // Section 3.1 appendWindowStart attribute setter steps. | 210 // Section 3.1 appendWindowStart attribute setter steps. |
| 211 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.
html#widl-SourceBuffer-appendWindowStart |
222 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an | 212 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an |
223 // InvalidStateError exception and abort these steps. | 213 // InvalidStateError exception and abort these steps. |
224 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 214 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
225 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat
e)) | 215 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat
e)) |
226 return; | 216 return; |
227 | 217 |
228 // 3. If the new value is less than 0 or greater than or equal to appendWind
owEnd then throw an InvalidAccessError | 218 // 3. If the new value is less than 0 or greater than or equal to appendWind
owEnd then throw an InvalidAccessError |
229 // exception and abort these steps. | 219 // exception and abort these steps. |
230 if (start < 0 || start >= m_appendWindowEnd) { | 220 if (start < 0 || start >= m_appendWindowEnd) { |
231 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
indexOutsideRange("value", start, 0.0, ExceptionMessages::ExclusiveBound, m_appe
ndWindowEnd, ExceptionMessages::InclusiveBound)); | 221 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
indexOutsideRange("value", start, 0.0, ExceptionMessages::ExclusiveBound, m_appe
ndWindowEnd, ExceptionMessages::InclusiveBound)); |
232 return; | 222 return; |
233 } | 223 } |
234 | 224 |
235 m_webSourceBuffer->setAppendWindowStart(start); | 225 m_webSourceBuffer->setAppendWindowStart(start); |
236 | 226 |
237 // 4. Update the attribute to the new value. | 227 // 4. Update the attribute to the new value. |
238 m_appendWindowStart = start; | 228 m_appendWindowStart = start; |
239 } | 229 } |
240 | 230 |
241 double SourceBuffer::appendWindowEnd() const | 231 double SourceBuffer::appendWindowEnd() const |
242 { | 232 { |
243 return m_appendWindowEnd; | 233 return m_appendWindowEnd; |
244 } | 234 } |
245 | 235 |
246 void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& exceptionState
) | 236 void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& exceptionState
) |
247 { | 237 { |
248 // Section 3.1 appendWindowEnd attribute setter steps. | 238 // Section 3.1 appendWindowEnd attribute setter steps. |
| 239 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.
html#widl-SourceBuffer-appendWindowEnd |
249 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an | 240 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an |
250 // InvalidStateError exception and abort these steps. | 241 // InvalidStateError exception and abort these steps. |
251 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 242 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
252 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat
e)) | 243 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat
e)) |
253 return; | 244 return; |
254 | 245 |
255 // 3. If the new value equals NaN, then throw an InvalidAccessError and abor
t these steps. | 246 // 3. If the new value equals NaN, then throw an InvalidAccessError and abor
t these steps. |
256 // 4. If the new value is less than or equal to appendWindowStart then throw
an InvalidAccessError | 247 // 4. If the new value is less than or equal to appendWindowStart then throw
an InvalidAccessError |
257 // exception and abort these steps. | 248 // exception and abort these steps. |
258 if (std::isnan(end)) { | 249 if (std::isnan(end)) { |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 appendStreamDone(false); | 698 appendStreamDone(false); |
708 } | 699 } |
709 | 700 |
710 void SourceBuffer::trace(Visitor* visitor) | 701 void SourceBuffer::trace(Visitor* visitor) |
711 { | 702 { |
712 visitor->trace(m_source); | 703 visitor->trace(m_source); |
713 visitor->trace(m_stream); | 704 visitor->trace(m_stream); |
714 } | 705 } |
715 | 706 |
716 } // namespace WebCore | 707 } // namespace WebCore |
OLD | NEW |