diff options
author | 2024-04-09 14:43:21 +0100 | |
---|---|---|
committer | 2024-04-10 17:18:26 +0100 | |
commit | 9da39e77eb85e121d2c3c33ebfe7294fbe691de8 (patch) | |
tree | d1f13cabcd27917c2854b6eb98fda21233c9ce24 | |
parent | dd37c9871ef2a918d251dd9159181eb622a6e371 (diff) |
Do not mix pid_t and int32_t in Hwui
Those two types are both equivalent to int for Android, but they may not
be the same in all host build platforms.
Bug: 322360037
Test: build libhwui on Android and host
Change-Id: I356da56ce507af1cfa00b685c71d445870338cda
-rw-r--r-- | libs/hwui/WebViewFunctorManager.cpp | 12 | ||||
-rw-r--r-- | libs/hwui/WebViewFunctorManager.h | 12 | ||||
-rw-r--r-- | libs/hwui/platform/host/WebViewFunctorManager.cpp | 8 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 2 |
4 files changed, 17 insertions, 17 deletions
diff --git a/libs/hwui/WebViewFunctorManager.cpp b/libs/hwui/WebViewFunctorManager.cpp index efa9b1174a3a..9d16ee86739e 100644 --- a/libs/hwui/WebViewFunctorManager.cpp +++ b/libs/hwui/WebViewFunctorManager.cpp @@ -87,7 +87,7 @@ void WebViewFunctor_release(int functor) { WebViewFunctorManager::instance().releaseFunctor(functor); } -void WebViewFunctor_reportRenderingThreads(int functor, const int32_t* thread_ids, size_t size) { +void WebViewFunctor_reportRenderingThreads(int functor, const pid_t* thread_ids, size_t size) { WebViewFunctorManager::instance().reportRenderingThreads(functor, thread_ids, size); } @@ -265,8 +265,8 @@ void WebViewFunctor::reparentSurfaceControl(ASurfaceControl* parent) { funcs.transactionDeleteFunc(transaction); } -void WebViewFunctor::reportRenderingThreads(const int32_t* thread_ids, size_t size) { - mRenderingThreads = std::vector<int32_t>(thread_ids, thread_ids + size); +void WebViewFunctor::reportRenderingThreads(const pid_t* thread_ids, size_t size) { + mRenderingThreads = std::vector<pid_t>(thread_ids, thread_ids + size); } WebViewFunctorManager& WebViewFunctorManager::instance() { @@ -355,7 +355,7 @@ void WebViewFunctorManager::destroyFunctor(int functor) { } } -void WebViewFunctorManager::reportRenderingThreads(int functor, const int32_t* thread_ids, +void WebViewFunctorManager::reportRenderingThreads(int functor, const pid_t* thread_ids, size_t size) { std::lock_guard _lock{mLock}; for (auto& iter : mFunctors) { @@ -366,8 +366,8 @@ void WebViewFunctorManager::reportRenderingThreads(int functor, const int32_t* t } } -std::vector<int32_t> WebViewFunctorManager::getRenderingThreadsForActiveFunctors() { - std::vector<int32_t> renderingThreads; +std::vector<pid_t> WebViewFunctorManager::getRenderingThreadsForActiveFunctors() { + std::vector<pid_t> renderingThreads; std::lock_guard _lock{mLock}; for (const auto& iter : mActiveFunctors) { const auto& functorThreads = iter->getRenderingThreads(); diff --git a/libs/hwui/WebViewFunctorManager.h b/libs/hwui/WebViewFunctorManager.h index 635d863c82ab..ec17640f9b5e 100644 --- a/libs/hwui/WebViewFunctorManager.h +++ b/libs/hwui/WebViewFunctorManager.h @@ -54,7 +54,7 @@ public: void onRemovedFromTree() { mReference.onRemovedFromTree(); } - const std::vector<int32_t>& getRenderingThreads() const { + const std::vector<pid_t>& getRenderingThreads() const { return mReference.getRenderingThreads(); } @@ -79,8 +79,8 @@ public: ASurfaceControl* getSurfaceControl(); void mergeTransaction(ASurfaceTransaction* transaction); - void reportRenderingThreads(const int32_t* thread_ids, size_t size); - const std::vector<int32_t>& getRenderingThreads() const { return mRenderingThreads; } + void reportRenderingThreads(const pid_t* thread_ids, size_t size); + const std::vector<pid_t>& getRenderingThreads() const { return mRenderingThreads; } sp<Handle> createHandle() { LOG_ALWAYS_FATAL_IF(mCreatedHandle); @@ -101,7 +101,7 @@ private: bool mCreatedHandle = false; int32_t mParentSurfaceControlGenerationId = 0; ASurfaceControl* mSurfaceControl = nullptr; - std::vector<int32_t> mRenderingThreads; + std::vector<pid_t> mRenderingThreads; }; class WebViewFunctorManager { @@ -112,8 +112,8 @@ public: void releaseFunctor(int functor); void onContextDestroyed(); void destroyFunctor(int functor); - void reportRenderingThreads(int functor, const int32_t* thread_ids, size_t size); - std::vector<int32_t> getRenderingThreadsForActiveFunctors(); + void reportRenderingThreads(int functor, const pid_t* thread_ids, size_t size); + std::vector<pid_t> getRenderingThreadsForActiveFunctors(); sp<WebViewFunctor::Handle> handleFor(int functor); diff --git a/libs/hwui/platform/host/WebViewFunctorManager.cpp b/libs/hwui/platform/host/WebViewFunctorManager.cpp index ed50190dc90c..4ba206b41b39 100644 --- a/libs/hwui/platform/host/WebViewFunctorManager.cpp +++ b/libs/hwui/platform/host/WebViewFunctorManager.cpp @@ -50,7 +50,7 @@ ASurfaceControl* WebViewFunctor::getSurfaceControl() { void WebViewFunctor::mergeTransaction(ASurfaceTransaction* transaction) {} -void WebViewFunctor::reportRenderingThreads(const int32_t* thread_ids, size_t size) {} +void WebViewFunctor::reportRenderingThreads(const pid_t* thread_ids, size_t size) {} void WebViewFunctor::reparentSurfaceControl(ASurfaceControl* parent) {} @@ -70,11 +70,11 @@ void WebViewFunctorManager::onContextDestroyed() {} void WebViewFunctorManager::destroyFunctor(int functor) {} -void WebViewFunctorManager::reportRenderingThreads(int functor, const int32_t* thread_ids, +void WebViewFunctorManager::reportRenderingThreads(int functor, const pid_t* thread_ids, size_t size) {} -std::vector<int32_t> WebViewFunctorManager::getRenderingThreadsForActiveFunctors() { - return std::vector<int32_t>(); +std::vector<pid_t> WebViewFunctorManager::getRenderingThreadsForActiveFunctors() { + return {}; } sp<WebViewFunctor::Handle> WebViewFunctorManager::handleFor(int functor) { diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index b06ad6ff6015..66e089627a7b 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -73,7 +73,7 @@ CanvasContext* ScopedActiveContext::sActiveContext = nullptr; CanvasContext* CanvasContext::create(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory, - int32_t uiThreadId, int32_t renderThreadId) { + pid_t uiThreadId, pid_t renderThreadId) { auto renderType = Properties::getRenderPipelineType(); switch (renderType) { |