static v8::Handle<v8::Value> sourceBuffersAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { MediaSource* imp = V8MediaSource::toNative(info.Holder()); RefPtr<SourceBufferList> result = imp->sourceBuffers(); v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined(); if (wrapper.IsEmpty()) { wrapper = toV8(result.get(), info.Holder(), info.GetIsolate()); if (!wrapper.IsEmpty()) V8DOMWrapper::setNamedHiddenReference(info.Holder(), "sourceBuffers", wrapper); } return wrapper; }
void JSMediaSource::visitAdditionalChildren(SlotVisitor& visitor) { MediaSource* mediaSource = static_cast<MediaSource*>(&impl()); visitor.addOpaqueRoot(mediaSource); // -- end boiler plate code -- // Mark SourceBufferList SourceBufferList* sourceBufferList = mediaSource->sourceBuffers(); if (sourceBufferList) { visitor.addOpaqueRoot(sourceBufferList); // Mark SourceBuffer for (unsigned long i = 0, len = sourceBufferList->length(); i < len; i++) { SourceBuffer* sourceBuffer = sourceBufferList->item(i); if (sourceBuffer) visitor.addOpaqueRoot(sourceBuffer); } } }