void Headers::forEachInternal(PassOwnPtr<HeadersForEachCallback> callback, ScriptValue* thisArg)
{
    TrackExceptionState exceptionState;
    for (size_t i = 0; i < m_headerList->size(); ++i) {
        if (thisArg)
            callback->handleItem(*thisArg, m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
        else
            callback->handleItem(m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
        if (exceptionState.hadException())
            break;
    }
}
void HeaderMap::forEachInternal(PassOwnPtr<HeaderMapForEachCallback> callback, ScriptValue* thisArg)
{
    TrackExceptionState exceptionState;
    for (HashMap<String, String>::const_iterator it = m_headers.begin(); it != m_headers.end(); ++it) {
        if (thisArg)
            callback->handleItem(*thisArg, it->value, it->key, this);
        else
            callback->handleItem(it->value, it->key, this);
        if (exceptionState.hadException())
            break;
    }
}
Exemple #3
0
void FontFaceSet::forEachInternal(PassOwnPtr<FontFaceSetForEachCallback> callback, const ScriptValue* thisArg) const
{
    if (!inActiveDocumentContext())
        return;
    const ListHashSet<RefPtr<FontFace> >& cssConnectedFaces = cssConnectedFontFaceList();
    Vector<RefPtr<FontFace> > fontFaces;
    fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + m_nonCSSConnectedFaces.size());
    for (ListHashSet<RefPtr<FontFace> >::const_iterator it = cssConnectedFaces.begin(); it != cssConnectedFaces.end(); ++it)
        fontFaces.append(*it);
    for (ListHashSet<RefPtr<FontFace> >::const_iterator it = m_nonCSSConnectedFaces.begin(); it != m_nonCSSConnectedFaces.end(); ++it)
        fontFaces.append(*it);

    for (size_t i = 0; i < fontFaces.size(); ++i) {
        FontFace* face = fontFaces[i].get();
        if (thisArg)
            callback->handleItem(*thisArg, face, face, const_cast<FontFaceSet*>(this));
        else
            callback->handleItem(face, face, const_cast<FontFaceSet*>(this));
    }
}