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

Commit 01b8126c authored by Yi Kong's avatar Yi Kong
Browse files

surfaceflinger: Remove unnecessary std::move

Moving a temporary object prevents copy elision, and could reduce
performance.

This fixes -Wpessimizing-move compiler warning.

Test: presubmit
Bug: 154270751
Change-Id: I745e7dbcbde53eed95111e78d1251bea43b3869f
parent f9d7f291
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ sp<GraphicBuffer> allocateClearSlotBuffer() {
    if (!buffer || buffer->initCheck() != ::android::OK) {
        return nullptr;
    }
    return std::move(buffer);
    return buffer;
}

} // anonymous namespace
+2 −2
Original line number Diff line number Diff line
@@ -62,12 +62,12 @@ perfetto::protos::TransactionState TransactionProtoParser::toProto(const Transac

    proto.mutable_layer_changes()->Reserve(static_cast<int32_t>(t.states.size()));
    for (auto& layerState : t.states) {
        proto.mutable_layer_changes()->Add(std::move(toProto(layerState)));
        proto.mutable_layer_changes()->Add(toProto(layerState));
    }

    proto.mutable_display_changes()->Reserve(static_cast<int32_t>(t.displays.size()));
    for (auto& displayState : t.displays) {
        proto.mutable_display_changes()->Add(std::move(toProto(displayState)));
        proto.mutable_display_changes()->Add(toProto(displayState));
    }

    proto.mutable_merged_transaction_ids()->Reserve(
+2 −2
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ void TransactionTracing::addEntry(const std::vector<CommittedUpdates>& committed
                static_cast<int32_t>(update.createdLayers.size()));

        for (const auto& args : update.createdLayers) {
            entryProto.mutable_added_layers()->Add(std::move(mProtoParser.toProto(args)));
            entryProto.mutable_added_layers()->Add(mProtoParser.toProto(args));
        }

        entryProto.mutable_destroyed_layers()->Reserve(
@@ -276,7 +276,7 @@ void TransactionTracing::addEntry(const std::vector<CommittedUpdates>& committed
                    static_cast<int32_t>(update.displayInfos.size()));
            for (auto& [layerStack, displayInfo] : update.displayInfos) {
                entryProto.mutable_displays()->Add(
                        std::move(mProtoParser.toProto(displayInfo, layerStack.id)));
                        mProtoParser.toProto(displayInfo, layerStack.id));
            }
        }

+4 −4
Original line number Diff line number Diff line
@@ -131,14 +131,14 @@ protected:
        // add layers and add some layer transaction
        {
            frontend::Update update;
            update.layerCreationArgs.emplace_back(std::move(
            update.layerCreationArgs.emplace_back(
                    getLayerCreationArgs(mParentLayerId, /*parentId=*/UNASSIGNED_LAYER_ID,
                                         /*layerIdToMirror=*/UNASSIGNED_LAYER_ID, /*flags=*/123,
                                         /*addToRoot=*/true)));
            update.layerCreationArgs.emplace_back(std::move(
                                         /*addToRoot=*/true));
            update.layerCreationArgs.emplace_back(
                    getLayerCreationArgs(mChildLayerId, mParentLayerId,
                                         /*layerIdToMirror=*/UNASSIGNED_LAYER_ID, /*flags=*/456,
                                         /*addToRoot=*/true)));
                                         /*addToRoot=*/true));
            TransactionState transaction;
            transaction.id = 50;
            ResolvedComposerState layerState;