void WebInspectorUI::establishConnection(IPC::Attachment encodedConnectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel) { #if USE(UNIX_DOMAIN_SOCKETS) IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.releaseFileDescriptor()); #elif OS(DARWIN) IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); #else notImplemented(); return; #endif if (IPC::Connection::identifierIsNull(connectionIdentifier)) return; m_inspectedPageIdentifier = inspectedPageIdentifier; m_frontendAPIDispatcher.reset(); m_underTest = underTest; m_inspectionLevel = inspectionLevel; m_frontendController = &m_page.corePage()->inspectorController(); m_frontendController->setInspectorFrontendClient(this); m_backendConnection = IPC::Connection::createClientConnection(connectionIdentifier, *this); m_backendConnection->open(); }
PluginProcessConnection* PluginProcessConnectionManager::getPluginProcessConnection(uint64_t pluginProcessToken) { for (size_t i = 0; i < m_pluginProcessConnections.size(); ++i) { if (m_pluginProcessConnections[i]->pluginProcessToken() == pluginProcessToken) return m_pluginProcessConnections[i].get(); } CoreIPC::Attachment encodedConnectionIdentifier; bool supportsAsynchronousInitialization; if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPluginProcessConnection(pluginProcessToken), Messages::WebProcessProxy::GetPluginProcessConnection::Reply(encodedConnectionIdentifier, supportsAsynchronousInitialization), 0)) return 0; #if PLATFORM(MAC) CoreIPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) return 0; #elif USE(UNIX_DOMAIN_SOCKETS) CoreIPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.fileDescriptor(); if (connectionIdentifier == -1) return 0; #endif RefPtr<PluginProcessConnection> pluginProcessConnection = PluginProcessConnection::create(this, pluginProcessToken, connectionIdentifier, supportsAsynchronousInitialization); m_pluginProcessConnections.append(pluginProcessConnection); { MutexLocker locker(m_tokensAndConnectionsMutex); ASSERT(!m_tokensAndConnections.contains(pluginProcessToken)); m_tokensAndConnections.set(pluginProcessToken, pluginProcessConnection->connection()); } return pluginProcessConnection.get(); }
void WebProcess::ensureNetworkProcessConnection() { if (!m_usesNetworkProcess) return; if (m_networkProcessConnection) return; IPC::Attachment encodedConnectionIdentifier; if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetNetworkProcessConnection(), Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0)) return; #if OS(DARWIN) IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); #elif USE(UNIX_DOMAIN_SOCKETS) IPC::Connection::Identifier connectionIdentifier = encodedConnectionIdentifier.releaseFileDescriptor(); #else ASSERT_NOT_REACHED(); #endif if (IPC::Connection::identifierIsNull(connectionIdentifier)) return; m_networkProcessConnection = NetworkProcessConnection::create(connectionIdentifier); }
void CompositingManager::establishConnection(WebPage& webPage, WTF::RunLoop& runLoop) { IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(); IPC::Connection::Identifier connectionIdentifier(socketPair.server); IPC::Attachment connectionClientPort(socketPair.client); m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this, runLoop); m_connection->open(); webPage.sendSync(Messages::CompositingManagerProxy::EstablishConnection(connectionClientPort), Messages::CompositingManagerProxy::EstablishConnection::Reply(), webPage.pageID()); }
// Called from WebInspectorClient void WebInspector::createInspectorPage(bool underTest) { #if OS(DARWIN) mach_port_t listeningPort; mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); IPC::Connection::Identifier connectionIdentifier(listeningPort); IPC::Attachment connectionClientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND); #elif USE(UNIX_DOMAIN_SOCKETS) IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(); IPC::Connection::Identifier connectionIdentifier(socketPair.server); IPC::Attachment connectionClientPort(socketPair.client); #else notImplemented(); return; #endif m_frontendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this); m_frontendConnection->open(); WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::CreateInspectorPage(connectionClientPort, canAttachWindow(), underTest), m_page->pageID()); }
void WebProcess::ensureNetworkProcessConnection() { if (!m_usesNetworkProcess) return; if (m_networkProcessConnection) return; CoreIPC::Attachment encodedConnectionIdentifier; if (!connection()->sendSync(Messages::WebProcessProxy::GetNetworkProcessConnection(), Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0)) return; #if PLATFORM(MAC) CoreIPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port()); if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) return; #else ASSERT_NOT_REACHED(); #endif m_networkProcessConnection = NetworkProcessConnection::create(connectionIdentifier); }
void CompositingManagerProxy::establishConnection(IPC::Attachment encodedConnectionIdentifier) { IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.releaseFileDescriptor()); m_connection = IPC::Connection::createClientConnection(connectionIdentifier, *this, RunLoop::main()); m_connection->open(); }