InspectorInstrumentationObject.cpp [plain text]
#include "config.h"
#include "InspectorInstrumentationObject.h"
#include "JSCInlines.h"
#include "Lookup.h"
#include <wtf/DataLog.h>
namespace JSC {
EncodedJSValue JSC_HOST_CALL inspectorInstrumentationObjectLog(ExecState*);
}
#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));
}
EncodedJSValue JSC_HOST_CALL inspectorInstrumentationObjectLog(ExecState* exec)
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSValue target = exec->argument(0);
String value = target.toWTFString(exec);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
dataLog(value, "\n");
return JSValue::encode(jsUndefined());
}
}