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

Commit 2f7af47f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 509bb5d1 c1c461af
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 {