JSNodeListCustom.cpp [plain text]
#include "config.h"
#include "JSNodeList.h"
#include "ChildNodeList.h"
#include "JSNode.h"
#include "LiveNodeList.h"
#include "Node.h"
#include "NodeList.h"
#include <wtf/text/AtomString.h>
namespace WebCore {
using namespace JSC;
bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
{
JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.slot()->asCell());
if (!jsNodeList->hasCustomProperties(jsNodeList->vm()))
return false;
if (jsNodeList->wrapped().isLiveNodeList()) {
if (UNLIKELY(reason))
*reason = "LiveNodeList owner is opaque root";
return visitor.containsOpaqueRoot(root(static_cast<LiveNodeList&>(jsNodeList->wrapped()).ownerNode()));
}
if (jsNodeList->wrapped().isChildNodeList()) {
if (UNLIKELY(reason))
*reason = "ChildNodeList owner is opaque root";
return visitor.containsOpaqueRoot(root(static_cast<ChildNodeList&>(jsNodeList->wrapped()).ownerNode()));
}
if (jsNodeList->wrapped().isEmptyNodeList()) {
if (UNLIKELY(reason))
*reason = "EmptyNodeList owner is opaque root";
return visitor.containsOpaqueRoot(root(static_cast<EmptyNodeList&>(jsNodeList->wrapped()).ownerNode()));
}
return false;
}
JSC::JSValue createWrapper(JSDOMGlobalObject& globalObject, Ref<NodeList>&& nodeList)
{
globalObject.vm().heap.deprecatedReportExtraMemory(nodeList->memoryCost());
return createWrapper<NodeList>(&globalObject, WTFMove(nodeList));
}
JSC::JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<NodeList>&& nodeList)
{
return createWrapper(*globalObject, WTFMove(nodeList));
}
}