void MessageQueue::handleAllMessages(MessageHandler& handler) { for(int i = 0; i < queue.numberOfMessages; ++i) { queue.setSelectedMessageForReading(i); in.config.reset(); in.text.reset(); handler.handleMessage(in); } }
/** * This method handles messages sent from the WebView. * @param webView The WebView that sent the message. * @param urlData Data object that holds message content. * Note that the data object will be valid only during * the life-time of the call of this method, then it * will be deallocated. */ void handleWebViewMessage(WebView* webView, MAHandle urlData) { // Create message object. This parses the message. WebViewMessage message(webView, urlData); // Let the message handler handle the message. mMessageHandler.handleMessage(message); // Tell the WebView that we have processed the message, so that // it can send the next one. callJS("bridge.messagehandler.processedMessage()"); }
void MessageRouter::handleMessages( Adapter& adapter) { bool handledMessage = false; // Get the first available message. const Message* message = adapter.getMessage(); if (message) { Logger::logDebug("MessageRouter::handleMessages: Got message " + toString(message->getMessageId()) + ".\n"); } while (message) { MessageHandler* handler = getHandler(message->getDestination()); if (!handler) { Logger::logDebug("Failed to handle message " + toString(message->getMessageId()) + ". No handler specified for destination \"" + message->getDestination() + "\"\n"); } else { // Allow the handler to handle the message. handledMessage = handler->handleMessage(*message); if (!handledMessage) { Logger::logDebug("Component \"" + handler->getId() + "\" failed to handle message " + toString(message->getMessageId()) + ". Unsupported message.\n"); } } // Free up the memory from the handled message. delete message; // Get the next available message. message = adapter.getMessage(); if (message) { Logger::logDebug("MessageRouter::handleMessages: Got message " + toString(message->getMessageId()) + ".\n"); } } }