summaryrefslogtreecommitdiffstats
path: root/dom/canvas/WebGLIpdl.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/canvas/WebGLIpdl.h
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/WebGLIpdl.h')
-rw-r--r--dom/canvas/WebGLIpdl.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/canvas/WebGLIpdl.h b/dom/canvas/WebGLIpdl.h
index 45a5c5ad64..4c81393b70 100644
--- a/dom/canvas/WebGLIpdl.h
+++ b/dom/canvas/WebGLIpdl.h
@@ -18,6 +18,8 @@
#include "TupleUtils.h"
#include "WebGLTypes.h"
+#include <memory>
+
namespace mozilla {
namespace webgl {
@@ -652,6 +654,32 @@ struct ParamTraits<mozilla::avec3<U>> final {
}
};
+// -
+
+template <class U>
+struct ParamTraits<std::optional<U>> final {
+ using T = std::optional<U>;
+
+ static void Write(MessageWriter* const writer, const T& in) {
+ WriteParam(writer, bool{in});
+ if (in) {
+ WriteParam(writer, *in);
+ }
+ }
+
+ static bool Read(MessageReader* const reader, T* const out) {
+ bool isSome;
+ if (!ReadParam(reader, &isSome)) return false;
+
+ if (!isSome) {
+ out->reset();
+ return true;
+ }
+ out->emplace();
+ return ReadParam(reader, &**out);
+ }
+};
+
} // namespace IPC
#endif