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


C++ JSGlobalObject::moduleLoader方法代码示例

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


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

示例1: loadModule

JSInternalPromise* loadModule(ExecState* exec, const SourceCode& source)
{
    JSLockHolder lock(exec);
    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    RELEASE_ASSERT(!exec->vm().isCollectorBusy());

    Symbol* key = createSymbolForEntryPointModule(exec->vm());

    JSGlobalObject* globalObject = exec->vmEntryGlobalObject();

    // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
    globalObject->moduleLoader()->provide(exec, key, ModuleLoaderObject::Status::Fetch, source.view().toString());
    if (exec->hadException())
        return rejectPromise(exec, globalObject);

    return loadModule(lock, exec, globalObject, key, jsUndefined());
}
开发者ID:EthanK28,项目名称:webkit,代码行数:17,代码来源:Completion.cpp

示例2: loadAndEvaluateModule

JSInternalPromise* loadAndEvaluateModule(ExecState* exec, const SourceCode& source, JSValue scriptFetcher)
{
    VM& vm = exec->vm();
    JSLockHolder lock(vm);
    auto scope = DECLARE_THROW_SCOPE(vm);
    RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
    RELEASE_ASSERT(!vm.isCollectorBusyOnCurrentThread());

    Symbol* key = createSymbolForEntryPointModule(vm);

    JSGlobalObject* globalObject = exec->vmEntryGlobalObject();

    // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
    globalObject->moduleLoader()->provide(exec, key, JSModuleLoader::Status::Fetch, source);
    RETURN_IF_EXCEPTION(scope, rejectPromise(exec, globalObject));

    return loadAndEvaluateModule(lock, exec, globalObject, key, jsUndefined(), scriptFetcher);
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3: evaluateModule

void evaluateModule(ExecState* exec, const SourceCode& source, NakedPtr<Exception>& returnedException)
{
    JSLockHolder lock(exec);
    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    RELEASE_ASSERT(!exec->vm().isCollectorBusy());

    CodeProfiling profile(source);

    JSGlobalObject* globalObject = exec->vmEntryGlobalObject();

    // Generate the unique key for the source-provided module.
    PrivateName privateName(PrivateName::Description, "EntryPointModule");
    Symbol* key = Symbol::create(exec->vm(), *privateName.uid());

    ModuleLoaderObject* moduleLoader = globalObject->moduleLoader();

    // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
    moduleLoader->provide(exec, key, ModuleLoaderObject::Status::Fetch, source.toString());
    if (exec->hadException()) {
        returnedException = exec->exception();
        exec->clearException();
        return;
    }

    // FIXME: Now, we don't implement the linking phase yet.
    // So here, we just call requestInstantiateAll to only perform the module loading.
    // At last, it should be replaced with requestReady.
    // https://bugs.webkit.org/show_bug.cgi?id=148172
    moduleLoader->requestInstantiateAll(exec, key);

    // FIXME: We should also handle the asynchronous Syntax Errors that will be delivered by the rejected promise.
    // https://bugs.webkit.org/show_bug.cgi?id=148173
    if (exec->hadException()) {
        returnedException = exec->exception();
        exec->clearException();
        return;
    }
}
开发者ID:rotime,项目名称:webkit,代码行数:38,代码来源:Completion.cpp

示例4: evaluateModule

JSInternalPromise* evaluateModule(ExecState* exec, const SourceCode& source)
{
    JSLockHolder lock(exec);
    RELEASE_ASSERT(exec->vm().atomicStringTable() == wtfThreadData().atomicStringTable());
    RELEASE_ASSERT(!exec->vm().isCollectorBusy());

    JSGlobalObject* globalObject = exec->vmEntryGlobalObject();

    // Generate the unique key for the source-provided module.
    PrivateName privateName(PrivateName::Description, "EntryPointModule");
    Symbol* key = Symbol::create(exec->vm(), *privateName.uid());

    // Insert the given source code to the ModuleLoader registry as the fetched registry entry.
    globalObject->moduleLoader()->provide(exec, key, ModuleLoaderObject::Status::Fetch, source.toString());
    if (exec->hadException()) {
        JSValue exception = exec->exception()->value();
        exec->clearException();
        JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
        deferred->reject(exec, exception);
        return deferred->promise();
    }

    return evaluateModule(lock, exec, globalObject, key, jsUndefined());
}
开发者ID:nickooms,项目名称:webkit,代码行数:24,代码来源:Completion.cpp


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