diff options
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.cpp')
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp index 8372331c0352..778e7689d0f9 100644 --- a/libs/hwui/renderthread/DrawFrameTask.cpp +++ b/libs/hwui/renderthread/DrawFrameTask.cpp @@ -94,12 +94,20 @@ void DrawFrameTask::run() { // Grab a copy of everything we need CanvasContext* context = mContext; + std::function<void(int64_t)> callback = std::move(mFrameCallback); // From this point on anything in "this" is *UNSAFE TO ACCESS* if (canUnblockUiThread) { unblockUiThread(); } + // Even if we aren't drawing this vsync pulse the next frame number will still be accurate + if (CC_UNLIKELY(callback)) { + context->enqueueFrameWork([callback, frameNr = context->getFrameNumber()]() { + callback(frameNr); + }); + } + if (CC_LIKELY(canDrawThisFrame)) { context->draw(); } else { |