diff options
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.h')
-rw-r--r-- | libs/hwui/renderthread/DrawFrameTask.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h index 2455ea84c94e..6a61a2bb645f 100644 --- a/libs/hwui/renderthread/DrawFrameTask.h +++ b/libs/hwui/renderthread/DrawFrameTask.h @@ -16,8 +16,10 @@ #ifndef DRAWFRAMETASK_H #define DRAWFRAMETASK_H +#include <optional> #include <vector> +#include <performance_hint_private.h> #include <utils/Condition.h> #include <utils/Mutex.h> #include <utils/StrongPointer.h> @@ -60,9 +62,8 @@ public: DrawFrameTask(); virtual ~DrawFrameTask(); - void setContext(RenderThread* thread, CanvasContext* context, RenderNode* targetNode); - void setHintSessionCallbacks(std::function<void(int64_t)> updateTargetWorkDuration, - std::function<void(int64_t)> reportActualWorkDuration); + void setContext(RenderThread* thread, CanvasContext* context, RenderNode* targetNode, + int32_t uiThreadId, int32_t renderThreadId); void setContentDrawBounds(int left, int top, int right, int bottom) { mContentDrawBounds.set(left, top, right, bottom); } @@ -85,6 +86,18 @@ public: } private: + class HintSessionWrapper { + public: + HintSessionWrapper(int32_t uiThreadId, int32_t renderThreadId); + ~HintSessionWrapper(); + + void updateTargetWorkDuration(long targetDurationNanos); + void reportActualWorkDuration(long actualDurationNanos); + + private: + APerformanceHintSession* mHintSession = nullptr; + }; + void postAndWait(); bool syncFrameState(TreeInfo& info); void unblockUiThread(); @@ -95,6 +108,8 @@ private: RenderThread* mRenderThread; CanvasContext* mContext; RenderNode* mTargetNode = nullptr; + int32_t mUiThreadId = -1; + int32_t mRenderThreadId = -1; Rect mContentDrawBounds; /********************************************* @@ -112,8 +127,7 @@ private: nsecs_t mLastDequeueBufferDuration = 0; nsecs_t mLastTargetWorkDuration = 0; - std::function<void(int64_t)> mUpdateTargetWorkDuration; - std::function<void(int64_t)> mReportActualWorkDuration; + std::optional<HintSessionWrapper> mHintSessionWrapper; }; } /* namespace renderthread */ |