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

Commit b398ee21 authored by Angel Aguayo's avatar Angel Aguayo
Browse files

Consolidate WpHash declaration to a common file

Bug: b/193932763
Test: frameworks/native/test
Change-Id: Ib19f191ed8031b77c059b644fe5df3c8137e6619
parent 2c577834
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@


#include "Clock.h"
#include "Clock.h"
#include "FrameTimeline/FrameTimeline.h"
#include "FrameTimeline/FrameTimeline.h"
#include "WpHash.h"


namespace android {
namespace android {


@@ -50,11 +51,6 @@ public:


private:
private:
    mutable std::mutex mMutex;
    mutable std::mutex mMutex;
    struct WpHash {
        size_t operator()(const wp<IBinder>& p) const {
            return std::hash<IBinder*>()(p.unsafe_get());
        }
    };


    struct TrackedListener {
    struct TrackedListener {
        sp<gui::IFpsListener> listener;
        sp<gui::IFpsListener> listener;
+2 −5
Original line number Original line Diff line number Diff line
@@ -22,6 +22,8 @@


#include <unordered_map>
#include <unordered_map>


#include "WpHash.h"

namespace android {
namespace android {


class HdrLayerInfoReporter final : public IBinder::DeathRecipient {
class HdrLayerInfoReporter final : public IBinder::DeathRecipient {
@@ -63,11 +65,6 @@ public:


private:
private:
    mutable std::mutex mMutex;
    mutable std::mutex mMutex;
    struct WpHash {
        size_t operator()(const wp<IBinder>& p) const {
            return std::hash<IBinder*>()(p.unsafe_get());
        }
    };


    struct TrackedListener {
    struct TrackedListener {
        sp<gui::IHdrLayerInfoListener> listener;
        sp<gui::IHdrLayerInfoListener> listener;
+1 −5
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@
#include <unordered_map>
#include <unordered_map>


#include "Scheduler/OneShotTimer.h"
#include "Scheduler/OneShotTimer.h"
#include "WpHash.h"


namespace android {
namespace android {


@@ -88,11 +89,6 @@ private:
        sp<IRegionSamplingListener> listener;
        sp<IRegionSamplingListener> listener;
    };
    };


    struct WpHash {
        size_t operator()(const wp<IBinder>& p) const {
            return std::hash<IBinder*>()(p.unsafe_get());
        }
    };
    std::vector<float> sampleBuffer(
    std::vector<float> sampleBuffer(
            const sp<GraphicBuffer>& buffer, const Point& leftTop,
            const sp<GraphicBuffer>& buffer, const Point& leftTop,
            const std::vector<RegionSamplingThread::Descriptor>& descriptors, uint32_t orientation);
            const std::vector<RegionSamplingThread::Descriptor>& descriptors, uint32_t orientation);
+2 −6
Original line number Original line Diff line number Diff line
@@ -25,6 +25,8 @@
#include <binder/IBinder.h>
#include <binder/IBinder.h>
#include <utils/Timers.h>
#include <utils/Timers.h>


#include "../WpHash.h"

namespace android::scheduler {
namespace android::scheduler {


// State machine controlled by transaction flags. VsyncModulator switches to early phase offsets
// State machine controlled by transaction flags. VsyncModulator switches to early phase offsets
@@ -124,12 +126,6 @@ private:
    using Schedule = TransactionSchedule;
    using Schedule = TransactionSchedule;
    std::atomic<Schedule> mTransactionSchedule = Schedule::Late;
    std::atomic<Schedule> mTransactionSchedule = Schedule::Late;


    struct WpHash {
        size_t operator()(const wp<IBinder>& p) const {
            return std::hash<IBinder*>()(p.unsafe_get());
        }
    };

    std::unordered_set<wp<IBinder>, WpHash> mEarlyWakeupRequests GUARDED_BY(mMutex);
    std::unordered_set<wp<IBinder>, WpHash> mEarlyWakeupRequests GUARDED_BY(mMutex);
    std::atomic<bool> mRefreshRateChangePending = false;
    std::atomic<bool> mRefreshRateChangePending = false;


+2 −5
Original line number Original line Diff line number Diff line
@@ -22,6 +22,8 @@


#include <unordered_map>
#include <unordered_map>


#include "WpHash.h"

namespace android {
namespace android {


class Layer;
class Layer;
@@ -54,11 +56,6 @@ public:


private:
private:
    mutable std::mutex mMutex;
    mutable std::mutex mMutex;
    struct WpHash {
        size_t operator()(const wp<IBinder>& p) const {
            return std::hash<IBinder*>()(p.unsafe_get());
        }
    };


    std::unordered_map<wp<IBinder>, sp<gui::ITunnelModeEnabledListener>, WpHash> mListeners
    std::unordered_map<wp<IBinder>, sp<gui::ITunnelModeEnabledListener>, WpHash> mListeners
            GUARDED_BY(mMutex);
            GUARDED_BY(mMutex);
Loading