JSMainThreadExecStateInstrumentation.h [plain text]
#pragma once
#include "InspectorInstrumentation.h"
#include "JSMainThreadExecState.h"
#include <runtime/FunctionExecutable.h>
namespace WebCore {
template<typename Type, Type jsType, class DataType>
inline InspectorInstrumentationCookie JSMainThreadExecState::instrumentFunctionInternal(ScriptExecutionContext* context, Type callType, const DataType& callData)
{
if (!InspectorInstrumentation::timelineAgentEnabled(context))
return InspectorInstrumentationCookie();
String resourceName;
int lineNumber = 1;
if (callType == jsType) {
resourceName = callData.js.functionExecutable->sourceURL();
lineNumber = callData.js.functionExecutable->firstLine();
} else
resourceName = "undefined";
return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
}
inline InspectorInstrumentationCookie JSMainThreadExecState::instrumentFunctionCall(ScriptExecutionContext* context, JSC::CallType type, const JSC::CallData& data)
{
return instrumentFunctionInternal<JSC::CallType, JSC::CallType::JS, JSC::CallData>(context, type, data);
}
inline InspectorInstrumentationCookie JSMainThreadExecState::instrumentFunctionConstruct(ScriptExecutionContext* context, JSC::ConstructType type, const JSC::ConstructData& data)
{
return instrumentFunctionInternal<JSC::ConstructType, JSC::ConstructType::JS, JSC::ConstructData>(context, type, data);
}
}