From 9831d90db8fba7e967d22b1f86eea1d6ac831541 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 6 Feb 2012 15:55:26 -0800 Subject: [PATCH] Remove active connection tracking. The dispatcher no longer needs to track which connections are active except perhaps for diagnostic purposes, so we might as well remove this code. This is part of a series of changes to improve input system pipelining. Bug: 5963420 Change-Id: Ibadc830b7b792a59b9244d0a6e85f320c4947109 --- services/input/InputDispatcher.cpp | 38 ------------------------------ services/input/InputDispatcher.h | 6 ----- 2 files changed, 44 deletions(-) diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index 5811f2e42b6dd..85bfac4669577 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -1737,7 +1737,6 @@ void InputDispatcher::enqueueDispatchEntriesLocked(nsecs_t currentTime, // If the outbound queue was previously empty, start the dispatch cycle going. if (wasEmpty && !connection->outboundQueue.isEmpty()) { - activateConnectionLocked(connection.get()); startDispatchCycleLocked(currentTime, connection); } } @@ -1975,9 +1974,6 @@ void InputDispatcher::startNextDispatchCycleLocked(nsecs_t currentTime, return; } } - - // Outbound queue is empty, deactivate the connection. - deactivateConnectionLocked(connection.get()); } void InputDispatcher::abortBrokenDispatchCycleLocked(nsecs_t currentTime, @@ -2010,8 +2006,6 @@ void InputDispatcher::drainOutboundQueueLocked(Connection* connection) { } delete dispatchEntry; } - - deactivateConnectionLocked(connection); } int InputDispatcher::handleReceiveCallback(int fd, int events, void* data) { @@ -3045,20 +3039,6 @@ void InputDispatcher::dumpDispatchStateLocked(String8& dump) { dump.appendFormat(INDENT "InboundQueue: length=%u\n", mInboundQueue.count()); - if (!mActiveConnections.isEmpty()) { - dump.append(INDENT "ActiveConnections:\n"); - for (size_t i = 0; i < mActiveConnections.size(); i++) { - const Connection* connection = mActiveConnections[i]; - dump.appendFormat(INDENT2 "%d: '%s', status=%s, outboundQueueLength=%u, " - "inputState.isNeutral=%s\n", - i, connection->getInputChannelName(), connection->getStatusLabel(), - connection->outboundQueue.count(), - toString(connection->inputState.isNeutral())); - } - } else { - dump.append(INDENT "ActiveConnections: \n"); - } - if (isAppSwitchPendingLocked()) { dump.appendFormat(INDENT "AppSwitch: pending, due in %01.1fms\n", (mAppSwitchDueTime - now()) / 1000000.0); @@ -3167,24 +3147,6 @@ ssize_t InputDispatcher::getConnectionIndexLocked(const sp& inputC return -1; } -void InputDispatcher::activateConnectionLocked(Connection* connection) { - for (size_t i = 0; i < mActiveConnections.size(); i++) { - if (mActiveConnections.itemAt(i) == connection) { - return; - } - } - mActiveConnections.add(connection); -} - -void InputDispatcher::deactivateConnectionLocked(Connection* connection) { - for (size_t i = 0; i < mActiveConnections.size(); i++) { - if (mActiveConnections.itemAt(i) == connection) { - mActiveConnections.removeAt(i); - return; - } - } -} - void InputDispatcher::onDispatchCycleStartedLocked( nsecs_t currentTime, const sp& connection) { } diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h index 6d9dc4781a0b4..5b7f95e71d438 100644 --- a/services/input/InputDispatcher.h +++ b/services/input/InputDispatcher.h @@ -864,12 +864,6 @@ private: ssize_t getConnectionIndexLocked(const sp& inputChannel); - // Active connections are connections that have a non-empty outbound queue. - // We don't use a ref-counted pointer here because we explicitly abort connections - // during unregistration which causes the connection's outbound queue to be cleared - // and the connection itself to be deactivated. - Vector mActiveConnections; - // Input channels that will receive a copy of all input events. Vector > mMonitoringChannels;