本文整理汇总了C++中v8::Handle::GetScriptLineNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::GetScriptLineNumber方法的具体用法?C++ Handle::GetScriptLineNumber怎么用?C++ Handle::GetScriptLineNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类v8::Handle
的用法示例。
在下文中一共展示了Handle::GetScriptLineNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resourceInfo
static inline void resourceInfo(const v8::Handle<v8::Function> function, String& resourceName, int& lineNumber)
{
v8::ScriptOrigin origin = function->GetScriptOrigin();
if (origin.ResourceName().IsEmpty()) {
resourceName = "undefined";
lineNumber = 1;
} else {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
}
示例2: resourceName
v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
/// M: add for systrace
TRACE_METHOD()
V8GCController::checkMemoryUsage();
v8::Local<v8::Value> result;
{
if (m_recursion >= kMaxRecursionDepth) {
v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')");
if (code.IsEmpty())
return result;
v8::Local<v8::Script> script = v8::Script::Compile(code);
if (script.IsEmpty())
return result;
script->Run();
return result;
}
// Evaluating the JavaScript could cause the frame to be deallocated,
// so we start the keep alive timer here.
// Frame::keepAlive method adds the ref count of the frame and sets a
// timer to decrease the ref count. It assumes that the current JavaScript
// execution finishs before firing the timer.
m_frame->keepAlive();
InspectorInstrumentationCookie cookie;
if (InspectorInstrumentation::hasFrontends()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
String resourceName("undefined");
int lineNumber = 1;
if (!origin.ResourceName().IsEmpty()) {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
}
m_recursion++;
result = function->Call(receiver, argc, args);
m_recursion--;
InspectorInstrumentation::didCallFunction(cookie);
}
// Release the storage mutex if applicable.
didLeaveScriptContext();
if (v8::V8::IsDead())
handleFatalErrorInV8();
return result;
}
示例3: resourceInfo
static bool resourceInfo(const v8::Handle<v8::Function> function, String& resourceName, int& lineNumber)
{
v8::ScriptOrigin origin = function->GetScriptOrigin();
if (origin.ResourceName().IsEmpty()) {
resourceName = "undefined";
lineNumber = 1;
} else {
V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringResourceName, origin.ResourceName(), false);
resourceName = stringResourceName;
lineNumber = function->GetScriptLineNumber() + 1;
}
return true;
}
示例4: handleMaxRecursionDepthExceeded
v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Frame* frame, v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
V8GCController::checkMemoryUsage();
if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth)
return handleMaxRecursionDepthExceeded();
ScriptExecutionContext* context = frame ? frame->document() : 0;
InspectorInstrumentationCookie cookie;
if (InspectorInstrumentation::hasFrontends() && context) {
String resourceName("undefined");
int lineNumber = 1;
v8::ScriptOrigin origin = function->GetScriptOrigin();
if (!origin.ResourceName().IsEmpty()) {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
}
v8::Local<v8::Value> result;
{
#if PLATFORM(CHROMIUM)
TRACE_EVENT0("v8", "v8.callFunction");
#endif
V8RecursionScope recursionScope(context);
result = function->Call(receiver, argc, args);
}
InspectorInstrumentation::didCallFunction(cookie);
if (v8::V8::IsDead())
handleFatalErrorInV8();
return result;
}
示例5: resourceName
v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
V8GCController::checkMemoryUsage();
v8::Local<v8::Value> result;
{
V8ConsoleMessage::Scope scope;
if (m_recursion >= kMaxRecursionDepth) {
v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')");
if (code.IsEmpty())
return result;
v8::Local<v8::Script> script = v8::Script::Compile(code);
if (script.IsEmpty())
return result;
script->Run();
return result;
}
// Evaluating the JavaScript could cause the frame to be deallocated,
// so we start the keep alive timer here.
// Frame::keepAlive method adds the ref count of the frame and sets a
// timer to decrease the ref count. It assumes that the current JavaScript
// execution finishs before firing the timer.
m_frame->keepAlive();
#if ENABLE(INSPECTOR)
Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0;
if (inspectedPage) {
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
String resourceName("undefined");
int lineNumber = 1;
if (!origin.ResourceName().IsEmpty()) {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
timelineAgent->willCallFunction(resourceName, lineNumber);
} else
inspectedPage = 0;
}
#endif // !ENABLE(INSPECTOR)
m_recursion++;
result = function->Call(receiver, argc, args);
m_recursion--;
#if ENABLE(INSPECTOR)
if (inspectedPage)
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent())
timelineAgent->didCallFunction();
#endif // !ENABLE(INSPECTOR)
}
// Release the storage mutex if applicable.
didLeaveScriptContext();
if (v8::V8::IsDead())
handleFatalErrorInV8();
return result;
}