Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: Source/bindings/templates/interface.cpp

Issue 131183002: IDL compiler: AudioBuffer interfaces (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/unstable/v8_interface.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index b394870b26c6401a42ac99b0abae336e53b136ef..ddf81d898f6ada0b5a6aec9f1ea038357e87fea2 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -728,6 +728,16 @@ v8::Handle<v8::Object> {{v8_class}}::createWrapper(PassRefPtr<{{cpp_class}}> imp
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
+ {% if is_audio_buffer %}
+ {# We only setDeallocationObservers on array buffers that are held by some
+ object in the V8 heap, not in the ArrayBuffer constructor itself.
+ This is because V8 GC only cares about memory it can free on GC, and
+ until the object is exposed to JavaScript, V8 GC doesn't affect it. #}
+ for (unsigned i = 0, n = impl->numberOfChannels(); i < n; i++) {
+ Float32Array* channelData = impl->getChannelData(i);
+ channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate());
+ }
+ {% endif %}
installPerContextEnabledProperties(wrapper, impl.get(), isolate);
{% set wrapper_configuration = 'WrapperConfiguration::Dependent'
if (has_visit_dom_wrapper or
« no previous file with comments | « Source/bindings/scripts/unstable/v8_interface.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698