void DisplayRefreshMonitorManager::windowScreenDidChange(PlatformDisplayID displayID, DisplayRefreshMonitorClient& client)
{
    if (client.hasDisplayID() && client.displayID() == displayID)
        return;
    
    unregisterClient(client);
    client.setDisplayID(displayID);
    registerClient(client);
    if (client.isScheduled())
        scheduleAnimation(client);
}
Beispiel #2
0
bool EntriesManager::removeClient(RequestContext::ClientId clientId) {
    auto clientIt = m_clients.find(clientId);
    if (clientIt == m_clients.end()) {
        LOGD("Requested client [" << clientId << "] not found");
        return false;
    }

    unregisterClient(clientId);
    removeEntryCount(clientIt->second.from, clientIt->second.clientId);
    m_clients.erase(clientId);
    cleanup();
    return true;
}
Beispiel #3
0
std::vector<MonitorEntry> EntriesManager::fetchEntriesForClient(RequestContext::ClientId clientId,
                                                                bool force) {
    auto regClientIt = m_registeredClients.find(clientId);
    if (regClientIt == m_registeredClients.end()) {
        LOGW("Client <" << clientId << "> not registered");
        return {};
    }
    auto clientIt = regClientIt->second;
    auto &clientInfo = clientIt->second;
    if (!force && !isClientFilled(clientInfo)) {
        LOGW("Not enough entries for client " << clientId);
        return {};
    }

    int entriesToFetch = std::min(m_container.sizeFrom(clientInfo.from), clientInfo.bufferSize);
    std::vector<MonitorEntry> entries;
    auto nextNotFetchedEntry = m_container.fetch(clientInfo.from, entriesToFetch, entries);

    updateClient(clientIt, nextNotFetchedEntry);
    //When entries are fetched for client, client is removed from waiting queue
    unregisterClient(clientId);
    cleanup();
    return entries;
}
Beispiel #4
0
void Lobby::leave(Client* client)
{
    GameRoom * gr = m_clientRoomMap.find(client)->second;
//    gr->removePlayer(client);
    unregisterClient(client);
}
Beispiel #5
0
IOReturn AppleGPIO::callPlatformFunction(const OSSymbol *functionName,
                                         bool waitForFunction,
                                         void *param1, void *param2,
                                         void *param3, void *param4 )
{
	DLOG("AppleGPIO::callPlatformFunction %s %s %08lx %08lx %08lx %08lx\n",
			functionName->getCStringNoCopy(), waitForFunction ? "TRUE" : "FALSE",
			(UInt32)param1, (UInt32)param2, (UInt32)param3, (UInt32)param4);

	if (fPlatformFuncArray)
	{
		UInt32 i;
		IOPlatformFunction *pfFunc;
		
		UInt32 count = fPlatformFuncArray->getCount();
		for (i = 0; i < count; i++)
		{
			if (pfFunc = OSDynamicCast(IOPlatformFunction, fPlatformFuncArray->getObject(i)))
			{
				DLOG ("AppleGPIO::callPlatformFunction '%s' - got platformFunction object\n",
						functionName->getCStringNoCopy());

				// If param4 is an OSSymbol reference, check for interrupt event registration
				// or enable/disable symbols
				if (pfFunc->platformFunctionMatch(functionName, kIOPFFlagIntGen, NULL))
				{
					OSSymbol *subFunctionSym;
					
					DLOG ("AppleGPIO::callPlatformFunction '%s' - got platformFunction interrupt match\n",
							functionName->getCStringNoCopy());

					if (param4 && (subFunctionSym = OSDynamicCast(OSSymbol, (const OSMetaClassBase *)param4)))
					{
						DLOG ("AppleGPIO::callPlatformFunction '%s', subFunction '%s'\n",
								functionName->getCStringNoCopy(), subFunctionSym->getCStringNoCopy());

						if (subFunctionSym == fSymIntRegister)
							return (registerClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
						if (subFunctionSym == fSymIntUnRegister)
							return (unregisterClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
						if (subFunctionSym == fSymIntEnable)
							return (enableClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
						if (subFunctionSym == fSymIntDisable)
							return (disableClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
						return kIOReturnBadArgument;			// Unknown function
					}
					else
					{
						DLOG ("AppleGPIO::callPlatformFunction '%s', param4 not a OSSymbol\n",
								functionName->getCStringNoCopy());
					}
				}

				// Check for on-demand case
				if (pfFunc->platformFunctionMatch (functionName, kIOPFFlagOnDemand, NULL))
				{
					DLOG ("AppleGPIO::callPlatformFunction '%s', calling demand function\n",
							functionName->getCStringNoCopy());

					return (performFunction (pfFunc, param1, param2, param3, param4) ? kIOReturnSuccess : kIOReturnBadArgument);
				}

				DLOG ("AppleGPIO::callPlatformFunction '%s' - got no match\n", functionName->getCStringNoCopy());
			}
		}

#ifdef OLD_STYLE_COMPAT

		// Need to catch old-style register-, unregister-, enable-, disable- commands

		DLOG ("AppleGPIO::callPlatformFunction '%s' - handling old style\n", functionName->getCStringNoCopy());

		// Is it an interrupt notification registration request?
		if (fRegisterStrings &&
		    fRegisterStrings->containsObject(functionName))
		{
			return (registerClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
		}
		// unregister?
		else if (fUnregisterStrings && 
		         fUnregisterStrings->containsObject(functionName))
		{
			return (unregisterClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
		}
		else if (fEnableStrings &&
		         fEnableStrings->containsObject(functionName))
		{
			return (enableClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
		}
		else if (fDisableStrings &&
		         fDisableStrings->containsObject(functionName))
		{
			return (disableClient(param1, param2, param3) ? kIOReturnSuccess : kIOReturnBadArgument);
		}

#endif

	}

	DLOG("AppleGPIO::callPlatformFunction unrecognized function\n");

	return super::callPlatformFunction(functionName, waitForFunction, param1, param2,
			param3, param4);

}