Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Release `MediaMuxer` when a replay segment has no encodable frames to avoid a resource leak ([#5583](https://github.com/getsentry/sentry-java/pull/5583))

### Internal

- Reduce allocations in gesture target traversal by using `ArrayDeque` instead of `LinkedList` ([#5594](https://github.com/getsentry/sentry-java/pull/5594))

## 8.44.1

### Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.sentry.android.core.SentryAndroidOptions;
import io.sentry.internal.gestures.GestureTargetLocator;
import io.sentry.internal.gestures.UiElement;
import java.util.LinkedList;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Queue;
import org.jetbrains.annotations.ApiStatus;
Expand Down Expand Up @@ -62,11 +62,11 @@ private static boolean touchWithinBounds(
final UiElement.Type targetType) {

final List<GestureTargetLocator> locators = options.getGestureTargetLocators();
final Queue<View> queue = new LinkedList<>();
final Queue<View> queue = new ArrayDeque<>();
queue.add(decorView);

@Nullable UiElement target = null;
while (queue.size() > 0) {
while (!queue.isEmpty()) {
final View view = queue.poll();

if (!touchWithinBounds(view, x, y)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import io.sentry.compose.boundsInWindow
import io.sentry.internal.gestures.GestureTargetLocator
import io.sentry.internal.gestures.UiElement
import io.sentry.util.AutoClosableReentrantLock
import java.util.LinkedList
import java.util.ArrayDeque
import java.util.Queue

@OptIn(InternalComposeUiApi::class)
Expand Down Expand Up @@ -45,7 +45,7 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT
val rootLayoutNode = root.root

// Pair<Node, ParentTag>
val queue: Queue<Pair<LayoutNode, String?>> = LinkedList()
val queue: Queue<Pair<LayoutNode, String?>> = ArrayDeque()
queue.add(Pair(rootLayoutNode, null))

// the final tag to return, only relevant for clicks
Expand Down Expand Up @@ -92,7 +92,10 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT
}
}
}
queue.addAll(node.zSortedChildren.asMutableList().map { Pair(it, tag) })
val children = node.zSortedChildren.asMutableList()
for (index in children.indices) {
queue.add(Pair(children[index], tag))
}
}
}

Expand Down
Loading