libui: Remove STL from Fence
Renames Fence::hasSignaled to Fence::getStatus, and changes its return
type from std::experimental::optional (STL is no longer permitted in
libui) to an enum class. Also updates its one caller.
Test: Builds and sailfish boots
Change-Id: I682039b9fd88bf79f1e2a955944c4a564ed6f60b
diff --git a/include/ui/Fence.h b/include/ui/Fence.h
index 58df24c..37811bc 100644
--- a/include/ui/Fence.h
+++ b/include/ui/Fence.h
@@ -23,8 +23,6 @@
#include <utils/RefBase.h>
#include <utils/Timers.h>
-#include <experimental/optional>
-
namespace android {
class String8;
@@ -105,26 +103,29 @@
// error occurs then SIGNAL_TIME_INVALID is returned.
nsecs_t getSignalTime() const;
-#if __cplusplus > 201103L
- // hasSignaled returns whether the fence has signaled yet. Prefer this to
+ enum class Status {
+ Invalid, // Fence is invalid
+ Unsignaled, // Fence is valid but has not yet signaled
+ Signaled, // Fence is valid and has signaled
+ };
+
+ // getStatus() returns whether the fence has signaled yet. Prefer this to
// getSignalTime() or wait() if all you care about is whether the fence has
- // signaled. Returns an optional bool, which will have a value if there was
- // no error.
- inline std::experimental::optional<bool> hasSignaled() {
+ // signaled.
+ inline Status getStatus() {
// The sync_wait call underlying wait() has been measured to be
// significantly faster than the sync_fence_info call underlying
// getSignalTime(), which might otherwise appear to be the more obvious
// way to check whether a fence has signaled.
switch (wait(0)) {
case NO_ERROR:
- return true;
+ return Status::Signaled;
case -ETIME:
- return false;
+ return Status::Unsignaled;
default:
- return {};
+ return Status::Invalid;
}
}
-#endif
// Flattenable interface
size_t getFlattenedSize() const;