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


C++ canInvokeCallback函数代码示例

本文整理汇总了C++中canInvokeCallback函数的典型用法代码示例。如果您正苦于以下问题:C++ canInvokeCallback函数的具体用法?C++ canInvokeCallback怎么用?C++ canInvokeCallback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: handleScope

void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg)
{
    if (!canInvokeCallback())
        return;

    v8::HandleScope handleScope(m_isolate);

    v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.get());
    if (v8Context.IsEmpty())
        return;

    v8::Context::Scope scope(v8Context);
    v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyArg, v8::Handle<v8::Object>(), m_isolate);
    if (testInterfaceEmptyArgHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return;
    }
    v8::Handle<v8::Value> stringArgHandle = v8String(m_isolate, stringArg);
    if (stringArgHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return;
    }
    v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle, stringArgHandle };

    invokeCallback(m_callback.newLocal(m_isolate), 2, argv, executionContext(), m_isolate);
}
开发者ID:junmin-zhu,项目名称:blink,代码行数:28,代码来源:V8TestCallbackInterface.cpp

示例2: handleEvent

bool JSMutationCallback::handleEvent(MutationRecordArray* mutations, WebKitMutationObserver* observer)
{
    if (!canInvokeCallback())
        return true;

    RefPtr<JSMutationCallback> protect(this);

    JSLock lock(SilenceAssertionsOnly);

    ExecState* exec = m_data->globalObject()->globalExec();

    MarkedArgumentBuffer mutationList;
    for (size_t i = 0; i < mutations->size(); ++i)
        mutationList.append(toJS(exec, m_data->globalObject(), mutations->at(i).get()));

    JSValue jsObserver = toJS(exec, m_data->globalObject(), observer);

    MarkedArgumentBuffer args;
    args.append(constructArray(exec, m_data->globalObject(), mutationList));
    args.append(jsObserver);

    bool raisedException = false;
    m_data->invokeCallback(jsObserver, args, &raisedException);
    return !raisedException;
}
开发者ID:Moondee,项目名称:Artemis,代码行数:25,代码来源:JSMutationCallbackCustom.cpp

示例3: handleScope

void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
{
    if (!canInvokeCallback())
        return;

    v8::Isolate* isolate = toIsolate(scriptExecutionContext());
    v8::HandleScope handleScope(isolate);
    v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_world.get());
    if (context.IsEmpty())
        return;

    v8::Context::Scope scope(context);

    v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).As<v8::Object>();
    ASSERT(!receiver.IsEmpty());

    v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(isolate);
    if (callback.IsEmpty())
        return;

    v8::Handle<v8::Value> argv[] = {
        v8String(name, isolate),
        oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handle<v8::Value>(v8String(oldValue, isolate)),
        newValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handle<v8::Value>(v8String(newValue, isolate))
    };

    v8::TryCatch exceptionCatcher;
    exceptionCatcher.SetVerbose(true);
    ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(), callback, receiver, WTF_ARRAY_LENGTH(argv), argv, isolate);
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:30,代码来源:V8CustomElementLifecycleCallbacks.cpp

示例4: invokeCallback

bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
{
    if (!canInvokeCallback())
        return true;

    v8::HandleScope handleScope;

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> transactionHandle = toV8(transaction);
    v8::Handle<v8::Value> errorHandle = toV8(error);
    if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) {
        CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        transactionHandle,
        errorHandle
    };

    bool callbackReturnValue = false;
    // Step 6: If the error callback returns false, then move on to the next
    // statement, if any, or onto the next overall step otherwise. Otherwise,
    // the error callback did not return false, or there was no error callback.
    // Jump to the last step in the overall steps.
    return invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue;
}
开发者ID:1833183060,项目名称:wke,代码行数:32,代码来源:V8CustomSQLStatementErrorCallback.cpp

示例5: scope

