Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 MutexTryLocker tryLocker(m_processLock); | 158 MutexTryLocker tryLocker(m_processLock); |
| 159 if (tryLocker.locked()) | 159 if (tryLocker.locked()) |
| 160 return m_reverb ? m_reverb->latencyFrames() / static_cast<double>(sample Rate()) : 0; | 160 return m_reverb ? m_reverb->latencyFrames() / static_cast<double>(sample Rate()) : 0; |
| 161 // Since we don't want to block the Audio Device thread, we return a large v alue | 161 // Since we don't want to block the Audio Device thread, we return a large v alue |
| 162 // instead of trying to acquire the lock. | 162 // instead of trying to acquire the lock. |
| 163 return std::numeric_limits<double>::infinity(); | 163 return std::numeric_limits<double>::infinity(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // ---------------------------------------------------------------- | 166 // ---------------------------------------------------------------- |
| 167 | 167 |
| 168 ConvolverNode::ConvolverNode(AbstractAudioContext& context, float sampleRate) | 168 ConvolverNode::ConvolverNode(AbstractAudioContext& context) |
| 169 : AudioNode(context) | 169 : AudioNode(context) |
| 170 { | 170 { |
| 171 setHandler(ConvolverHandler::create(*this, sampleRate)); | 171 setHandler(ConvolverHandler::create(*this, context.sampleRate())); |
| 172 } | 172 } |
| 173 | 173 |
| 174 ConvolverNode* ConvolverNode::create(AbstractAudioContext& context, float sample Rate) | 174 ConvolverNode* ConvolverNode::create(AbstractAudioContext& context, ExceptionSta te& exceptionState) |
| 175 { | 175 { |
| 176 return new ConvolverNode(context, sampleRate); | 176 ASSERT(isMainThread()); |
|
hongchan
2016/05/13 01:20:11
DCHECK?
Raymond Toy
2016/05/20 23:12:00
Done.
| |
| 177 | |
| 178 if (context.isContextClosed()) { | |
|
hongchan
2016/05/13 01:20:11
Perhaps we can make this to a method? This check-a
Raymond Toy
2016/05/13 16:36:01
I thought about that. But we'd still have to do s
Raymond Toy
2016/05/13 18:41:47
After some further discussions, we decided it woul
| |
| 179 context.throwExceptionForClosedState(exceptionState); | |
| 180 return nullptr; | |
| 181 } | |
| 182 | |
| 183 return new ConvolverNode(context); | |
| 177 } | 184 } |
| 178 | 185 |
| 179 ConvolverHandler& ConvolverNode::convolverHandler() const | 186 ConvolverHandler& ConvolverNode::convolverHandler() const |
| 180 { | 187 { |
| 181 return static_cast<ConvolverHandler&>(handler()); | 188 return static_cast<ConvolverHandler&>(handler()); |
| 182 } | 189 } |
| 183 | 190 |
| 184 AudioBuffer* ConvolverNode::buffer() const | 191 AudioBuffer* ConvolverNode::buffer() const |
| 185 { | 192 { |
| 186 return convolverHandler().buffer(); | 193 return convolverHandler().buffer(); |
| 187 } | 194 } |
| 188 | 195 |
| 189 void ConvolverNode::setBuffer(AudioBuffer* newBuffer, ExceptionState& exceptionS tate) | 196 void ConvolverNode::setBuffer(AudioBuffer* newBuffer, ExceptionState& exceptionS tate) |
| 190 { | 197 { |
| 191 convolverHandler().setBuffer(newBuffer, exceptionState); | 198 convolverHandler().setBuffer(newBuffer, exceptionState); |
| 192 } | 199 } |
| 193 | 200 |
| 194 bool ConvolverNode::normalize() const | 201 bool ConvolverNode::normalize() const |
| 195 { | 202 { |
| 196 return convolverHandler().normalize(); | 203 return convolverHandler().normalize(); |
| 197 } | 204 } |
| 198 | 205 |
| 199 void ConvolverNode::setNormalize(bool normalize) | 206 void ConvolverNode::setNormalize(bool normalize) |
| 200 { | 207 { |
| 201 convolverHandler().setNormalize(normalize); | 208 convolverHandler().setNormalize(normalize); |
| 202 } | 209 } |
| 203 | 210 |
| 204 } // namespace blink | 211 } // namespace blink |
| 205 | 212 |
| OLD | NEW |