示例#1
0
void LinkImport::process()
{
    if (m_child)
        return;
    if (!m_owner)
        return;
    if (!shouldLoadResource())
        return;

    if (!m_owner->document().import()) {
        ASSERT(m_owner->document().frame()); // The document should be the master.
        HTMLImportsController::provideTo(m_owner->document());
    }

    LinkRequestBuilder builder(m_owner);
    if (!builder.isValid()) {
        didFinish();
        return;
    }

    HTMLImport* parent = m_owner->document().import();
    HTMLImportsController* controller = parent->controller();
    m_child = controller->load(parent, this, builder.build(true));
    if (!m_child) {
        didFinish();
        return;
    }
}
void LinkImport::process()
{
    if (m_loader)
        return;
    if (!m_owner)
        return;
    if (!m_owner->document()->frame() && !m_owner->document()->import())
        return;

    if (!m_owner->document()->import()) {
        ASSERT(m_owner->document()->frame()); // The document should be the master.
        HTMLImportsController::provideTo(m_owner->document());
    }

    LinkRequestBuilder builder(m_owner);
    if (!builder.isValid()) {
        didFinish();
        return;
    }

    HTMLImport* parent = m_owner->document()->import();
    HTMLImportsController* controller = parent->controller();
    m_loader = controller->createLoader(parent, builder.build(true));
    if (!m_loader) {
        didFinish();
        return;
    }

    m_loader->addClient(this);
}