mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:47:46 +00:00
ProtocolServer: Send the download payload to clients as a shared buffer
The DownloadFinished message from the server now includes a buffer ID that can be mapped into the client program. To avoid prematurely destroying the buffer, the server will hang on to it until the client lets it know that they're all good. That's what the ProtocolServer::DisownSharedBuffer message is about. In the future it would be nice if the kernel had a mechanism to allow passing ownership of a shared buffer along with an IPC message somehow.
This commit is contained in:
parent
88c5126fa7
commit
eb85103271
10 changed files with 47 additions and 6 deletions
|
@ -17,6 +17,7 @@ public:
|
|||
|
||||
size_t total_size() const { return m_total_size; }
|
||||
size_t downloaded_size() const { return m_downloaded_size; }
|
||||
const ByteBuffer& payload() const { return m_payload; }
|
||||
|
||||
void stop();
|
||||
|
||||
|
@ -25,11 +26,13 @@ protected:
|
|||
|
||||
void did_finish(bool success);
|
||||
void did_progress(size_t total_size, size_t downloaded_size);
|
||||
void set_payload(const ByteBuffer&);
|
||||
|
||||
private:
|
||||
i32 m_id;
|
||||
URL m_url;
|
||||
size_t m_total_size { 0 };
|
||||
size_t m_downloaded_size { 0 };
|
||||
ByteBuffer m_payload;
|
||||
WeakPtr<PSClientConnection> m_client;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue