本文整理汇总了C++中PassOwnPtr::discoveryTime方法的典型用法代码示例。如果您正苦于以下问题:C++ PassOwnPtr::discoveryTime方法的具体用法?C++ PassOwnPtr::discoveryTime怎么用?C++ PassOwnPtr::discoveryTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PassOwnPtr
的用法示例。
在下文中一共展示了PassOwnPtr::discoveryTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preload
void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload, const NetworkHintsInterface& networkHintsInterface)
{
if (preload->isPreconnect()) {
preconnectHost(preload.get(), networkHintsInterface);
return;
}
// TODO(yoichio): Should preload if document is imported.
if (!m_document->loader())
return;
FetchRequest request = preload->resourceRequest(m_document);
// TODO(dgozman): This check should go to HTMLPreloadScanner, but this requires
// making Document::completeURLWithOverride logic to be statically accessible.
if (request.url().protocolIsData())
return;
if (preload->resourceType() == Resource::Script || preload->resourceType() == Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource)
request.setCharset(preload->charset().isEmpty() ? m_document->characterSet().string() : preload->charset());
request.setForPreload(true);
int duration = static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime()));
DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDelayHistogram, ("WebCore.PreloadDelayMs", 0, 2000, 20));
preloadDelayHistogram.count(duration);
m_document->loader()->startPreload(preload->resourceType(), request);
}
示例2: preload
void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload)
{
Document* executingDocument = m_document->import() ? m_document->import()->master() : m_document;
Document* loadingDocument = m_document;
ASSERT(executingDocument->frame());
ASSERT(executingDocument->renderer());
ASSERT(executingDocument->renderer()->style());
if (!preload->media().isEmpty() && !mediaAttributeMatches(executingDocument->frame(), executingDocument->renderer()->style(), preload->media()))
return;
FetchRequest request = preload->resourceRequest(m_document);
blink::Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20);
loadingDocument->fetcher()->preload(preload->resourceType(), request, preload->charset());
}
示例3: preload
void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload)
{
FetchRequest request = preload->resourceRequest(m_document);
blink::Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20);
m_document->fetcher()->preload(preload->resourceType(), request, preload->charset());
}