Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c309352 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Automerger Merge Worker
Browse files

Merge "[Optimization] It's no need to start the dispatch cycle going if the...

Merge "[Optimization] It's no need to start the dispatch cycle going if the outbound queue was not previously empty." am: f1500007 am: 3b30998c

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2206958



Change-Id: I01288b887fa5c3756ca96ef0b61c4a4dd4af0c48
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents e92a7d42 3b30998c
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -3640,6 +3640,8 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked(
    target.inputChannel = connection->inputChannel;
    target.flags = InputTarget::FLAG_DISPATCH_AS_IS;

    const bool wasEmpty = connection->outboundQueue.empty();

    for (size_t i = 0; i < cancelationEvents.size(); i++) {
        std::unique_ptr<EventEntry> cancelationEventEntry = std::move(cancelationEvents[i]);
        switch (cancelationEventEntry->type) {
@@ -3674,8 +3676,11 @@ void InputDispatcher::synthesizeCancelationEventsForConnectionLocked(
                                   InputTarget::FLAG_DISPATCH_AS_IS);
    }

    // If the outbound queue was previously empty, start the dispatch cycle going.
    if (wasEmpty && !connection->outboundQueue.empty()) {
        startDispatchCycleLocked(currentTime, connection);
    }
}

void InputDispatcher::synthesizePointerDownEventsForConnectionLocked(
        const sp<Connection>& connection) {
@@ -3708,6 +3713,8 @@ void InputDispatcher::synthesizePointerDownEventsForConnectionLocked(
    target.inputChannel = connection->inputChannel;
    target.flags = InputTarget::FLAG_DISPATCH_AS_IS;

    const bool wasEmpty = connection->outboundQueue.empty();

    for (std::unique_ptr<EventEntry>& downEventEntry : downEvents) {
        switch (downEventEntry->type) {
            case EventEntry::Type::MOTION: {
@@ -3733,9 +3740,11 @@ void InputDispatcher::synthesizePointerDownEventsForConnectionLocked(
        enqueueDispatchEntryLocked(connection, std::move(downEventEntry), target,
                                   InputTarget::FLAG_DISPATCH_AS_IS);
    }

    // If the outbound queue was previously empty, start the dispatch cycle going.
    if (wasEmpty && !connection->outboundQueue.empty()) {
        startDispatchCycleLocked(currentTime, connection);
    }
}

std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent(
        const MotionEntry& originalMotionEntry, BitSet32 pointerIds) {