From 980418350b15d595ebe17ec9ae895dac374c6ee0 Mon Sep 17 00:00:00 2001 From: Dominik Laskowski Date: Thu, 1 Aug 2019 18:35:59 -0700 Subject: SF: Clean up Scheduler Remove dynamic allocation for Scheduler::{Connection,ConnectionHandle}, as well as ref-counting for the latter. Also, remove dead code and make members private. Bug: 130554049 Test: libsurfaceflinger_unittest Change-Id: Ibb9dc8d4cb66451a4172c852a36032bbc0a54411 --- services/surfaceflinger/RegionSamplingThread.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'services/surfaceflinger/RegionSamplingThread.cpp') diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 07fdead310..1c1367c916 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -21,15 +21,18 @@ #include "RegionSamplingThread.h" +#include +#include #include #include +#include #include + #include -#include -#include #include "DisplayDevice.h" #include "Layer.h" +#include "Scheduler/DispSync.h" #include "SurfaceFlinger.h" namespace android { @@ -105,9 +108,8 @@ struct SamplingOffsetCallback : DispSync::Callback { if (mVsyncListening) return; mPhaseIntervalSetting = Phase::ZERO; - mScheduler.withPrimaryDispSync([this](android::DispSync& sync) { - sync.addEventListener("SamplingThreadDispSyncListener", 0, this, mLastCallbackTime); - }); + mScheduler.getPrimaryDispSync().addEventListener("SamplingThreadDispSyncListener", 0, this, + mLastCallbackTime); mVsyncListening = true; } @@ -120,9 +122,7 @@ private: void stopVsyncListenerLocked() /*REQUIRES(mMutex)*/ { if (!mVsyncListening) return; - mScheduler.withPrimaryDispSync([this](android::DispSync& sync) { - sync.removeEventListener(this, &mLastCallbackTime); - }); + mScheduler.getPrimaryDispSync().removeEventListener(this, &mLastCallbackTime); mVsyncListening = false; } @@ -132,16 +132,13 @@ private: if (mPhaseIntervalSetting == Phase::ZERO) { ATRACE_INT(lumaSamplingStepTag, static_cast(samplingStep::waitForSamplePhase)); mPhaseIntervalSetting = Phase::SAMPLING; - mScheduler.withPrimaryDispSync([this](android::DispSync& sync) { - sync.changePhaseOffset(this, mTargetSamplingOffset.count()); - }); + mScheduler.getPrimaryDispSync().changePhaseOffset(this, mTargetSamplingOffset.count()); return; } if (mPhaseIntervalSetting == Phase::SAMPLING) { mPhaseIntervalSetting = Phase::ZERO; - mScheduler.withPrimaryDispSync( - [this](android::DispSync& sync) { sync.changePhaseOffset(this, 0); }); + mScheduler.getPrimaryDispSync().changePhaseOffset(this, 0); stopVsyncListenerLocked(); lock.unlock(); mRegionSamplingThread.notifySamplingOffset(); -- cgit v1.2.3-59-g8ed1b