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
diff --git a/libs/hwui/WebViewFunctorManager.cpp b/libs/hwui/WebViewFunctorManager.cpp
index efa9b11..9d16ee8 100644
--- a/libs/hwui/WebViewFunctorManager.cpp
+++ b/libs/hwui/WebViewFunctorManager.cpp
@@ -87,7 +87,7 @@
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 @@
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::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 @@
}
}
-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 635d863..ec17640 100644
--- a/libs/hwui/WebViewFunctorManager.h
+++ b/libs/hwui/WebViewFunctorManager.h
@@ -54,7 +54,7 @@
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 @@
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 @@
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 @@
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 ed50190..4ba206b 100644
--- a/libs/hwui/platform/host/WebViewFunctorManager.cpp
+++ b/libs/hwui/platform/host/WebViewFunctorManager.cpp
@@ -50,7 +50,7 @@
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::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 b06ad6f..66e0896 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -73,7 +73,7 @@
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) {