diff options
Diffstat (limited to 'Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp')
-rw-r--r-- | Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp b/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp index 1605ab3e3..a297e8df2 100644 --- a/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp +++ b/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -28,7 +28,10 @@ #if ENABLE(VIDEO_TRACK) #include "JSTextTrackCue.h" + +#include "JSDataCue.h" #include "JSTrackCustom.h" +#include "JSVTTCue.h" #include "TextTrack.h" using namespace JSC; @@ -37,18 +40,14 @@ namespace WebCore { bool JSTextTrackCueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) { - JSTextTrackCue* jsTextTrackCue = jsCast<JSTextTrackCue*>(handle.get().asCell()); - TextTrackCue& textTrackCue = jsTextTrackCue->impl(); + JSTextTrackCue* jsTextTrackCue = jsCast<JSTextTrackCue*>(handle.slot()->asCell()); + TextTrackCue& textTrackCue = jsTextTrackCue->wrapped(); // If the cue is firing event listeners, its wrapper is reachable because // the wrapper is responsible for marking those event listeners. if (textTrackCue.isFiringEventListeners()) return true; - // If the cue has no event listeners and has no custom properties, it is not reachable. - if (!textTrackCue.hasEventListeners() && !jsTextTrackCue->hasCustomProperties()) - return false; - // If the cue is not associated with a track, it is not reachable. if (!textTrackCue.track()) return false; @@ -56,20 +55,29 @@ bool JSTextTrackCueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> h return visitor.containsOpaqueRoot(root(textTrackCue.track())); } -void JSTextTrackCue::visitChildren(JSCell* cell, SlotVisitor& visitor) +JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<TextTrackCue>&& cue) +{ + switch (cue->cueType()) { + case TextTrackCue::Data: + return createWrapper<DataCue>(globalObject, WTFMove(cue)); + case TextTrackCue::WebVTT: + case TextTrackCue::Generic: + return createWrapper<VTTCue>(globalObject, WTFMove(cue)); + default: + ASSERT_NOT_REACHED(); + return jsNull(); + } +} + +JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, TextTrackCue& cue) +{ + return wrap(state, globalObject, cue); +} + +void JSTextTrackCue::visitAdditionalChildren(SlotVisitor& visitor) { - JSTextTrackCue* jsTextTrackCue = jsCast<JSTextTrackCue*>(cell); - ASSERT_GC_OBJECT_INHERITS(jsTextTrackCue, info()); - COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); - ASSERT(jsTextTrackCue->structure()->typeInfo().overridesVisitChildren()); - Base::visitChildren(jsTextTrackCue, visitor); - - // Mark the cue's track root if it has one. - TextTrackCue& textTrackCue = jsTextTrackCue->impl(); - if (TextTrack* textTrack = textTrackCue.track()) + if (TextTrack* textTrack = wrapped().track()) visitor.addOpaqueRoot(root(textTrack)); - - textTrackCue.visitJSEventListeners(visitor); } } // namespace WebCore |