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

Commit 018af07f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I2a437363,I27226885 into main am: 9636af27 am: 706b1543 am: 01f26138

parents f9ed17fb 01f26138
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -22,11 +22,13 @@
#include <poll.h>

#include <android-base/macros.h>
#include <android-base/scopeguard.h>
#include <binder/Functional.h>

#include "RpcState.h"
namespace android {

using namespace android::binder::impl;

std::unique_ptr<FdTrigger> FdTrigger::make() {
    auto ret = std::make_unique<FdTrigger>();
#ifndef BINDER_RPC_SINGLE_THREADED
@@ -74,8 +76,7 @@ status_t FdTrigger::triggerablePoll(const android::RpcTransportFd& transportFd,
                        "Only one thread should be polling on Fd!");

    transportFd.setPollingState(true);
    auto pollingStateGuard =
            android::base::make_scope_guard([&]() { transportFd.setPollingState(false); });
    auto pollingStateGuard = make_scope_guard([&]() { transportFd.setPollingState(false); });

    int ret = TEMP_FAILURE_RETRY(poll(pfd, arraysize(pfd), -1));
    if (ret < 0) {
+4 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@

#include <binder/Binder.h>
#include <binder/BpBinder.h>
#include <binder/Functional.h>
#include <binder/IPCThreadState.h>
#include <binder/Parcel.h>
#include <binder/ProcessState.h>
@@ -39,7 +40,6 @@
#include <binder/Status.h>
#include <binder/TextOutput.h>

#include <android-base/scopeguard.h>
#ifndef BINDER_DISABLE_BLOB
#include <cutils/ashmem.h>
#endif
@@ -98,6 +98,8 @@ static size_t pad_size(size_t s) {

namespace android {

using namespace android::binder::impl;

// many things compile this into prebuilts on the stack
#ifdef __LP64__
static_assert(sizeof(Parcel) == 120);
@@ -627,7 +629,7 @@ status_t Parcel::appendFrom(const Parcel* parcel, size_t offset, size_t len) {
        }

        const size_t savedDataPos = mDataPos;
        base::ScopeGuard scopeGuard = [&]() { mDataPos = savedDataPos; };
        auto scopeGuard = make_scope_guard([&]() { mDataPos = savedDataPos; });

        rpcFields->mObjectPositions.reserve(otherRpcFields->mObjectPositions.size());
        if (otherRpcFields->mFds != nullptr) {
+4 −2
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@
#include <binder/ProcessState.h>

#include <android-base/result.h>
#include <android-base/scopeguard.h>
#include <android-base/strings.h>
#include <binder/BpBinder.h>
#include <binder/Functional.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/Stability.h>
@@ -60,6 +60,8 @@ const char* kDefaultDriver = "/dev/binder";

namespace android {

using namespace android::binder::impl;

class PoolThread : public Thread
{
public:
@@ -430,7 +432,7 @@ status_t ProcessState::setThreadPoolMaxThreadCount(size_t maxThreads) {

size_t ProcessState::getThreadPoolMaxTotalThreadCount() const {
    pthread_mutex_lock(&mThreadCountLock);
    base::ScopeGuard detachGuard = [&]() { pthread_mutex_unlock(&mThreadCountLock); };
    auto detachGuard = make_scope_guard([&]() { pthread_mutex_unlock(&mThreadCountLock); });

    if (mThreadPoolStarted) {
        LOG_ALWAYS_FATAL_IF(mKernelStartedThreads > mMaxThreads + 1,
+3 −2
Original line number Diff line number Diff line
@@ -16,12 +16,13 @@

#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/scopeguard.h>
#include <android-base/unique_fd.h>
#include <binder/Functional.h>
#include <binder/RecordedTransaction.h>
#include <sys/mman.h>
#include <algorithm>

using namespace android::binder::impl;
using android::Parcel;
using android::base::borrowed_fd;
using android::base::unique_fd;
@@ -218,7 +219,7 @@ std::optional<RecordedTransaction> RecordedTransaction::fromFile(const unique_fd
        size_t memoryMappedSize = chunkPayloadSize + mmapPayloadStartOffset;
        void* mappedMemory =
                mmap(NULL, memoryMappedSize, PROT_READ, MAP_SHARED, fd.get(), mmapPageAlignedStart);
        auto mmap_guard = android::base::make_scope_guard(
        auto mmap_guard = make_scope_guard(
                [mappedMemory, memoryMappedSize] { munmap(mappedMemory, memoryMappedSize); });

        transaction_checksum_t* payloadMap =
+5 −4
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
#include <thread>
#include <vector>

#include <android-base/scopeguard.h>
#include <binder/Functional.h>
#include <binder/Parcel.h>
#include <binder/RpcServer.h>
#include <binder/RpcTransportRaw.h>
@@ -45,7 +45,7 @@ namespace android {

constexpr size_t kSessionIdBytes = 32;

using base::ScopeGuard;
using namespace android::binder::impl;
using base::unique_fd;

RpcServer::RpcServer(std::unique_ptr<RpcTransportCtx> ctx) : mCtx(std::move(ctx)) {}
@@ -458,11 +458,12 @@ void RpcServer::establishConnection(
        LOG_ALWAYS_FATAL_IF(threadId == server->mConnectingThreads.end(),
                            "Must establish connection on owned thread");
        thisThread = std::move(threadId->second);
        ScopeGuard detachGuard = [&]() {
        auto detachGuardLambda = [&]() {
            thisThread.detach();
            _l.unlock();
            server->mShutdownCv.notify_all();
        };
        auto detachGuard = make_scope_guard(std::ref(detachGuardLambda));
        server->mConnectingThreads.erase(threadId);

        if (status != OK || server->mShutdownTrigger->isTriggered()) {
@@ -548,7 +549,7 @@ void RpcServer::establishConnection(
            return;
        }

        detachGuard.Disable();
        detachGuard.release();
        session->preJoinThreadOwnership(std::move(thisThread));
    }

Loading