Beispiel #1
0
void HostRecord::removeLoader(SchedulableLoader* loader)
{
    ASSERT(isMainThread());

    // FIXME (NetworkProcess): Due to IPC race conditions, it's possible this HostRecord will be asked to remove the same loader twice.
    // It would be nice to know the loader has already been removed and treat it as a no-op.

    SchedulableLoaderSet::iterator i = m_loadersInProgress.find(loader);
    if (i != m_loadersInProgress.end()) {
        i->get()->setHostRecord(0);
        m_loadersInProgress.remove(i);
        return;
    }
    
    for (int priority = ResourceLoadPriorityHighest; priority >= ResourceLoadPriorityLowest; --priority) {  
        LoaderQueue::iterator end = m_loadersPending[priority].end();
        for (LoaderQueue::iterator it = m_loadersPending[priority].begin(); it != end; ++it) {
            if (it->get() == loader) {
                it->get()->setHostRecord(0);
                m_loadersPending[priority].remove(it);
                return;
            }
        }
    }
}
inline bool removeLoaderFromQueue(SchedulableLoader* loader, LoaderQueue& queue)
{
    LoaderQueue::iterator end = queue.end();
    for (LoaderQueue::iterator it = queue.begin(); it != end; ++it) {
        if (it->get() == loader) {
            loader->setHostRecord(0);
            queue.remove(it);
            return true;
        }
    }
    return false;
}