libgui: disallow NULL Fence pointers
This change eliminates the uses of a NULL sp<Fence> indicating that no waiting
is required. Instead we use a non-NULL but invalid Fence object for which the
wait methods will return immediately.
Bug: 7892871
Change-Id: I5360aebe3090422ef6920d56c99fc4eedc642e48
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index ba23f9e..09831fb 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -117,6 +117,7 @@
GLenum texTarget, bool useFenceSync, const sp<BufferQueue> &bufferQueue) :
ConsumerBase(bufferQueue == 0 ? new BufferQueue(allowSynchronousMode) : bufferQueue),
mCurrentTransform(0),
+ mCurrentFence(Fence::NO_FENCE),
mCurrentTimestamp(0),
mFilteringEnabled(true),
mTexName(tex),
@@ -823,7 +824,7 @@
return INVALID_OPERATION;
}
- if (mCurrentFence != NULL) {
+ if (mCurrentFence->isValid()) {
if (useWaitSync) {
// Create an EGLSyncKHR from the current fence.
int fenceFd = mCurrentFence->dup();