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 * | 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } | 315 } |
316 | 316 |
317 void AudioBuffer::zero() | 317 void AudioBuffer::zero() |
318 { | 318 { |
319 for (unsigned i = 0; i < m_channels.size(); ++i) { | 319 for (unsigned i = 0; i < m_channels.size(); ++i) { |
320 if (getChannelData(i)) | 320 if (getChannelData(i)) |
321 getChannelData(i)->zeroRange(0, length()); | 321 getChannelData(i)->zeroRange(0, length()); |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
325 v8::Handle<v8::Object> AudioBuffer::associateWithWrapper(v8::Isolate* isolate, c
onst WrapperTypeInfo* wrapperType, v8::Handle<v8::Object> wrapper) | 325 v8::Local<v8::Object> AudioBuffer::associateWithWrapper(v8::Isolate* isolate, co
nst WrapperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper) |
326 { | 326 { |
327 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper); | 327 ScriptWrappable::associateWithWrapper(isolate, wrapperType, wrapper); |
328 | 328 |
329 if (!wrapper.IsEmpty()) { | 329 if (!wrapper.IsEmpty()) { |
330 // We only setDeallocationObservers on array buffers that are held by | 330 // We only setDeallocationObservers on array buffers that are held by |
331 // some object in the V8 heap, not in the ArrayBuffer constructor | 331 // some object in the V8 heap, not in the ArrayBuffer constructor |
332 // itself. This is because V8 GC only cares about memory it can free on | 332 // itself. This is because V8 GC only cares about memory it can free on |
333 // GC, and until the object is exposed to JavaScript, V8 GC doesn't | 333 // GC, and until the object is exposed to JavaScript, V8 GC doesn't |
334 // affect it. | 334 // affect it. |
335 for (unsigned i = 0, n = numberOfChannels(); i < n; ++i) { | 335 for (unsigned i = 0, n = numberOfChannels(); i < n; ++i) { |
336 getChannelData(i)->buffer()->setDeallocationObserver(DOMArrayBufferD
eallocationObserver::instance()); | 336 getChannelData(i)->buffer()->setDeallocationObserver(DOMArrayBufferD
eallocationObserver::instance()); |
337 } | 337 } |
338 } | 338 } |
339 return wrapper; | 339 return wrapper; |
340 } | 340 } |
341 | 341 |
342 } // namespace blink | 342 } // namespace blink |
343 | 343 |
344 #endif // ENABLE(WEB_AUDIO) | 344 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |