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

Commit 8e985f5a authored by Mark Fasheh's avatar Mark Fasheh
Browse files

Remove flag message_queue_tail_tracking

Bug: 409611618
Test: atest MessageQueueTest
Flag: EXEMPT Removing flag message_queue_tail_tracking
Change-Id: I3aeff11ad72bdf13a0143ae6f583f677651046f6
parent 20e71a79
Loading
Loading
Loading
Loading
+11 −43
Original line number Diff line number Diff line
@@ -1176,7 +1176,7 @@ public final class MessageQueue {
            msg.arg1 = token;
            incAndTraceMessageCount(msg, when);

            if (Flags.messageQueueTailTracking() && mLast != null && mLast.when <= when) {
            if (mLast != null && mLast.when <= when) {
                /* Message goes to tail of list */
                mLast.next = msg;
                mLast = msg;
@@ -1359,7 +1359,6 @@ public final class MessageQueue {
                // For readability, we split this portion of the function into two blocks based on
                // whether tail tracking is enabled. This has a minor implication for the case
                // where tail tracking is disabled. See the comment below.
                if (Flags.messageQueueTailTracking()) {
                if (when >= mLast.when) {
                    needWake = needWake && mAsyncMessageCount == 0;
                    msg.next = null;
@@ -1385,37 +1384,6 @@ public final class MessageQueue {
                    msg.next = p; // invariant: p == prev.next
                    prev.next = msg;
                }
                } else {
                    Message prev;
                    for (;;) {
                        prev = p;
                        p = p.next;
                        if (p == null || when < p.when) {
                            break;
                        }
                        if (needWake && p.isAsynchronous()) {
                            needWake = false;
                        }
                    }
                    msg.next = p; // invariant: p == prev.next
                    prev.next = msg;

                    /*
                     * If this block is executing then we have a build without tail tracking -
                     * specifically: Flags.messageQueueTailTracking() == false. This is determined
                     * at build time so the flag won't change on us during runtime.
                     *
                     * Since we don't want to pepper the code with extra checks, we only check
                     * for tail tracking when we might use mLast. Otherwise, we continue to update
                     * mLast as the tail of the list.
                     *
                     * In this case however we are not maintaining mLast correctly. Since we never
                     * use it, this is fine. However, we run the risk of leaking a reference.
                     * So set mLast to null in this case to avoid any Message leaks. The other
                     * sites will never use the value so we are safe against null pointer derefs.
                     */
                    mLast = null;
                }
            }

            if (msg.isAsynchronous()) {
+11 −46
Original line number Diff line number Diff line
@@ -560,7 +560,7 @@ public final class MessageQueue {
            msg.when = when;
            msg.arg1 = token;

            if (Flags.messageQueueTailTracking() && mLast != null && mLast.when <= when) {
            if (mLast != null && mLast.when <= when) {
                /* Message goes to tail of list */
                mLast.next = msg;
                mLast = msg;
@@ -679,10 +679,6 @@ public final class MessageQueue {
                // the message is the earliest asynchronous message in the queue.
                needWake = mBlocked && p.target == null && msg.isAsynchronous();

                // For readability, we split this portion of the function into two blocks based on
                // whether tail tracking is enabled. This has a minor implication for the case
                // where tail tracking is disabled. See the comment below.
                if (Flags.messageQueueTailTracking()) {
                if (when >= mLast.when) {
                    needWake = needWake && mAsyncMessageCount == 0;
                    msg.next = null;
@@ -708,37 +704,6 @@ public final class MessageQueue {
                    msg.next = p; // invariant: p == prev.next
                    prev.next = msg;
                }
                } else {
                    Message prev;
                    for (;;) {
                        prev = p;
                        p = p.next;
                        if (p == null || when < p.when) {
                            break;
                        }
                        if (needWake && p.isAsynchronous()) {
                            needWake = false;
                        }
                    }
                    msg.next = p; // invariant: p == prev.next
                    prev.next = msg;

                    /*
                     * If this block is executing then we have a build without tail tracking -
                     * specifically: Flags.messageQueueTailTracking() == false. This is determined
                     * at build time so the flag won't change on us during runtime.
                     *
                     * Since we don't want to pepper the code with extra checks, we only check
                     * for tail tracking when we might use mLast. Otherwise, we continue to update
                     * mLast as the tail of the list.
                     *
                     * In this case however we are not maintaining mLast correctly. Since we never
                     * use it, this is fine. However, we run the risk of leaking a reference.
                     * So set mLast to null in this case to avoid any Message leaks. The other
                     * sites will never use the value so we are safe against null pointer derefs.
                     */
                    mLast = null;
                }
            }

            if (msg.isAsynchronous()) {
+0 −8
Original line number Diff line number Diff line
@@ -310,14 +310,6 @@ flag {
    is_exported: true
}

flag {
    name: "message_queue_tail_tracking"
    namespace: "system_performance"
    description: "track tail of message queue."
    bug: "305311707"
    is_fixed_read_only: true
}

flag {
     name: "message_queue_testability"
     namespace: "system_performance"