本文整理汇总了C++中PendingScript类的典型用法代码示例。如果您正苦于以下问题:C++ PendingScript类的具体用法?C++ PendingScript怎么用?C++ PendingScript使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PendingScript类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sourceFromPendingScript
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());
}
示例2: sourceFromPendingScript
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());
}
示例3: sourceFromPendingScript
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
示例4: ASSERT
void HTMLDocumentParser::watchForLoad(PendingScript& pendingScript)
{
ASSERT(!pendingScript.isLoaded());
// setClient would call notifyFinished if the load were complete.
// Callers do not expect to be re-entered from this call, so they should
// not an already-loaded PendingScript.
pendingScript.setClient(this);
}
示例5: isPendingScriptReady
bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script)
{
m_hasScriptsWaitingForResources = !m_document->haveStylesheetsAndImportsLoaded();
if (m_hasScriptsWaitingForResources)
return false;
if (script.resource() && !script.resource()->isLoaded())
return false;
return true;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:9,代码来源:HTMLScriptRunner.cpp
示例6: isPendingScriptReady
bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script)
{
m_hasScriptsWaitingForStylesheets = !m_document->haveStylesheetsLoaded();
if (m_hasScriptsWaitingForStylesheets)
return false;
if (script.cachedScript() && !script.cachedScript()->isLoaded())
return false;
return true;
}
示例7: requestDeferredScript
void HTMLScriptRunner::requestDeferredScript(Element* element)
{
PendingScript pendingScript;
if (!requestPendingScript(pendingScript, element))
return;
ASSERT(pendingScript.cachedScript());
m_scriptsToExecuteAfterParsing.append(pendingScript);
}
示例8: isPendingScriptReady
bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script)
{
m_hasScriptsWaitingForResources = !m_document->isScriptExecutionReady();
if (m_hasScriptsWaitingForResources)
return false;
if (script.resource() && !script.resource()->isLoaded())
return false;
return true;
}
示例9: executeScriptForScriptRunner
void ScriptElement::executeScriptForScriptRunner(PendingScript& pendingScript)
{
if (auto* loadableScript = pendingScript.loadableScript())
executeScriptAndDispatchEvent(*loadableScript);
else {
ASSERT(!pendingScript.wasErrored());
executeScript(ScriptSourceCode(scriptContent(), m_element.document().url(), pendingScript.startingPosition()));
dispatchLoadEvent();
}
}
示例10: sourceFromPendingScript
ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) const
{
if (script.cachedScript()) {
errorOccurred = script.cachedScript()->errorOccurred();
ASSERT(script.cachedScript()->isLoaded());
return ScriptSourceCode(script.cachedScript());
}
errorOccurred = false;
return ScriptSourceCode(script.element()->textContent(), documentURLForScriptExecution(m_document), script.startingPosition());
}
示例11: notifyFinished
void ScriptRunner::notifyFinished(PendingScript& pendingScript)
{
if (pendingScript.element().willExecuteInOrder())
ASSERT(!m_scriptsToExecuteInOrder.isEmpty());
else {
ASSERT(m_pendingAsyncScripts.contains(pendingScript));
m_scriptsToExecuteSoon.append(m_pendingAsyncScripts.take(pendingScript)->ptr());
}
pendingScript.clearClient();
m_timer.startOneShot(0);
}
示例12: stopWatchingForLoad
HTMLScriptRunner::~HTMLScriptRunner()
{
// FIXME: Should we be passed a "done loading/parsing" callback sooner than destruction?
if (m_parsingBlockingScript.cachedScript() && m_parsingBlockingScript.watchingForLoad())
stopWatchingForLoad(m_parsingBlockingScript);
while (!m_scriptsToExecuteAfterParsing.isEmpty()) {
PendingScript pendingScript = m_scriptsToExecuteAfterParsing.takeFirst();
if (pendingScript.cachedScript() && pendingScript.watchingForLoad())
stopWatchingForLoad(pendingScript);
}
}
示例13: requestPendingScript
bool HTMLScriptRunner::requestPendingScript(PendingScript& pendingScript, Element* script) const
{
ASSERT(!pendingScript.element());
pendingScript.setElement(script);
// This should correctly return 0 for empty or invalid srcValues.
CachedScript* cachedScript = toScriptElement(script)->cachedScript().get();
if (!cachedScript) {
notImplemented(); // Dispatch error event.
return false;
}
pendingScript.setCachedScript(cachedScript);
return true;
}
示例14: requestPendingScript
bool HTMLScriptRunner::requestPendingScript(PendingScript& pendingScript, Element* script) const
{
ASSERT(!pendingScript.element());
pendingScript.setElement(script);
// This should correctly return 0 for empty or invalid srcValues.
ScriptResource* resource = toScriptLoaderIfPossible(script)->resource().get();
if (!resource) {
notImplemented(); // Dispatch error event.
return false;
}
pendingScript.setScriptResource(resource);
return true;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:13,代码来源:HTMLScriptRunner.cpp
示例15: while
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;
}