ソースを参照

LibWeb: Add an alias for FetchAlgorithm's consume-body callback argument

This will make it more convenient in places where the Variant would need
to be re-typed outside of this class.
Timothy Flynn 2 年 前
コミット
cb32bb3502

+ 3 - 1
Userland/Libraries/LibWeb/Fetch/Infrastructure/FetchAlgorithms.h

@@ -20,12 +20,14 @@ class FetchAlgorithms : public JS::Cell {
 
 
 public:
 public:
     struct ConsumeBodyFailureTag { };
     struct ConsumeBodyFailureTag { };
+    using BodyBytes = Variant<Empty, ConsumeBodyFailureTag, ByteBuffer>;
+
     using ProcessRequestBodyChunkLengthFunction = JS::SafeFunction<void(u64)>;
     using ProcessRequestBodyChunkLengthFunction = JS::SafeFunction<void(u64)>;
     using ProcessRequestEndOfBodyFunction = JS::SafeFunction<void()>;
     using ProcessRequestEndOfBodyFunction = JS::SafeFunction<void()>;
     using ProcessEarlyHintsResponseFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>)>;
     using ProcessEarlyHintsResponseFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>)>;
     using ProcessResponseFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>)>;
     using ProcessResponseFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>)>;
     using ProcessResponseEndOfBodyFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>)>;
     using ProcessResponseEndOfBodyFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>)>;
-    using ProcessResponseConsumeBodyFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>, Variant<Empty, ConsumeBodyFailureTag, ByteBuffer>)>;
+    using ProcessResponseConsumeBodyFunction = JS::SafeFunction<void(JS::NonnullGCPtr<Infrastructure::Response>, BodyBytes)>;
 
 
     struct Input {
     struct Input {
         Optional<ProcessRequestBodyChunkLengthFunction> process_request_body_chunk_length;
         Optional<ProcessRequestBodyChunkLengthFunction> process_request_body_chunk_length;