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

Commit 56978ea1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Avoid unnecessary WindowInfo copies" into main

parents 83535125 9210f10d
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -836,13 +836,9 @@ bool isStylusActiveInDisplay(ui::LogicalDisplayId displayId,
}

Result<void> validateWindowInfosUpdate(const gui::WindowInfosUpdate& update) {
    struct HashFunction {
        size_t operator()(const WindowInfo& info) const { return info.id; }
    };

    std::unordered_set<WindowInfo, HashFunction> windowSet;
    std::unordered_set<int32_t> windowIds;
    for (const WindowInfo& info : update.windowInfos) {
        const auto [_, inserted] = windowSet.insert(info);
        const auto [_, inserted] = windowIds.insert(info.id);
        if (!inserted) {
            return Error() << "Duplicate entry for " << info;
        }