Loading libs/gui/Choreographer.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ namespace android { Choreographer::Context Choreographer::gChoreographers; static thread_local Choreographer* gChoreographer; static thread_local sp<Choreographer> gChoreographer; void Choreographer::initJVM(JNIEnv* env) { env->GetJavaVM(&gJni.jvm); Loading @@ -86,21 +86,21 @@ void Choreographer::initJVM(JNIEnv* env) { "()V"); } Choreographer* Choreographer::getForThread() { sp<Choreographer> Choreographer::getForThread() { if (gChoreographer == nullptr) { sp<Looper> looper = Looper::getForThread(); if (!looper.get()) { ALOGW("No looper prepared for thread"); return nullptr; } gChoreographer = new Choreographer(looper); gChoreographer = sp<Choreographer>::make(looper); status_t result = gChoreographer->initialize(); if (result != OK) { ALOGW("Failed to initialize"); return nullptr; } } return gChoreographer; return gChoreographer.get(); } Choreographer::Choreographer(const sp<Looper>& looper, const sp<IBinder>& layerHandle) Loading libs/gui/include/gui/Choreographer.h +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public: virtual void handleMessage(const Message& message) override; static void initJVM(JNIEnv* env); static Choreographer* getForThread(); static sp<Choreographer> getForThread(); static void signalRefreshRateCallbacks(nsecs_t vsyncPeriod) EXCLUDES(gChoreographers.lock); static int64_t getStartTimeNanosForVsyncId(AVsyncId vsyncId) EXCLUDES(gChoreographers.lock); virtual ~Choreographer() override EXCLUDES(gChoreographers.lock); Loading libs/gui/tests/Choreographer_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ static void vsyncCallback(const AChoreographerFrameCallbackData* callbackData, v TEST_F(ChoreographerTest, InputCallbackBeforeAnimation) { sp<Looper> looper = Looper::prepare(0); Choreographer* choreographer = Choreographer::getForThread(); sp<Choreographer> choreographer = Choreographer::getForThread(); VsyncCallback animationCb; choreographer->postFrameCallbackDelayed(nullptr, nullptr, vsyncCallback, &animationCb, 0, CALLBACK_ANIMATION); Loading libs/nativedisplay/AChoreographer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ static inline AChoreographer* Choreographer_to_AChoreographer(Choreographer* cho } AChoreographer* AChoreographer_getInstance() { return Choreographer_to_AChoreographer(Choreographer::getForThread()); return Choreographer_to_AChoreographer(Choreographer::getForThread().get()); } void AChoreographer_postFrameCallback(AChoreographer* choreographer, Loading Loading
libs/gui/Choreographer.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ namespace android { Choreographer::Context Choreographer::gChoreographers; static thread_local Choreographer* gChoreographer; static thread_local sp<Choreographer> gChoreographer; void Choreographer::initJVM(JNIEnv* env) { env->GetJavaVM(&gJni.jvm); Loading @@ -86,21 +86,21 @@ void Choreographer::initJVM(JNIEnv* env) { "()V"); } Choreographer* Choreographer::getForThread() { sp<Choreographer> Choreographer::getForThread() { if (gChoreographer == nullptr) { sp<Looper> looper = Looper::getForThread(); if (!looper.get()) { ALOGW("No looper prepared for thread"); return nullptr; } gChoreographer = new Choreographer(looper); gChoreographer = sp<Choreographer>::make(looper); status_t result = gChoreographer->initialize(); if (result != OK) { ALOGW("Failed to initialize"); return nullptr; } } return gChoreographer; return gChoreographer.get(); } Choreographer::Choreographer(const sp<Looper>& looper, const sp<IBinder>& layerHandle) Loading
libs/gui/include/gui/Choreographer.h +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public: virtual void handleMessage(const Message& message) override; static void initJVM(JNIEnv* env); static Choreographer* getForThread(); static sp<Choreographer> getForThread(); static void signalRefreshRateCallbacks(nsecs_t vsyncPeriod) EXCLUDES(gChoreographers.lock); static int64_t getStartTimeNanosForVsyncId(AVsyncId vsyncId) EXCLUDES(gChoreographers.lock); virtual ~Choreographer() override EXCLUDES(gChoreographers.lock); Loading
libs/gui/tests/Choreographer_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ static void vsyncCallback(const AChoreographerFrameCallbackData* callbackData, v TEST_F(ChoreographerTest, InputCallbackBeforeAnimation) { sp<Looper> looper = Looper::prepare(0); Choreographer* choreographer = Choreographer::getForThread(); sp<Choreographer> choreographer = Choreographer::getForThread(); VsyncCallback animationCb; choreographer->postFrameCallbackDelayed(nullptr, nullptr, vsyncCallback, &animationCb, 0, CALLBACK_ANIMATION); Loading
libs/nativedisplay/AChoreographer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ static inline AChoreographer* Choreographer_to_AChoreographer(Choreographer* cho } AChoreographer* AChoreographer_getInstance() { return Choreographer_to_AChoreographer(Choreographer::getForThread()); return Choreographer_to_AChoreographer(Choreographer::getForThread().get()); } void AChoreographer_postFrameCallback(AChoreographer* choreographer, Loading