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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 { | 218 { |
219 ASSERT(isMainThread()); | 219 ASSERT(isMainThread()); |
220 if (node()) | 220 if (node()) |
221 node()->dispatchEvent(Event::create(EventTypeNames::ended)); | 221 node()->dispatchEvent(Event::create(EventTypeNames::ended)); |
222 } | 222 } |
223 | 223 |
224 // ---------------------------------------------------------------- | 224 // ---------------------------------------------------------------- |
225 | 225 |
226 AudioScheduledSourceNode::AudioScheduledSourceNode(AbstractAudioContext& context
) | 226 AudioScheduledSourceNode::AudioScheduledSourceNode(AbstractAudioContext& context
) |
227 : AudioSourceNode(context) | 227 : AudioSourceNode(context) |
| 228 , m_isReleasedFromContext(false) |
228 { | 229 { |
229 } | 230 } |
230 | 231 |
231 AudioScheduledSourceHandler& AudioScheduledSourceNode::audioScheduledSourceHandl
er() const | 232 AudioScheduledSourceHandler& AudioScheduledSourceNode::audioScheduledSourceHandl
er() const |
232 { | 233 { |
233 return static_cast<AudioScheduledSourceHandler&>(handler()); | 234 return static_cast<AudioScheduledSourceHandler&>(handler()); |
234 } | 235 } |
235 | 236 |
236 void AudioScheduledSourceNode::start(ExceptionState& exceptionState) | 237 void AudioScheduledSourceNode::startNode(ExceptionState& exceptionState) |
237 { | 238 { |
238 start(0, exceptionState); | 239 startNode(0, exceptionState); |
239 } | 240 } |
240 | 241 |
241 void AudioScheduledSourceNode::start(double when, ExceptionState& exceptionState
) | 242 void AudioScheduledSourceNode::startNode(double when, ExceptionState& exceptionS
tate) |
242 { | 243 { |
243 audioScheduledSourceHandler().start(when, exceptionState); | 244 audioScheduledSourceHandler().start(when, exceptionState); |
244 } | 245 } |
245 | 246 |
246 void AudioScheduledSourceNode::stop(ExceptionState& exceptionState) | 247 void AudioScheduledSourceNode::stopNode(ExceptionState& exceptionState) |
247 { | 248 { |
248 stop(0, exceptionState); | 249 stopNode(0, exceptionState); |
249 } | 250 } |
250 | 251 |
251 void AudioScheduledSourceNode::stop(double when, ExceptionState& exceptionState) | 252 void AudioScheduledSourceNode::stopNode(double when, ExceptionState& exceptionSt
ate) |
252 { | 253 { |
253 audioScheduledSourceHandler().stop(when, exceptionState); | 254 audioScheduledSourceHandler().stop(when, exceptionState); |
254 } | 255 } |
255 | 256 |
256 EventListener* AudioScheduledSourceNode::onended() | 257 EventListener* AudioScheduledSourceNode::onended() |
257 { | 258 { |
258 return getAttributeEventListener(EventTypeNames::ended); | 259 return getAttributeEventListener(EventTypeNames::ended); |
259 } | 260 } |
260 | 261 |
261 void AudioScheduledSourceNode::setOnended(PassRefPtrWillBeRawPtr<EventListener>
listener) | 262 void AudioScheduledSourceNode::setOnended(PassRefPtrWillBeRawPtr<EventListener>
listener) |
262 { | 263 { |
263 setAttributeEventListener(EventTypeNames::ended, listener); | 264 setAttributeEventListener(EventTypeNames::ended, listener); |
264 } | 265 } |
265 | 266 |
| 267 void AudioScheduledSourceNode::releaseFromContext() |
| 268 { |
| 269 m_isReleasedFromContext = true; |
| 270 } |
| 271 |
| 272 bool AudioScheduledSourceNode::hasPendingActivity() const |
| 273 { |
| 274 // AudioScheduledSourceNodes (i.e. Oscillator and BufferSource) are marked |
| 275 // as following: |
| 276 // - if released from the context: do GC. |
| 277 // - when playing or scheduled: has pending activity, do not GC. |
| 278 // - when unscheduled or finished: no pending activity, do GC. |
| 279 if (m_isReleasedFromContext) |
| 280 return false; |
| 281 |
| 282 return audioScheduledSourceHandler().isPlayingOrScheduled(); |
| 283 } |
| 284 |
266 } // namespace blink | 285 } // namespace blink |
267 | 286 |
OLD | NEW |