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

Commit b5343728 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Android (Google) Code Review
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."
parents e8cf076a 95785e28
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -2991,7 +2991,7 @@ void InputDispatcher::enqueueDispatchEntriesLocked(nsecs_t currentTime,
        ATRACE_NAME(message.c_str());
    }

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

    // Enqueue dispatch entries for the requested modes.
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
@@ -3674,6 +3674,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) {
@@ -3708,8 +3710,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 nsecs_t downTime, const sp<Connection>& connection) {
@@ -3740,6 +3745,7 @@ 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: {
@@ -3766,8 +3772,11 @@ void InputDispatcher::synthesizePointerDownEventsForConnectionLocked(
                                   InputTarget::FLAG_DISPATCH_AS_IS);
    }

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

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