diff options
| author | 2019-01-30 00:39:45 +0000 | |
|---|---|---|
| committer | 2019-01-30 00:39:45 +0000 | |
| commit | 7de6f68ff865afa3b329b605b78d0cf0df2a050d (patch) | |
| tree | d8a7f94405e9c26d5042014b77152e1c2a5e6c8c | |
| parent | bf49dd5fd6152e32f9a6055c233cf4991e46d285 (diff) | |
| parent | bd52c84d77aa0299fe4206abbaaa101ca56a5f3f (diff) | |
Merge "SF: Fix stray pointers in Scheduler"
| -rw-r--r-- | services/surfaceflinger/Scheduler/Scheduler.cpp | 15 | ||||
| -rw-r--r-- | services/surfaceflinger/Scheduler/Scheduler.h | 4 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/unittests/SchedulerTest.cpp | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index 2ed2866ddf..b0034511d7 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -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( diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h index e9923986c6..b7176050a7 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.h +++ b/services/surfaceflinger/Scheduler/Scheduler.h @@ -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: diff --git a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp index 3dd5143f24..4d9aec6b66 100644 --- a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp +++ b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp @@ -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); |