summaryrefslogtreecommitdiffstats
path: root/services/inputflinger/InputDispatcher.cpp
diff options
context:
space:
mode:
authorJon McCaffrey <jmccaffrey@nvidia.com>2014-11-18 12:07:08 -0800
committerJon McCaffrey <jmccaffrey@nvidia.com>2014-11-26 12:04:47 -0800
commit65dbe971b1bcefdaa353662f7bde5ea327544113 (patch)
tree9dfb56f5800bf0dbb87919cd84fa2da6e7b75ef9 /services/inputflinger/InputDispatcher.cpp
parentfecc0bf4f1d8d1939807123d0f01ca1fe377bda4 (diff)
downloadframeworks_native-65dbe971b1bcefdaa353662f7bde5ea327544113.zip
frameworks_native-65dbe971b1bcefdaa353662f7bde5ea327544113.tar.gz
frameworks_native-65dbe971b1bcefdaa353662f7bde5ea327544113.tar.bz2
InputDispatcher: Optimize count()
Count items as they are added and removed rather than iterating over the entire list to count them. Increases performance slightly, particularly when tracing is turned on, which causes count to be queried more often, and when the number of items in the queues grow large. This can happen due to applications not responding, for example. Change-Id: I0f11f7edd46089612af910cdfabfeb3ee685d7d9
Diffstat (limited to 'services/inputflinger/InputDispatcher.cpp')
-rw-r--r--services/inputflinger/InputDispatcher.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index 02fb6f0..1a6ff33 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -3814,18 +3814,6 @@ void InputDispatcher::monitor() {
}
-// --- InputDispatcher::Queue ---
-
-template <typename T>
-uint32_t InputDispatcher::Queue<T>::count() const {
- uint32_t result = 0;
- for (const T* entry = head; entry; entry = entry->next) {
- result += 1;
- }
- return result;
-}
-
-
// --- InputDispatcher::InjectionState ---
InputDispatcher::InjectionState::InjectionState(int32_t injectorPid, int32_t injectorUid) :