Exemplo n.º 1
0
JSC::VM& ScriptExecutionContext::vm()
{
    if (is<Document>(*this))
        return commonVM();

    return downcast<WorkerGlobalScope>(*this).script()->vm();
}
Exemplo n.º 2
0
void SVGImage::reportApproximateMemoryCost() const
{
    Document* document = m_page->mainFrame().document();
    size_t decodedImageMemoryCost = 0;

    for (Node* node = document; node; node = NodeTraversal::next(*node))
        decodedImageMemoryCost += node->approximateMemoryCost();

    JSC::VM& vm = commonVM();
    JSC::JSLockHolder lock(vm);
    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
    // https://bugs.webkit.org/show_bug.cgi?id=142595
    vm.heap.deprecatedReportExtraMemory(decodedImageMemoryCost + data()->size());
}