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

Commit 9c266135 authored by Alex Sakhartchouk's avatar Alex Sakhartchouk Committed by android-build-merger
Browse files

Merge "Add LambdaMessage to SurfaceFlinger" into oc-dr1-dev

am: 2f7af47f

Change-Id: I9dcff900087c79debfd52e2462745e5312c58946
parents e7842d53 2f7af47f
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@

#include "Barrier.h"

#include <functional>

namespace android {

class IDisplayEventConnection;
@@ -58,6 +60,21 @@ private:
    mutable Barrier barrier;
};

class LambdaMessage : public MessageBase {
public:
    explicit LambdaMessage(std::function<void()> handler)
          : MessageBase(), mHandler(std::move(handler)) {}

    bool handler() override {
        mHandler();
        // This return value is no longer checked, so it's always safe to return true
        return true;
    }

private:
    const std::function<void()> mHandler;
};

// ---------------------------------------------------------------------------

class MessageQueue {