| 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 * | 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 static const double UnknownTime; | 116 static const double UnknownTime; |
| 117 private: | 117 private: |
| 118 // This is accessed by both the main thread and audio thread. Use the sette
r and getter to | 118 // This is accessed by both the main thread and audio thread. Use the sette
r and getter to |
| 119 // protect the access to this! | 119 // protect the access to this! |
| 120 int m_playbackState; | 120 int m_playbackState; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class AudioScheduledSourceNode : public AudioSourceNode { | 123 class AudioScheduledSourceNode : public AudioSourceNode { |
| 124 public: | 124 public: |
| 125 void start(ExceptionState&); | 125 void startNode(ExceptionState&); |
| 126 void start(double when, ExceptionState&); | 126 void startNode(double when, ExceptionState&); |
| 127 void stop(ExceptionState&); | 127 void stopNode(ExceptionState&); |
| 128 void stop(double when, ExceptionState&); | 128 void stopNode(double when, ExceptionState&); |
| 129 | 129 |
| 130 EventListener* onended(); | 130 EventListener* onended(); |
| 131 void setOnended(PassRefPtrWillBeRawPtr<EventListener>); | 131 void setOnended(PassRefPtrWillBeRawPtr<EventListener>); |
| 132 | 132 |
| 133 // ScriptWrappable |
| 134 bool hasPendingActivity() const final; |
| 135 |
| 136 // It is possible to play a source node for a very long time or to schedule |
| 137 // too far in the future; thus infinitely playing/scheduled sources leak |
| 138 // when the execution context is tearing down because |hasPendingActivity| |
| 139 // returns true. |
| 140 // |
| 141 // So we call |markForGC| to mark the node as 'available for GC' regardless |
| 142 // of its playback state. |
| 143 void markForGC(); |
| 144 |
| 133 protected: | 145 protected: |
| 134 explicit AudioScheduledSourceNode(AbstractAudioContext&); | 146 explicit AudioScheduledSourceNode(AbstractAudioContext&); |
| 135 AudioScheduledSourceHandler& audioScheduledSourceHandler() const; | 147 AudioScheduledSourceHandler& audioScheduledSourceHandler() const; |
| 148 |
| 149 private: |
| 150 bool m_isMarkedForGC; |
| 136 }; | 151 }; |
| 137 | 152 |
| 138 } // namespace blink | 153 } // namespace blink |
| 139 | 154 |
| 140 #endif // AudioScheduledSourceNode_h | 155 #endif // AudioScheduledSourceNode_h |
| OLD | NEW |