| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 * 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (when < 0) { | 146 if (when < 0) { |
| 147 exceptionState.throwDOMException( | 147 exceptionState.throwDOMException( |
| 148 InvalidAccessError, | 148 InvalidAccessError, |
| 149 ExceptionMessages::indexExceedsMinimumBound( | 149 ExceptionMessages::indexExceedsMinimumBound( |
| 150 "start time", | 150 "start time", |
| 151 when, | 151 when, |
| 152 0.0)); | 152 0.0)); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 // This synchronizes with process(). updateSchedulingInfo will read some of
the variables being |
| 157 // set here. |
| 158 MutexLocker processLocker(m_processLock); |
| 159 |
| 156 // The node is started. Add a reference to keep us alive so that audio will
eventually get | 160 // The node is started. Add a reference to keep us alive so that audio will
eventually get |
| 157 // played even if Javascript should drop all references to this node. The re
ference will get | 161 // played even if Javascript should drop all references to this node. The re
ference will get |
| 158 // dropped when the source has finished playing. | 162 // dropped when the source has finished playing. |
| 159 context()->notifySourceNodeStartedProcessing(node()); | 163 context()->notifySourceNodeStartedProcessing(node()); |
| 160 | 164 |
| 161 // If |when| < currentTime, the source must start now according to the spec. | 165 // If |when| < currentTime, the source must start now according to the spec. |
| 162 // So just set startTime to currentTime in this case to start the source now
. | 166 // So just set startTime to currentTime in this case to start the source now
. |
| 163 m_startTime = std::max(when, context()->currentTime()); | 167 m_startTime = std::max(when, context()->currentTime()); |
| 164 | 168 |
| 165 setPlaybackState(SCHEDULED_STATE); | 169 setPlaybackState(SCHEDULED_STATE); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 179 if (when < 0) { | 183 if (when < 0) { |
| 180 exceptionState.throwDOMException( | 184 exceptionState.throwDOMException( |
| 181 InvalidAccessError, | 185 InvalidAccessError, |
| 182 ExceptionMessages::indexExceedsMinimumBound( | 186 ExceptionMessages::indexExceedsMinimumBound( |
| 183 "stop time", | 187 "stop time", |
| 184 when, | 188 when, |
| 185 0.0)); | 189 0.0)); |
| 186 return; | 190 return; |
| 187 } | 191 } |
| 188 | 192 |
| 193 // This synchronizes with process() |
| 194 MutexLocker processLocker(m_processLock); |
| 195 |
| 189 // stop() can be called more than once, with the last call to stop taking ef
fect, unless the | 196 // stop() can be called more than once, with the last call to stop taking ef
fect, unless the |
| 190 // source has already stopped due to earlier calls to stop. No exceptions ar
e thrown in any | 197 // source has already stopped due to earlier calls to stop. No exceptions ar
e thrown in any |
| 191 // case. | 198 // case. |
| 192 when = std::max(0.0, when); | 199 when = std::max(0.0, when); |
| 193 m_endTime = when; | 200 m_endTime = when; |
| 194 } | 201 } |
| 195 | 202 |
| 196 void AudioScheduledSourceHandler::finishWithoutOnEnded() | 203 void AudioScheduledSourceHandler::finishWithoutOnEnded() |
| 197 { | 204 { |
| 198 if (playbackState() != FINISHED_STATE) { | 205 if (playbackState() != FINISHED_STATE) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 263 |
| 257 void AudioScheduledSourceNode::setOnended(PassRefPtrWillBeRawPtr<EventListener>
listener) | 264 void AudioScheduledSourceNode::setOnended(PassRefPtrWillBeRawPtr<EventListener>
listener) |
| 258 { | 265 { |
| 259 audioScheduledSourceHandler().setHasEndedListener(); | 266 audioScheduledSourceHandler().setHasEndedListener(); |
| 260 setAttributeEventListener(EventTypeNames::ended, listener); | 267 setAttributeEventListener(EventTypeNames::ended, listener); |
| 261 } | 268 } |
| 262 | 269 |
| 263 } // namespace blink | 270 } // namespace blink |
| 264 | 271 |
| 265 #endif // ENABLE(WEB_AUDIO) | 272 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |