Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9da39e77 authored by Jerome Gaillard's avatar Jerome Gaillard
Browse files

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
parent dd37c987
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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();
+6 −6
Original line number Diff line number Diff line
@@ -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);

+4 −4
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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) {