bool V8RTCErrorCallback::handleEvent(const String& errorInformation)
{
    if (!canInvokeCallback())
        return true;

    v8::HandleScope handleScope;

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> errorInformationHandle = deprecatedV8String(errorInformation);
    if (errorInformationHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        errorInformationHandle
    };

    bool callbackReturnValue = false;
    return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:27,代码来源:V8RTCErrorCallback.cpp

示例6: scope

bool V8PositionErrorCallback::handleEvent(PositionError* error)
{
    if (!canInvokeCallback())
        return true;

    v8::HandleScope handleScope;

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> errorHandle = toV8(error);
    if (errorHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        errorHandle
    };

    bool callbackReturnValue = false;
    return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scriptExecutionContext());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:27,代码来源:V8PositionErrorCallback.cpp

示例7: scope

void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfaceEmpty* testInterfaceEmptyArg, const String& stringArg)
{
    if (!canInvokeCallback())
        return;

    v8::Isolate* isolate = m_scriptState->isolate();
    if (m_scriptState->contextIsEmpty())
        return;

    ScriptState::Scope scope(m_scriptState.get());
    v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyArg, v8::Handle<v8::Object>(), isolate);
    if (testInterfaceEmptyArgHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return;
    }
    v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg);
    if (stringArgHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return;
    }
    v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle, stringArgHandle };

    invokeCallback(m_callback.newLocal(isolate), 2, argv, executionContext(), isolate);
}
开发者ID:coinpayee,项目名称:blink,代码行数:26,代码来源:V8TestCallbackInterface.cpp

示例8: handleScope

bool V8TestCallback::callbackWithThisArg(ScriptValue thisValue, int arg)
{
    if (!canInvokeCallback())
        return true;

    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    v8::HandleScope handleScope(isolate);

    v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.get());
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);
    v8::Handle<v8::Value> thisHandle = thisValue.v8Value();
    if (thisHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }
    ASSERT(thisHandle->IsObject());
    v8::Handle<v8::Value> argHandle = v8::Integer::New(arg, isolate);
    if (argHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }
    v8::Handle<v8::Value> argv[] = { argHandle };

    bool callbackReturnValue = false;
    return !invokeCallback(m_callback.newLocal(isolate), v8::Handle<v8::Object>::Cast(thisHandle), 1, argv, callbackReturnValue, executionContext(), isolate);
}
开发者ID:cvsuser-chromium,项目名称:third_party_WebKit,代码行数:31,代码来源:V8TestCallback.cpp

示例9: handleScope

bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
{
    if (!canInvokeCallback())
        return true;

    v8::Isolate* isolate = v8::Isolate::GetCurrent();
    v8::HandleScope handleScope(isolate);

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_world.get());
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> transactionHandle = toV8(transaction, v8::Handle<v8::Object>(), v8Context->GetIsolate());
    v8::Handle<v8::Value> errorHandle = toV8(error, v8::Handle<v8::Object>(), isolate);
    if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        transactionHandle,
        errorHandle
    };

    bool callbackReturnValue = false;
    // Step 6: If the error callback returns false, then move on to the next
    // statement, if any, or onto the next overall step otherwise. Otherwise,
    // the error callback did not return false, or there was no error callback.
    // Jump to the last step in the overall steps.
    return invokeCallback(m_callback.newLocal(isolate), 2, argv, callbackReturnValue, scriptExecutionContext(), isolate) || callbackReturnValue;
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:34,代码来源:V8CustomSQLStatementErrorCallback.cpp

示例10: scope

