mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	 03256a2543
			
		
	
	
		03256a2543
		
	
	
	
	
		
			
			Note that it's not actually executing tasks in parallel, it's still throwing them on the HTML event loop task queue, each with its own unique task source. This makes our fetch implementation a lot more robust when HTTP caching is enabled, and you can now click links on https://terminal.shop/ without hitting TODO assertions in fetch.
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2024, Kenneth Myhra <kennethmyhra@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/Fetch/Infrastructure/HTTP/Bodies.h>
 | |
| #include <LibWeb/Streams/ReadableStreamDefaultReader.h>
 | |
| 
 | |
| namespace Web::Fetch::Infrastructure {
 | |
| 
 | |
| // https://fetch.spec.whatwg.org/#incrementally-read-loop
 | |
| class IncrementalReadLoopReadRequest : public Streams::ReadRequest {
 | |
|     GC_CELL(IncrementalReadLoopReadRequest, Streams::ReadRequest);
 | |
|     GC_DECLARE_ALLOCATOR(IncrementalReadLoopReadRequest);
 | |
| 
 | |
| public:
 | |
|     IncrementalReadLoopReadRequest(GC::Ref<Body>, GC::Ref<Streams::ReadableStreamDefaultReader>, TaskDestination, Body::ProcessBodyChunkCallback, Body::ProcessEndOfBodyCallback, Body::ProcessBodyErrorCallback);
 | |
| 
 | |
|     virtual void on_chunk(JS::Value chunk) override;
 | |
|     virtual void on_close() override;
 | |
|     virtual void on_error(JS::Value error) override;
 | |
| 
 | |
| private:
 | |
|     virtual void visit_edges(Visitor&) override;
 | |
| 
 | |
|     GC::Ref<Body> m_body;
 | |
|     GC::Ref<Streams::ReadableStreamDefaultReader> m_reader;
 | |
|     TaskDestination m_task_destination;
 | |
|     Body::ProcessBodyChunkCallback m_process_body_chunk;
 | |
|     Body::ProcessEndOfBodyCallback m_process_end_of_body;
 | |
|     Body::ProcessBodyErrorCallback m_process_body_error;
 | |
| };
 | |
| 
 | |
| }
 |