summaryrefslogtreecommitdiff
path: root/libshims/include/utils
diff options
context:
space:
mode:
authorkoron393 <koron393@gmail.com>2019-05-07 02:49:25 +0900
committerArian <arian.kulmer@web.de>2019-10-25 22:16:13 +0200
commiteb4c130ccf05799fe7c20a4737f21dd63c0dbed5 (patch)
tree4845e3f7e06d660b0def654c9a294bd489dc2744 /libshims/include/utils
parentfd201d3c1df49d4af95d2c48709b5a98b6e6d8e9 (diff)
shinano-common: libshim_camera: Update GraphicBuffer sources to Pie
* Copy from Pie framework sources. Change-Id: I903eb0c3c80a752d4a8da44dec47e348c7dd23fc Signed-off-by: Nikhil Punathil <nikhilpe@gmail.com>
Diffstat (limited to 'libshims/include/utils')
-rw-r--r--libshims/include/utils/Looper.h27
-rw-r--r--libshims/include/utils/VectorImpl.h38
2 files changed, 28 insertions, 37 deletions
diff --git a/libshims/include/utils/Looper.h b/libshims/include/utils/Looper.h
index 88e13cf..a62e67f 100644
--- a/libshims/include/utils/Looper.h
+++ b/libshims/include/utils/Looper.h
@@ -49,7 +49,7 @@ typedef int (*Looper_callbackFunc)(int fd, int events, void* data);
*/
struct Message {
Message() : what(0) { }
- Message(int what) : what(what) { }
+ Message(int w) : what(w) { }
/* The message type. (interpretation is left up to the handler) */
int what;
@@ -66,7 +66,7 @@ struct Message {
*/
class MessageHandler : public virtual RefBase {
protected:
- virtual ~MessageHandler() { }
+ virtual ~MessageHandler();
public:
/**
@@ -97,7 +97,7 @@ private:
*/
class LooperCallback : public virtual RefBase {
protected:
- virtual ~LooperCallback() { }
+ virtual ~LooperCallback();
public:
/**
@@ -420,8 +420,12 @@ private:
struct Request {
int fd;
int ident;
+ int events;
+ int seq;
sp<LooperCallback> callback;
void* data;
+
+ void initEventItem(struct epoll_event* eventItem) const;
};
struct Response {
@@ -432,8 +436,8 @@ private:
struct MessageEnvelope {
MessageEnvelope() : uptime(0) { }
- MessageEnvelope(nsecs_t uptime, const sp<MessageHandler> handler,
- const Message& message) : uptime(uptime), handler(handler), message(message) {
+ MessageEnvelope(nsecs_t u, const sp<MessageHandler> h,
+ const Message& m) : uptime(u), handler(h), message(m) {
}
nsecs_t uptime;
@@ -443,8 +447,7 @@ private:
const bool mAllowNonCallbacks; // immutable
- int mWakeReadPipeFd; // immutable
- int mWakeWritePipeFd; // immutable
+ int mWakeEventFd; // immutable
Mutex mLock;
Vector<MessageEnvelope> mMessageEnvelopes; // guarded by mLock
@@ -454,10 +457,12 @@ private:
// any use of it is racy anyway.
volatile bool mPolling;
- int mEpollFd; // immutable
+ int mEpollFd; // guarded by mLock but only modified on the looper thread
+ bool mEpollRebuildRequired; // guarded by mLock
// Locked list of file descriptor monitoring requests.
KeyedVector<int, Request> mRequests; // guarded by mLock
+ int mNextRequestSeq;
// This state is only used privately by pollOnce and does not require a lock since
// it runs on a single thread.
@@ -466,13 +471,17 @@ private:
nsecs_t mNextMessageUptime; // set to LLONG_MAX when none
int pollInner(int timeoutMillis);
+ int removeFd(int fd, int seq);
void awoken();
void pushResponse(int events, const Request& request);
+ void rebuildEpollLocked();
+ void scheduleEpollRebuildLocked();
static void initTLSKey();
static void threadDestructor(void *st);
+ static void initEpollEvent(struct epoll_event* eventItem);
};
} // namespace android
-#endif // UTILS_LOOPER_H \ No newline at end of file
+#endif // UTILS_LOOPER_H
diff --git a/libshims/include/utils/VectorImpl.h b/libshims/include/utils/VectorImpl.h
index f5fa742..4dd91fd 100644
--- a/libshims/include/utils/VectorImpl.h
+++ b/libshims/include/utils/VectorImpl.h
@@ -53,12 +53,12 @@ public:
/*! must be called from subclasses destructor */
void finish_vector();
- VectorImpl& operator = (const VectorImpl& rhs);
-
+ VectorImpl& operator = (const VectorImpl& rhs);
+
/*! C-style array access */
inline const void* arrayImpl() const { return mStorage; }
void* editArrayImpl();
-
+
/*! vector stats */
inline size_t size() const { return mCount; }
inline bool isEmpty() const { return mCount == 0; }
@@ -71,7 +71,7 @@ public:
ssize_t appendVector(const VectorImpl& vector);
ssize_t insertArrayAt(const void* array, size_t index, size_t length);
ssize_t appendArray(const void* array, size_t length);
-
+
/*! add/insert/replace items */
ssize_t insertAt(size_t where, size_t numItems = 1);
ssize_t insertAt(const void* item, size_t where, size_t numItems = 1);
@@ -105,16 +105,7 @@ protected:
virtual void do_splat(void* dest, const void* item, size_t num) const = 0;
virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0;
virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0;
-
- virtual void reservedVectorImpl1();
- virtual void reservedVectorImpl2();
- virtual void reservedVectorImpl3();
- virtual void reservedVectorImpl4();
- virtual void reservedVectorImpl5();
- virtual void reservedVectorImpl6();
- virtual void reservedVectorImpl7();
- virtual void reservedVectorImpl8();
-
+
private:
void* _grow(size_t where, size_t amount);
void _shrink(size_t where, size_t amount);
@@ -141,10 +132,10 @@ class SortedVectorImpl : public VectorImpl
{
public:
SortedVectorImpl(size_t itemSize, uint32_t flags);
- SortedVectorImpl(const VectorImpl& rhs);
+ explicit SortedVectorImpl(const VectorImpl& rhs);
virtual ~SortedVectorImpl();
-
- SortedVectorImpl& operator = (const SortedVectorImpl& rhs);
+
+ SortedVectorImpl& operator = (const SortedVectorImpl& rhs);
//! finds the index of an item
ssize_t indexOf(const void* item) const;
@@ -158,22 +149,13 @@ public:
//! merges a vector into this one
ssize_t merge(const VectorImpl& vector);
ssize_t merge(const SortedVectorImpl& vector);
-
+
//! removes an item
ssize_t remove(const void* item);
-
+
protected:
virtual int do_compare(const void* lhs, const void* rhs) const = 0;
- virtual void reservedSortedVectorImpl1();
- virtual void reservedSortedVectorImpl2();
- virtual void reservedSortedVectorImpl3();
- virtual void reservedSortedVectorImpl4();
- virtual void reservedSortedVectorImpl5();
- virtual void reservedSortedVectorImpl6();
- virtual void reservedSortedVectorImpl7();
- virtual void reservedSortedVectorImpl8();
-
private:
ssize_t _indexOrderOf(const void* item, size_t* order = 0) const;