本文整理汇总了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());
}
示例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);
}
示例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());
}
示例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;
}