本文整理汇总了C++中ThreadableLoaderOptions::isolatedCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadableLoaderOptions::isolatedCopy方法的具体用法?C++ ThreadableLoaderOptions::isolatedCopy怎么用?C++ ThreadableLoaderOptions::isolatedCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadableLoaderOptions
的用法示例。
在下文中一共展示了ThreadableLoaderOptions::isolatedCopy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: capturedOutgoingReferrer
WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode,
const ResourceRequest& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer,
const SecurityOrigin* securityOrigin, const ContentSecurityPolicy* contentSecurityPolicy)
: m_workerClientWrapper(workerClientWrapper)
, m_loaderProxy(loaderProxy)
, m_taskMode(taskMode.isolatedCopy())
{
ASSERT(m_workerClientWrapper.get());
auto* requestData = request.copyData().release();
auto* optionsCopy = options.isolatedCopy().release();
ASSERT(securityOrigin);
ASSERT(contentSecurityPolicy);
auto* contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin).release();
contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
StringCapture capturedOutgoingReferrer(outgoingReferrer);
m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, contentSecurityPolicyCopy, capturedOutgoingReferrer](ScriptExecutionContext& context) {
ASSERT(isMainThread());
Document& document = downcast<Document>(context);
auto request = ResourceRequest::adopt(std::unique_ptr<CrossThreadResourceRequestData>(requestData));
request->setHTTPReferrer(capturedOutgoingReferrer.string());
auto options = std::unique_ptr<ThreadableLoaderOptions>(optionsCopy);
// FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path
// will return a 0 value. Either this should return 0 or the other code path should do a callback with
// a failure.
m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options, std::unique_ptr<ContentSecurityPolicy>(contentSecurityPolicyCopy));
ASSERT(m_mainThreadLoader);
});
}