am f613da0e: Merge "Simplify the consume before traversal heuristic." into jb-dev

* commit 'f613da0e5f79d261d99008d25665f5992af86c0b':
  Simplify the consume before traversal heuristic.
This commit is contained in:
Jeff Brown
2012-04-27 16:47:58 -07:00
committed by Android Git Automerger

View File

@@ -947,6 +947,7 @@ public final class ViewRootImpl implements ViewParent,
mTraversalBarrier = mHandler.getLooper().postSyncBarrier();
mChoreographer.postCallback(
Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
scheduleConsumeBatchedInput();
}
}
@@ -964,9 +965,6 @@ public final class ViewRootImpl implements ViewParent,
mTraversalScheduled = false;
mHandler.getLooper().removeSyncBarrier(mTraversalBarrier);
doConsumeBatchedInput(false);
doProcessInputEvents();
if (mProfile) {
Debug.startMethodTracing("ViewAncestor");
}
@@ -4206,20 +4204,13 @@ public final class ViewRootImpl implements ViewParent,
}
}
void doConsumeBatchedInput(boolean callback) {
void doConsumeBatchedInput() {
if (mConsumeBatchedInputScheduled) {
mConsumeBatchedInputScheduled = false;
if (!callback) {
mChoreographer.removeCallbacks(Choreographer.CALLBACK_INPUT,
mConsumedBatchedInputRunnable, null);
if (mInputEventReceiver != null) {
mInputEventReceiver.consumeBatchedInputEvents();
}
}
// Always consume batched input events even if not scheduled, because there
// might be new input there waiting for us that we have no noticed yet because
// the Looper has not had a chance to run again.
if (mInputEventReceiver != null) {
mInputEventReceiver.consumeBatchedInputEvents();
doProcessInputEvents();
}
}
@@ -4257,8 +4248,7 @@ public final class ViewRootImpl implements ViewParent,
final class ConsumeBatchedInputRunnable implements Runnable {
@Override
public void run() {
doConsumeBatchedInput(true);
doProcessInputEvents();
doConsumeBatchedInput();
}
}
final ConsumeBatchedInputRunnable mConsumedBatchedInputRunnable =