void WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, std::unique_ptr<CoreIPC::MessageEncoder>& replyEncoder) { // Force all timers to run at full speed when processing a synchronous message ActivityAssertion activityAssertion(PluginProcess::shared()); ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::shared(), connection); uint64_t destinationID = decoder.destinationID(); if (!destinationID) { didReceiveSyncWebProcessConnectionMessage(connection, decoder, replyEncoder); return; } if (decoder.messageReceiverName() == Messages::NPObjectMessageReceiver::messageReceiverName()) { m_npRemoteObjectMap->didReceiveSyncMessage(connection, decoder, replyEncoder); return; } PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(decoder.destinationID()); if (!pluginControllerProxy) return; PluginController::PluginDestructionProtector protector(pluginControllerProxy->asPluginController()); pluginControllerProxy->didReceiveSyncPluginControllerProxyMessage(connection, decoder, replyEncoder); }
void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete) { // Ensure we don't clamp any timers during destruction ActivityAssertion activityAssertion(PluginProcess::shared()); PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(pluginInstanceID); // If there is no PluginControllerProxy then this plug-in doesn't exist yet and we probably have nothing to do. if (!pluginControllerProxy) { // If the plugin we're supposed to destroy was requested asynchronously and doesn't exist yet, // we need to flag the instance ID so it is not created later. if (asynchronousCreationIncomplete) m_asynchronousInstanceIDsToIgnore.add(pluginInstanceID); return; } destroyPluginControllerProxy(pluginControllerProxy); }
void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, PassRefPtr<Messages::WebProcessConnection::DestroyPlugin::DelayedReply> reply) { // We return immediately from this synchronous IPC. We want to make sure the plugin destruction is just about to start so audio playback // will finish soon after returning. However we don't want to wait for destruction to complete fully as that may take a while. reply->send(); // Ensure we don't clamp any timers during destruction ActivityAssertion activityAssertion(PluginProcess::singleton().connectionActivity()); PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(pluginInstanceID); // If there is no PluginControllerProxy then this plug-in doesn't exist yet and we probably have nothing to do. if (!pluginControllerProxy) { // If the plugin we're supposed to destroy was requested asynchronously and doesn't exist yet, // we need to flag the instance ID so it is not created later. if (asynchronousCreationIncomplete) m_asynchronousInstanceIDsToIgnore.add(pluginInstanceID); return; } destroyPluginControllerProxy(pluginControllerProxy); }
void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> reply) { // Ensure we don't clamp any timers during initialization ActivityAssertion activityAssertion(PluginProcess::shared()); PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(creationParameters.pluginInstanceID); // The controller proxy for the plug-in we're being asked to create synchronously might already exist if it was requested asynchronously before. if (pluginControllerProxy) { // It might still be in the middle of initialization in which case we have to let that initialization complete and respond to this message later. if (pluginControllerProxy->isInitializing()) { pluginControllerProxy->setInitializationReply(reply); return; } // If its initialization is complete then we need to respond to this message with the correct information about its creation. #if PLATFORM(MAC) reply->send(true, pluginControllerProxy->wantsWheelEvents(), pluginControllerProxy->remoteLayerClientID()); #else reply->send(true, pluginControllerProxy->wantsWheelEvents(), 0); #endif return; } // The plugin we're supposed to create might have been requested asynchronously before. // In that case we need to create it synchronously now but flag the instance ID so we don't recreate it asynchronously later. if (creationParameters.asynchronousCreationIncomplete) m_asynchronousInstanceIDsToIgnore.add(creationParameters.pluginInstanceID); bool result = false; bool wantsWheelEvents = false; uint32_t remoteLayerClientID = 0; createPluginInternal(creationParameters, result, wantsWheelEvents, remoteLayerClientID); reply->send(result, wantsWheelEvents, remoteLayerClientID); }