InspectorInstrumentationObject.cpp [plain text]
#include "config.h"
#include "InspectorInstrumentationObject.h"
#include "JSCInlines.h"
#include <wtf/DataLog.h>
namespace JSC {
static JSC_DECLARE_HOST_FUNCTION(inspectorInstrumentationObjectLog);
}
#include "InspectorInstrumentationObject.lut.h"
namespace JSC {
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(InspectorInstrumentationObject);
const ClassInfo InspectorInstrumentationObject::s_info = { "InspectorInstrumentation", &Base::s_info, &inspectorInstrumentationObjectTable, nullptr, CREATE_METHOD_TABLE(InspectorInstrumentationObject) };
InspectorInstrumentationObject::InspectorInstrumentationObject(VM& vm, Structure* structure)
: JSNonFinalObject(vm, structure)
{
}
void InspectorInstrumentationObject::finishCreation(VM& vm, JSGlobalObject*)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
putDirectWithoutTransition(vm, vm.propertyNames->isEnabled, jsBoolean(false));
}
bool InspectorInstrumentationObject::isEnabled(VM& vm) const
{
return getDirect(vm, vm.propertyNames->isEnabled).asBoolean();
}
void InspectorInstrumentationObject::enable(VM& vm)
{
putDirect(vm, vm.propertyNames->isEnabled, jsBoolean(true));
}
void InspectorInstrumentationObject::disable(VM& vm)
{
putDirect(vm, vm.propertyNames->isEnabled, jsBoolean(false));
}
JSC_DEFINE_HOST_FUNCTION(inspectorInstrumentationObjectLog, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSValue target = callFrame->argument(0);
String value = target.toWTFString(globalObject);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
dataLog(value, "\n");
return JSValue::encode(jsUndefined());
}
}