当前位置: 首页>>代码示例>>C++>>正文


C++ Handle::Call方法代码示例

本文整理汇总了C++中v8::Handle::Call方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::Call方法的具体用法?C++ Handle::Call怎么用?C++ Handle::Call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在v8::Handle的用法示例。


在下文中一共展示了Handle::Call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
        int lineNumber;
        resourceInfo(function, resourceName, lineNumber);
        cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
    }

    v8::Local<v8::Value> result;
    {
#if PLATFORM(CHROMIUM)
        TRACE_EVENT1("v8", "v8.callFunction", "callsite", resourceString(function).utf8());
#endif
        V8RecursionScope recursionScope(context);
        result = function->Call(receiver, argc, args);
    }

    InspectorInstrumentation::didCallFunction(cookie);

    if (v8::V8::IsDead())
        handleFatalErrorInV8();

    return result;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: handleMaxRecursionDepthExceeded

v8::Local<v8::Value> ScriptController::callFunctionWithInstrumentation(ScriptExecutionContext* context, 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();

    InspectorInstrumentationCookie cookie;
    if (InspectorInstrumentation::timelineAgentEnabled(context)) {
        String resourceName;
        int lineNumber;
        resourceInfo(function, resourceName, lineNumber);
        cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
    }

    v8::Local<v8::Value> result;
    {
        TRACE_EVENT1("v8", "v8.callFunction", "callsite", resourceString(function).utf8());
        V8RecursionScope recursionScope(context);
        result = function->Call(receiver, argc, args);
    }

    InspectorInstrumentation::didCallFunction(cookie);
    crashIfV8IsDead();
    return result;
}
开发者ID:mychangle123,项目名称:Chromium-WebCL,代码行数:26,代码来源:ScriptController.cpp

示例3:

v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
#ifdef ANDROID_INSTRUMENT
    android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter);
#endif

    // For now, we don't put any artificial limitations on the depth
    // of recursion that stems from calling functions. This is in
    // contrast to the script evaluations.
    v8::Local<v8::Value> result;
    {
        V8ConsoleMessage::Scope scope;

        // 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();

        result = function->Call(receiver, argc, args);
    }

    if (v8::V8::IsDead())
        handleFatalErrorInV8();

#ifdef ANDROID_INSTRUMENT
    android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__);
#endif
    return result;
}
开发者ID:boyliang,项目名称:ComponentSuperAccessor,代码行数:31,代码来源:V8Proxy.cpp

示例4: call_js_function

    inline void call_js_function(
        v8::Handle<v8::Function> const& function,
        v8::Handle<v8::Object> const& self)
    {
        v8::Handle<v8::Value> args[] = {};

        function->Call(self, 0, args);
    }
开发者ID:diosmosis,项目名称:node-bind,代码行数:8,代码来源:call_js_function.hpp

示例5:

void QV8Include::callback(QV8Engine *engine, v8::Handle<v8::Function> callback, v8::Handle<v8::Object> status)
{
    if (!callback.IsEmpty()) {
        v8::Handle<v8::Value> args[] = { status };
        v8::TryCatch tc;
        callback->Call(engine->global(), 1, args);
    }
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:8,代码来源:qv8include.cpp

示例6: recursionScope

v8::Local<v8::Value> V8ScriptRunner::callInternalFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> args[], v8::Isolate* isolate)
{
    TRACE_EVENT0("v8", "v8.callFunction");
    TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution");
    V8RecursionScope::MicrotaskSuppression recursionScope(isolate);
    v8::Local<v8::Value> result = function->Call(receiver, argc, args);
    crashIfV8IsDead();
    return result;
}
开发者ID:coinpayee,项目名称:blink,代码行数:9,代码来源:V8ScriptRunner.cpp

示例7:

v8::Handle<v8::Value> ScriptEnv::CallScriptFunc(v8::Handle<v8::Function> handle, const int argc, v8::Handle<v8::Value>* argv)
{
    v8::HandleScope current_scope;
    v8::Context::Scope context_scope(mContext);
    
    v8::Handle<v8::Value> val = handle->Call(mContext->Global(), argc, argv);
    
    return current_scope.Close(val);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例8: js_fork

void js_fork( v8::Handle<v8::Function> f )
{
    pid_t p = ::fork();
    if( p ) return;
    else
    {
        f->Call( f, 0, NULL );
        exit(0);
    }
}
开发者ID:ColdenCullen,项目名称:V8-Convert,代码行数:10,代码来源:demo.cpp

示例9:

v8::Local<v8::Value> V8Proxy::callFunctionWithoutFrame(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
{
    V8GCController::checkMemoryUsage();
    v8::Local<v8::Value> result = function->Call(receiver, argc, args);

    if (v8::V8::IsDead())
        handleFatalErrorInV8();

    return result;
}
开发者ID:besk,项目名称:MT6589_kernel_source,代码行数:10,代码来源:V8Proxy.cpp

示例10: ExecuteVoid

void TNodeJsUtil::ExecuteVoid(const v8::Handle<v8::Function>& Fun) {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);

	v8::TryCatch TryCatch;
	Fun->Call(Isolate->GetCurrentContext()->Global(), 0, nullptr);
	if (TryCatch.HasCaught()) {
		v8::String::Utf8Value Msg(TryCatch.Message()->Get());
		throw TExcept::New("Exception while executin JSON: " + TStr(*Msg));
	}
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:11,代码来源:nodeutil.cpp

示例11: 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;
}
开发者ID:besk,项目名称:MT6589_kernel_source,代码行数:52,代码来源:V8Proxy.cpp

示例12: scope

v8::Handle<v8::Value> call_v8(v8::Isolate* isolate, v8::Handle<v8::Function> func,
	v8::Handle<v8::Value> recv, Args... args)
{
	v8::EscapableHandleScope scope(isolate);

	int const arg_count = sizeof...(Args);
	// +1 to allocate array for arg_count == 0
	v8::Handle<v8::Value> v8_args[arg_count + 1] = { to_v8(isolate, args)... };

	v8::Local<v8::Value> result = func->Call(recv, arg_count, v8_args);

	return scope.Escape(result);
}
开发者ID:Botyto,项目名称:Core,代码行数:13,代码来源:call_v8.hpp

示例13: ExecuteJson

PJsonVal TNodeJsUtil::ExecuteJson(const v8::Handle<v8::Function>& Fun,
		const v8::Local<v8::Object>& Arg1, const v8::Local<v8::Object>& Arg2) {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);
	v8::TryCatch TryCatch;
	const int ArgC = 2;
	v8::Handle<v8::Value> ArgV[ArgC] = { Arg1, Arg2 };
	v8::Handle<v8::Value> RetVal = Fun->Call(Isolate->GetCurrentContext()->Global(), 2, ArgV);
	if (TryCatch.HasCaught()) {
		v8::String::Utf8Value Msg(TryCatch.Message()->Get());
		throw TExcept::New("Exception while executin JSON: " + TStr(*Msg));
	}
	return GetObjJson(RetVal);
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:14,代码来源:nodeutil.cpp

示例14: ExecuteFlt

double TNodeJsUtil::ExecuteFlt(const v8::Handle<v8::Function>& Fun, const v8::Local<v8::Object>& Arg) {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);

	v8::Handle<v8::Value> Argv[1] = { Arg };
	v8::TryCatch TryCatch;
	v8::Handle<v8::Value> RetVal = Fun->Call(Isolate->GetCurrentContext()->Global(), 1, Argv);
	if (TryCatch.HasCaught()) {
		TryCatch.ReThrow();
		return 0;
	}
	EAssertR(RetVal->IsNumber(), "Return type expected to be number");

	return RetVal->NumberValue();
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:15,代码来源:nodeutil.cpp

示例15: handleMaxRecursionDepthExceeded

v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> function, ExecutionContext* context, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> args[], v8::Isolate* isolate)
{
    TRACE_EVENT0("v8", "v8.callFunction");
    TRACE_EVENT_SCOPED_SAMPLING_STATE("V8", "V8Execution");

    if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth)
        return handleMaxRecursionDepthExceeded(isolate);

    RELEASE_ASSERT(!context->isIteratingOverObservers());

    V8RecursionScope recursionScope(isolate, context);
    v8::Local<v8::Value> result = function->Call(receiver, argc, args);
    crashIfV8IsDead();
    return result;
}
开发者ID:coinpayee,项目名称:blink,代码行数:15,代码来源:V8ScriptRunner.cpp


注:本文中的v8::Handle::Call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。