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


C++ ExecutionContext::activeDOMObjectsAreSuspended方法代码示例

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


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

示例1: call

bool VoidCallbackFunctionInterfaceArg::call(ScriptWrappable* scriptWrappable, HTMLDivElement* divElement) {
  if (!m_scriptState->contextIsValid())
    return false;

  ExecutionContext* context = m_scriptState->getExecutionContext();
  DCHECK(context);
  if (context->activeDOMObjectsAreSuspended() || context->isContextDestroyed())
    return false;

  if (m_callback.isEmpty())
    return false;

  // TODO(bashi): Make sure that using DummyExceptionStateForTesting is OK.
  // crbug.com/653769
  DummyExceptionStateForTesting exceptionState;
  ScriptState::Scope scope(m_scriptState.get());

  v8::Local<v8::Value> divElementArgument = toV8(divElement, m_scriptState->context()->Global(), m_scriptState->isolate());

  v8::Local<v8::Value> thisValue = toV8(scriptWrappable, m_scriptState->context()->Global(), m_scriptState->isolate());

  v8::Local<v8::Value> argv[] = { divElementArgument };

  v8::Local<v8::Value> v8ReturnValue;
  v8::TryCatch exceptionCatcher(m_scriptState->isolate());
  exceptionCatcher.SetVerbose(true);

  if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), thisValue, 1, argv, m_scriptState->isolate()).ToLocal(&v8ReturnValue)) {
    return true;
  }
  return false;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例2: run

void SuspendableScriptExecutor::run()
{
    suspendIfNeeded();
    ExecutionContext* context = executionContext();
    ASSERT(context);
    if (context && !context->activeDOMObjectsAreSuspended())
        executeAndDestroySelf();
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:8,代码来源:SuspendableScriptExecutor.cpp

示例3: run

void SuspendableScriptExecutor::run()
{
    ExecutionContext* context = getExecutionContext();
    DCHECK(context);
    if (!context->activeDOMObjectsAreSuspended()) {
        suspendIfNeeded();
        executeAndDestroySelf();
        return;
    }
    startOneShot(0, BLINK_FROM_HERE);
    suspendIfNeeded();
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:12,代码来源:SuspendableScriptExecutor.cpp

示例4: deliverIntersectionObservations

void IntersectionObserverController::deliverIntersectionObservations() {
  ExecutionContext* context = getExecutionContext();
  if (!context) {
    m_pendingIntersectionObservers.clear();
    return;
  }
  if (context->activeDOMObjectsAreSuspended()) {
    m_callbackFiredWhileSuspended = true;
    return;
  }
  HeapHashSet<Member<IntersectionObserver>> observers;
  m_pendingIntersectionObservers.swap(observers);
  for (auto& observer : observers)
    observer->deliver();
}
开发者ID:mirror,项目名称:chromium,代码行数:15,代码来源:IntersectionObserverController.cpp

示例5: fired

void DOMTimer::fired()
{
    ExecutionContext* context = getExecutionContext();
    ASSERT(context);
    context->timers()->setTimerNestingLevel(m_nestingLevel);
    ASSERT(!context->activeDOMObjectsAreSuspended());
    // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
    UserGestureIndicator gestureIndicator(m_userGestureToken.release());

    TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID));
    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);

    // Simple case for non-one-shot timers.
    if (isActive()) {
        if (repeatInterval() && repeatInterval() < minimumInterval) {
            m_nestingLevel++;
            if (m_nestingLevel >= maxTimerNestingLevel)
                augmentRepeatInterval(minimumInterval - repeatInterval());
        }

        // No access to member variables after this point, it can delete the timer.
        m_action->execute(context);

        InspectorInstrumentation::didFireTimer(cookie);

        return;
    }

    RawPtr<DOMTimer> protect(this);

    // Unregister the timer from ExecutionContext before executing the action
    // for one-shot timers.
    RawPtr<ScheduledAction> action = m_action.release();
    context->timers()->removeTimeoutByID(m_timeoutID);

    action->execute(context);

    InspectorInstrumentation::didFireTimer(cookie);
    TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());

    // ExecutionContext might be already gone when we executed action->execute().
    if (getExecutionContext())
        getExecutionContext()->timers()->setTimerNestingLevel(0);
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:44,代码来源:DOMTimer.cpp

示例6: fired

