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

Commit bd52c84d authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Fix stray pointers in Scheduler

Bug: None
Test: Build
Change-Id: I578fc0d94691edcd905f78bc75e08072d9c49744
parent bf9a49a2
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -84,14 +84,14 @@ Scheduler::Scheduler(impl::EventControlThread::SetVSyncEnabledFunction function)
Scheduler::~Scheduler() = default;

sp<Scheduler::ConnectionHandle> Scheduler::createConnection(
        const std::string& connectionName, int64_t phaseOffsetNs, ResyncCallback resyncCallback,
        const char* connectionName, int64_t phaseOffsetNs, ResyncCallback resyncCallback,
        impl::EventThread::InterceptVSyncsCallback interceptCallback) {
    const int64_t id = sNextId++;
    ALOGV("Creating a connection handle with ID: %" PRId64 "\n", id);

    std::unique_ptr<EventThread> eventThread =
            makeEventThread(connectionName, mPrimaryDispSync.get(), phaseOffsetNs,
                            interceptCallback);
                            std::move(interceptCallback));
    auto connection = std::make_unique<Connection>(new ConnectionHandle(id),
                                                   eventThread->createEventConnection(
                                                           std::move(resyncCallback)),
@@ -102,14 +102,13 @@ sp<Scheduler::ConnectionHandle> Scheduler::createConnection(
}

std::unique_ptr<EventThread> Scheduler::makeEventThread(
        const std::string& connectionName, DispSync* dispSync, int64_t phaseOffsetNs,
        const char* connectionName, DispSync* dispSync, int64_t phaseOffsetNs,
        impl::EventThread::InterceptVSyncsCallback interceptCallback) {
    const std::string sourceName = connectionName + "Source";
    std::unique_ptr<VSyncSource> eventThreadSource =
            std::make_unique<DispSyncSource>(dispSync, phaseOffsetNs, true, sourceName.c_str());
    const std::string threadName = connectionName + "Thread";
    return std::make_unique<impl::EventThread>(std::move(eventThreadSource), interceptCallback,
                                               [this] { resetIdleTimer(); }, threadName.c_str());
            std::make_unique<DispSyncSource>(dispSync, phaseOffsetNs, true, connectionName);
    return std::make_unique<impl::EventThread>(std::move(eventThreadSource),
                                               std::move(interceptCallback),
                                               [this] { resetIdleTimer(); }, connectionName);
}

sp<IDisplayEventConnection> Scheduler::createDisplayEventConnection(
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public:

    /** Creates an EventThread connection. */
    sp<ConnectionHandle> createConnection(
            const std::string& connectionName, int64_t phaseOffsetNs, ResyncCallback resyncCallback,
            const char* connectionName, int64_t phaseOffsetNs, ResyncCallback resyncCallback,
            impl::EventThread::InterceptVSyncsCallback interceptCallback);

    sp<IDisplayEventConnection> createDisplayEventConnection(const sp<ConnectionHandle>& handle,
@@ -123,7 +123,7 @@ public:

protected:
    virtual std::unique_ptr<EventThread> makeEventThread(
            const std::string& connectionName, DispSync* dispSync, int64_t phaseOffsetNs,
            const char* connectionName, DispSync* dispSync, int64_t phaseOffsetNs,
            impl::EventThread::InterceptVSyncsCallback interceptCallback);

private:
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ protected:
              : Scheduler([](bool) {}), mEventThread(std::move(eventThread)) {}

        std::unique_ptr<EventThread> makeEventThread(
                const std::string& /* connectionName */, DispSync* /* dispSync */,
                const char* /* connectionName */, DispSync* /* dispSync */,
                nsecs_t /* phaseOffsetNs */,
                impl::EventThread::InterceptVSyncsCallback /* interceptCallback */) override {
            return std::move(mEventThread);