OSDN Git Service

InputDispatcher: Optimize count()
authorJon McCaffrey <jmccaffrey@nvidia.com>
Tue, 18 Nov 2014 20:07:08 +0000 (12:07 -0800)
committerJon McCaffrey <jmccaffrey@nvidia.com>
Wed, 26 Nov 2014 20:04:47 +0000 (12:04 -0800)
commit65dbe971b1bcefdaa353662f7bde5ea327544113
tree9dfb56f5800bf0dbb87919cd84fa2da6e7b75ef9
parentfecc0bf4f1d8d1939807123d0f01ca1fe377bda4
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
services/inputflinger/InputDispatcher.cpp
services/inputflinger/InputDispatcher.h