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


C++ PendingScript::releaseElementAndClear方法代码示例

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


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

示例1: executePendingScriptAndDispatchEvent

void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript)
{
    bool errorOccurred = false;
    ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOccurred);

    // Stop watching loads before executeScript to prevent recursion if the script reloads itself.
    if (pendingScript.cachedScript() && pendingScript.watchingForLoad())
        stopWatchingForLoad(pendingScript);

    if (!isExecutingScript()) {
#if ENABLE(CUSTOM_ELEMENTS)
        CustomElementRegistry::deliverAllLifecycleCallbacks();
#endif
        MutationObserver::deliverAllMutations();
    }

    // Clear the pending script before possible rentrancy from executeScript()
    RefPtr<Element> element = pendingScript.releaseElementAndClear();
    if (ScriptElement* scriptElement = toScriptElement(element.get())) {
        NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
        IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_document);
        if (errorOccurred)
            scriptElement->dispatchErrorEvent();
        else {
            ASSERT(isExecutingScript());
            scriptElement->executeScript(sourceCode);
            element->dispatchEvent(createScriptLoadEvent());
        }
    }
    ASSERT(!isExecutingScript());
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例2: executePendingScriptAndDispatchEvent

void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript)
{
    bool errorOccurred = false;
    ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOccurred);

    // Stop watching loads before executeScript to prevent recursion if the script reloads itself.
    if (pendingScript.resource() && pendingScript.watchingForLoad())
        stopWatchingForLoad(pendingScript);

    if (!isExecutingScript())
        Microtask::performCheckpoint();

    // Clear the pending script before possible rentrancy from executeScript()
    RefPtr<Element> element = pendingScript.releaseElementAndClear();
    if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) {
        NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
        IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_document);
        if (errorOccurred)
            scriptLoader->dispatchErrorEvent();
        else {
            ASSERT(isExecutingScript());
            scriptLoader->executeScript(sourceCode);
            element->dispatchEvent(createScriptLoadEvent());
        }
    }
    ASSERT(!isExecutingScript());
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:27,代码来源:HTMLScriptRunner.cpp

示例3: executePendingScriptAndDispatchEvent

void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript)
{
    bool errorOccurred = false;
    ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOccurred);

    // Stop watching loads before executeScript to prevent recursion if the script reloads itself.
    if (pendingScript.cachedScript() && pendingScript.watchingForLoad())
        stopWatchingForLoad(pendingScript);

    // WebERA: Insert HB relation between the execution of a pending script and the load of the script
    if (HBIsCurrentEventActionValid() && pendingScript.cachedScript() && pendingScript.cachedScript()->isLoaded() && pendingScript.cachedScript()->getLoadingEventAction() != 0) {
        HBAddExplicitArc(pendingScript.cachedScript()->getLoadingEventAction(), HBCurrentEventAction());
    }

    // Clear the pending script before possible rentrancy from executeScript()
    RefPtr<Element> element = pendingScript.releaseElementAndClear();
    if (ScriptElement* scriptElement = toScriptElement(element.get())) {
        NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
        IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_document);
        if (errorOccurred)
            scriptElement->dispatchErrorEvent();
        else {
            ASSERT(isExecutingScript());
            scriptElement->executeScript(sourceCode);
            element->dispatchEvent(createScriptLoadEvent());
        }
    }
    ASSERT(!m_scriptNestingLevel);
}
开发者ID:christofferqa,项目名称:R4,代码行数:29,代码来源:HTMLScriptRunner.cpp

示例4: executePendingScriptAndDispatchEvent

void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript, PendingScriptType pendingScriptType)
{
    bool errorOccurred = false;
    ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOccurred);

    // Stop watching loads before executeScript to prevent recursion if the script reloads itself.
    if (pendingScript.resource() && pendingScript.watchingForLoad())
        stopWatchingForLoad(pendingScript);

    if (!isExecutingScript()) {
        Microtask::performCheckpoint();
        if (pendingScriptType == PendingScriptBlockingParser) {
            m_hasScriptsWaitingForResources = !m_document->isScriptExecutionReady();
            // The parser cannot be unblocked as a microtask requested another resource
            if (m_hasScriptsWaitingForResources)
                return;
        }
    }

    // Clear the pending script before possible rentrancy from executeScript()
    RefPtr<Element> element = pendingScript.releaseElementAndClear();
    if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) {
        NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
        IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_document);
        if (errorOccurred)
            scriptLoader->dispatchErrorEvent();
        else {
            ASSERT(isExecutingScript());
            scriptLoader->executeScript(sourceCode);
            element->dispatchEvent(createScriptLoadEvent());
        }
    }
    ASSERT(!isExecutingScript());
}
开发者ID:dp7,项目名称:blink-crosswalk,代码行数:34,代码来源:HTMLScriptRunner.cpp

示例5: detach

void HTMLScriptRunner::detach()
{
    if (!m_document)
        return;

    m_parserBlockingScript->stopWatchingForLoad();
    m_parserBlockingScript->releaseElementAndClear();

    while (!m_scriptsToExecuteAfterParsing.isEmpty()) {
        PendingScript* pendingScript = m_scriptsToExecuteAfterParsing.takeFirst();
        pendingScript->stopWatchingForLoad();
        pendingScript->releaseElementAndClear();
    }
    m_document = nullptr;
}
开发者ID:,项目名称:,代码行数:15,代码来源:


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