bool V8SQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLResultSet* resultSet)
{
    if (!canInvokeCallback())
        return true;

    v8::HandleScope handleScope;

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> transactionHandle = toV8(transaction);
    if (transactionHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }
    v8::Handle<v8::Value> resultSetHandle = toV8(resultSet);
    if (resultSetHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        transactionHandle,
        resultSetHandle
    };

    bool callbackReturnValue = false;
    return !invokeCallback(m_callback.get(), 2, argv, callbackReturnValue, scriptExecutionContext());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:34,代码来源:V8SQLStatementCallback.cpp

示例11: handleScope

void V8MutationCallback::call(const Vector<RefPtr<MutationRecord> >& mutations, MutationObserver* observer)
{
    if (!canInvokeCallback())
        return;

    v8::HandleScope handleScope(m_isolate);

    v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.get());
    if (v8Context.IsEmpty())
        return;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Function> callback = m_callback.newLocal(m_isolate);
    if (callback.IsEmpty())
        return;

    v8::Handle<v8::Value> observerHandle = toV8(observer, v8::Handle<v8::Object>(), m_isolate);
    if (observerHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return;
    }

    if (!observerHandle->IsObject())
        return;

    v8::Handle<v8::Object> thisObject = v8::Handle<v8::Object>::Cast(observerHandle);
    v8::Handle<v8::Value> argv[] = { v8Array(mutations, m_isolate), observerHandle };

    v8::TryCatch exceptionCatcher;
    exceptionCatcher.SetVerbose(true);
    ScriptController::callFunction(executionContext(), callback, thisObject, 2, argv, m_isolate);
}
开发者ID:Mihiri,项目名称:blink,代码行数:34,代码来源:V8MutationCallback.cpp

示例12: scope

void V8MutationCallback::call(const WillBeHeapVector<RefPtrWillBeMember<MutationRecord> >& mutations, MutationObserver* observer)
{
    if (!canInvokeCallback())
        return;

    v8::Isolate* isolate = m_scriptState->isolate();

    if (m_scriptState->contextIsValid())
        return;
    ScriptState::Scope scope(m_scriptState.get());

    if (m_callback.isEmpty())
        return;
    v8::Handle<v8::Value> observerHandle = toV8(observer, m_scriptState->context()->Global(), isolate);
    if (observerHandle.IsEmpty()) {
        if (!isScriptControllerTerminating())
            CRASH();
        return;
    }

    if (!observerHandle->IsObject())
        return;

    v8::Handle<v8::Object> thisObject = v8::Handle<v8::Object>::Cast(observerHandle);
    v8::Handle<v8::Value> argv[] = { v8Array(mutations, m_scriptState->context()->Global(), isolate), observerHandle };

    v8::TryCatch exceptionCatcher;
    exceptionCatcher.SetVerbose(true);
    ScriptController::callFunction(executionContext(), m_callback.newLocal(isolate), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:30,代码来源:V8MutationCallback.cpp

示例13: scope

bool V8MetadataCallback::handleEvent(Metadata* metadata)
{
    if (!canInvokeCallback())
        return true;

    v8::HandleScope handleScope;

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> metadataHandle = toV8(metadata);
    if (metadataHandle.IsEmpty()) {
        CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        metadataHandle
    };

    bool callbackReturnValue = false;
    return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:26,代码来源:V8MetadataCallback.cpp

示例14: scope

bool V8SQLTransactionSyncCallback::handleEvent(SQLTransactionSync* transaction)
{
    if (!canInvokeCallback())
        return true;

    v8::HandleScope handleScope;

    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
    if (v8Context.IsEmpty())
        return true;

    v8::Context::Scope scope(v8Context);

    v8::Handle<v8::Value> transactionHandle = toV8(transaction);
    if (transactionHandle.IsEmpty()) {
        CRASH();
        return true;
    }

    v8::Handle<v8::Value> argv[] = {
        transactionHandle
    };

    bool callbackReturnValue = false;
    return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:26,代码来源:V8SQLTransactionSyncCallback.cpp

示例15: run

Microtask::Result ActiveDOMCallbackMicrotask::run()
{
    if (!canInvokeCallback())
        return Result::KeepInQueue;

    m_task();
    return Result::Done;
}
开发者ID:edcwconan,项目名称:webkit,代码行数:8,代码来源:ActiveDOMCallbackMicrotask.cpp


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