void NPRemoteObjectMap::pluginDestroyed(Plugin* plugin)
{
    Vector<NPObjectMessageReceiver*> messageReceivers;

    // Gather the receivers associated with this plug-in.
    for (HashMap<uint64_t, NPObjectMessageReceiver*>::const_iterator it = m_registeredNPObjects.begin(), end = m_registeredNPObjects.end(); it != end; ++it) {
        NPObjectMessageReceiver* npObjectMessageReceiver = it->second;
        if (npObjectMessageReceiver->plugin() == plugin)
            messageReceivers.append(npObjectMessageReceiver);
    }

    // Now delete all the receivers.
    deleteAllValues(messageReceivers);

    Vector<NPObjectProxy*> objectProxies;
    for (HashSet<NPObjectProxy*>::const_iterator it = m_npObjectProxies.begin(), end = m_npObjectProxies.end(); it != end; ++it) {
        NPObjectProxy* npObjectProxy = *it;

        if (npObjectProxy->plugin() == plugin)
            objectProxies.append(npObjectProxy);
    }

    // Invalidate and remove all proxies associated with this plug-in.
    for (size_t i = 0; i < objectProxies.size(); ++i) {
        NPObjectProxy* npObjectProxy = objectProxies[i];

        npObjectProxy->invalidate();

        ASSERT(m_npObjectProxies.contains(npObjectProxy));
        m_npObjectProxies.remove(npObjectProxy);
    }
}
예제 #2
0
static uint64_t remoteNPObjectID(Plugin* plugin, NPObject* npObject)
{
    if (!NPObjectProxy::isNPObjectProxy(npObject))
        return 0;

    NPObjectProxy* npObjectProxy = NPObjectProxy::toNPObjectProxy(npObject);
    if (npObjectProxy->plugin() != plugin)
        return 0;

    return npObjectProxy->npObjectID();
}