void DOMTimer::fired()
{
    ExecutionContext* context = executionContext();
    timerNestingLevel = m_nestingLevel;
    ASSERT(!context->activeDOMObjectsAreSuspended());
    // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
    UserGestureIndicator gestureIndicator(m_userGestureToken.release());

    TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID));
    // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);

    // Simple case for non-one-shot timers.
    if (isActive()) {
        if (repeatInterval() && repeatInterval() < minimumInterval) {
            m_nestingLevel++;
            if (m_nestingLevel >= maxTimerNestingLevel)
                augmentRepeatInterval(minimumInterval - repeatInterval());
        }

        // No access to member variables after this point, it can delete the timer.
        m_action->execute(context);

        InspectorInstrumentation::didFireTimer(cookie);

        return;
    }

    // Delete timer before executing the action for one-shot timers.
    OwnPtr<ScheduledAction> action = m_action.release();

    // This timer is being deleted; no access to member variables allowed after this point.
    context->removeTimeoutByID(m_timeoutID);

    action->execute(context);

    InspectorInstrumentation::didFireTimer(cookie);
    TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", "data", InspectorUpdateCountersEvent::data());

    timerNestingLevel = 0;
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:41,代码来源:DOMTimer.cpp

示例7: fired

void DOMTimer::fired()
{
    ExecutionContext* context = executionContext();
    timerNestingLevel = m_nestingLevel;
    ASSERT(!context->activeDOMObjectsAreSuspended());
    // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
    UserGestureIndicator gestureIndicator(m_userGestureToken.release());

    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);

    // Simple case for non-one-shot timers.
    if (isActive()) {
        if (repeatInterval() && repeatInterval() < minimumInterval) {
            m_nestingLevel++;
            if (m_nestingLevel >= maxTimerNestingLevel)
                augmentRepeatInterval(minimumInterval - repeatInterval());
        }

        // No access to member variables after this point, it can delete the timer.
        m_action->execute(context);

        InspectorInstrumentation::didFireTimer(cookie);

        return;
    }

    // Delete timer before executing the action for one-shot timers.
    OwnPtr<ScheduledAction> action = m_action.release();

    // This timer is being deleted; no access to member variables allowed after this point.
    context->removeTimeoutByID(m_timeoutID);

    action->execute(context);

    InspectorInstrumentation::didFireTimer(cookie);

    timerNestingLevel = 0;
}
开发者ID:Igalia,项目名称:blink,代码行数:38,代码来源:DOMTimer.cpp

示例8: call

bool StringSequenceCallbackFunctionLongSequenceArg::call(ScriptState* scriptState, ScriptWrappable* scriptWrappable, const Vector<int>& arg, Vector<String>& returnValue)
{
    if (!scriptState->contextIsValid())
        return false;

    ExecutionContext* context = scriptState->getExecutionContext();
    DCHECK(context);
    if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreStopped())
        return false;

    if (m_callback.isEmpty())
        return false;

    // TODO(bashi): Make sure that using TrackExceptionState is OK.
    // crbug.com/653769
    TrackExceptionState exceptionState;
    ScriptState::Scope scope(scriptState);

    v8::Local<v8::Value> argArgument = toV8(arg, scriptState->context()->Global(), scriptState->isolate());

    v8::Local<v8::Value> thisValue = toV8(scriptWrappable, scriptState->context()->Global(), scriptState->isolate());

    v8::Local<v8::Value> argv[] = { argArgument };

    v8::Local<v8::Value> v8ReturnValue;
    v8::TryCatch exceptionCatcher(scriptState->isolate());
    exceptionCatcher.SetVerbose(true);

    if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate()), scriptState->getExecutionContext(), thisValue, 1, argv, scriptState->isolate()).ToLocal(&v8ReturnValue))
    {
        Vector<String> cppValue = toImplArray<Vector<String>>(v8ReturnValue, 0, scriptState->isolate(), exceptionState);
        if (exceptionState.hadException())
            return false;
        returnValue = cppValue;
        return true;
    }
    return false;
}
开发者ID:ollie314,项目名称:chromium,代码行数:38,代码来源:StringSequenceCallbackFunctionLongSequenceArg.cpp

示例9: canInvokeCallback

bool ActiveDOMCallback::canInvokeCallback() const
{
    ExecutionContext* context = executionContext();
    return context && !context->activeDOMObjectsAreSuspended() && !context->activeDOMObjectsAreStopped();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:5,代码来源:ActiveDOMCallback.cpp


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