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); } }
void NPRemoteObjectMap::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, OwnPtr<CoreIPC::ArgumentEncoder>& reply) { NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(arguments->destinationID()); if (!messageReceiver) return; messageReceiver->didReceiveSyncNPObjectMessageReceiverMessage(connection, messageID, arguments, reply); }
CoreIPC::SyncReplyMode NPRemoteObjectMap::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) { NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(arguments->destinationID()); if (!messageReceiver) return CoreIPC::AutomaticReply; return messageReceiver->didReceiveSyncNPObjectMessageReceiverMessage(connection, messageID, arguments, reply); }
void NPRemoteObjectMap::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, std::unique_ptr<CoreIPC::MessageEncoder>& replyEncoder) { NPObjectMessageReceiver* messageReceiver = m_registeredNPObjects.get(decoder.destinationID()); if (!messageReceiver) return; messageReceiver->didReceiveSyncNPObjectMessageReceiverMessage(connection, decoder, replyEncoder); }
NPVariant NPRemoteObjectMap::npVariantDataToNPVariant(const NPVariantData& npVariantData, Plugin* plugin) { NPVariant npVariant; switch (npVariantData.type()) { case NPVariantData::Void: VOID_TO_NPVARIANT(npVariant); break; case NPVariantData::Null: NULL_TO_NPVARIANT(npVariant); break; case NPVariantData::Bool: BOOLEAN_TO_NPVARIANT(npVariantData.boolValue(), npVariant); break; case NPVariantData::Int32: INT32_TO_NPVARIANT(npVariantData.int32Value(), npVariant); break; case NPVariantData::Double: DOUBLE_TO_NPVARIANT(npVariantData.doubleValue(), npVariant); break; case NPVariantData::String: { NPString npString = createNPString(npVariantData.stringValue()); STRINGN_TO_NPVARIANT(npString.UTF8Characters, npString.UTF8Length, npVariant); break; } case NPVariantData::LocalNPObjectID: { uint64_t npObjectID = npVariantData.localNPObjectIDValue(); ASSERT(npObjectID); NPObjectMessageReceiver* npObjectMessageReceiver = m_registeredNPObjects.get(npObjectID); if (!npObjectMessageReceiver) { ASSERT_NOT_REACHED(); VOID_TO_NPVARIANT(npVariant); break; } NPObject* npObject = npObjectMessageReceiver->npObject(); ASSERT(npObject); retainNPObject(npObject); OBJECT_TO_NPVARIANT(npObject, npVariant); break; } case NPVariantData::RemoteNPObjectID: { NPObject* npObjectProxy = createNPObjectProxy(npVariantData.remoteNPObjectIDValue(), plugin); OBJECT_TO_NPVARIANT(npObjectProxy, npVariant); break; } } return npVariant; }