summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-09-07 18:52:06 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-07 18:52:06 -0700
commit347262622b86410ff8a4ff3530ab3688b6a20b21 (patch)
treef596d33ff54ab5169a7c52e19319b63d0e200e63 /libs
parent7dea769319701f4e883fc448507967b806b9b245 (diff)
parenta1205f07a6f0c745e8f42f16fe38c06af04143c7 (diff)
downloadframeworks_base-347262622b86410ff8a4ff3530ab3688b6a20b21.zip
frameworks_base-347262622b86410ff8a4ff3530ab3688b6a20b21.tar.gz
frameworks_base-347262622b86410ff8a4ff3530ab3688b6a20b21.tar.bz2
am a1205f07: am 2d3739d4: Merge "Modify native ALooper to take an explicit ident." into gingerbread
Merge commit 'a1205f07a6f0c745e8f42f16fe38c06af04143c7' * commit 'a1205f07a6f0c745e8f42f16fe38c06af04143c7': Modify native ALooper to take an explicit ident.
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/SensorEventQueue.cpp2
-rw-r--r--libs/utils/PollLoop.cpp19
2 files changed, 14 insertions, 7 deletions
diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
index 3396f25..7eb6da5 100644
--- a/libs/gui/SensorEventQueue.cpp
+++ b/libs/gui/SensorEventQueue.cpp
@@ -86,7 +86,7 @@ sp<PollLoop> SensorEventQueue::getPollLoop() const
Mutex::Autolock _l(mLock);
if (mPollLoop == 0) {
mPollLoop = new PollLoop(true);
- mPollLoop->setCallback(getFd(), POLLIN, NULL, NULL);
+ mPollLoop->setCallback(getFd(), getFd(), POLLIN, NULL, NULL);
}
return mPollLoop;
}
diff --git a/libs/utils/PollLoop.cpp b/libs/utils/PollLoop.cpp
index f740fa0..6d3eeee 100644
--- a/libs/utils/PollLoop.cpp
+++ b/libs/utils/PollLoop.cpp
@@ -95,6 +95,7 @@ void PollLoop::openWakePipe() {
RequestedCallback requestedCallback;
requestedCallback.callback = NULL;
requestedCallback.looperCallback = NULL;
+ requestedCallback.ident = 0;
requestedCallback.data = NULL;
mRequestedCallbacks.insertAt(requestedCallback, 0);
}
@@ -116,7 +117,7 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) {
mPendingFdsPos++;
if (outEvents != NULL) *outEvents = pending.events;
if (outData != NULL) *outData = pending.data;
- return pending.fd;
+ return pending.ident;
}
mLock.lock();
@@ -182,6 +183,7 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) {
const RequestedCallback& requestedCallback = mRequestedCallbacks.itemAt(i);
PendingCallback pending;
pending.fd = requestedFd.fd;
+ pending.ident = requestedCallback.ident;
pending.events = revents;
pending.callback = requestedCallback.callback;
pending.looperCallback = requestedCallback.looperCallback;
@@ -191,7 +193,7 @@ int32_t PollLoop::pollOnce(int timeoutMillis, int* outEvents, void** outData) {
mPendingCallbacks.push(pending);
} else if (pending.fd != mWakeReadPipeFd) {
if (result == POLL_CALLBACK) {
- result = pending.fd;
+ result = pending.ident;
if (outEvents != NULL) *outEvents = pending.events;
if (outData != NULL) *outData = pending.data;
} else {
@@ -268,16 +270,20 @@ bool PollLoop::getAllowNonCallbacks() const {
return mAllowNonCallbacks;
}
+void PollLoop::setCallback(int fd, int ident, int events, Callback callback, void* data) {
+ setCallbackCommon(fd, ident, events, callback, NULL, data);
+}
+
void PollLoop::setCallback(int fd, int events, Callback callback, void* data) {
- setCallbackCommon(fd, events, callback, NULL, data);
+ setCallbackCommon(fd, POLL_CALLBACK, events, callback, NULL, data);
}
-void PollLoop::setLooperCallback(int fd, int events, ALooper_callbackFunc* callback,
+void PollLoop::setLooperCallback(int fd, int ident, int events, ALooper_callbackFunc* callback,
void* data) {
- setCallbackCommon(fd, events, NULL, callback, data);
+ setCallbackCommon(fd, ident, events, NULL, callback, data);
}
-void PollLoop::setCallbackCommon(int fd, int events, Callback callback,
+void PollLoop::setCallbackCommon(int fd, int ident, int events, Callback callback,
ALooper_callbackFunc* looperCallback, void* data) {
#if DEBUG_CALLBACKS
@@ -305,6 +311,7 @@ void PollLoop::setCallbackCommon(int fd, int events, Callback callback,
RequestedCallback requestedCallback;
requestedCallback.callback = callback;
requestedCallback.looperCallback = looperCallback;
+ requestedCallback.ident = ident;
requestedCallback.data = data;
ssize_t index = getRequestIndexLocked(fd);