Exemplo n.º 1
0
void HostRecord::servePendingRequestsForQueue(LoaderQueue& queue, ResourceLoadPriority priority)
{
    while (!queue.isEmpty()) {
        RefPtr<SchedulableLoader> loader = queue.first();
        ASSERT(loader->hostRecord() == this);

        // This request might be from WebProcess we've lost our connection to.
        // If so we should just skip it.
        if (!loader->connectionToWebProcess()) {
            removeLoader(loader.get());
            continue;
        }

        // For named hosts - which are only http(s) hosts - we should always enforce the connection limit.
        // For non-named hosts - everything but http(s) - we should only enforce the limit if the document
        // isn't done parsing and we don't know all stylesheets yet.

        // FIXME (NetworkProcess): The above comment about document parsing and stylesheets is a holdover
        // from the WebCore::ResourceLoadScheduler.
        // The behavior described was at one time important for WebCore's single threadedness.
        // It's possible that we don't care about it with the NetworkProcess.
        // We should either decide it's not important and change the above comment, or decide it is
        // still important and somehow account for it.

        bool shouldLimitRequests = !name().isNull();
        if (shouldLimitRequests && limitsRequests(priority, loader->connectionToWebProcess()->isSerialLoadingEnabled()))
            return;

        m_loadersInProgress.add(loader);
        queue.removeFirst();

        loader->start();
    }
}
Exemplo n.º 2
0
void HostRecord::servePendingRequestsForQueue(LoaderQueue& queue, ResourceLoadPriority priority)
{
    // We only enforce the connection limit for http(s) hosts, which are the only ones with names.
    bool shouldLimitRequests = !name().isNull();

    // For non-named hosts - everything but http(s) - we should only enforce the limit if the document
    // isn't done parsing and we don't know all stylesheets yet.

    // FIXME (NetworkProcess): The above comment about document parsing and stylesheets is a holdover
    // from the WebCore::ResourceLoadScheduler.
    // The behavior described was at one time important for WebCore's single threadedness.
    // It's possible that we don't care about it with the NetworkProcess.
    // We should either decide it's not important and change the above comment, or decide it is
    // still important and somehow account for it.
    
    // Very low priority loaders are only handled when no other loaders are in progress.
    if (shouldLimitRequests && priority == ResourceLoadPriorityVeryLow && !m_loadersInProgress.isEmpty())
        return;
    
    while (!queue.isEmpty()) {
        RefPtr<NetworkResourceLoader> loader = queue.first();
        ASSERT(loader->hostRecord() == this);

        // This request might be from WebProcess we've lost our connection to.
        // If so we should just skip it.
        if (!loader->connectionToWebProcess()) {
            removeLoader(loader.get());
            continue;
        }

        if (shouldLimitRequests && limitsRequests(priority, loader.get()))
            return;

        m_loadersInProgress.add(loader);
        queue.removeFirst();

        LOG(NetworkScheduling, "(NetworkProcess) HostRecord::servePendingRequestsForQueue - Starting load of %s\n", loader->request().url().string().utf8().data());
        loader->start();
    }
}