mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:37:34 +00:00
LibProtocol+LibWebView: Allow callers provide their own RequestClient
This will be used by Ladybird when it spawns its RequestServer in a Lagom-specific way rather than using SystemServer to do it.
This commit is contained in:
parent
28d3d3c9fc
commit
ec3267e002
3 changed files with 11 additions and 5 deletions
|
@ -68,10 +68,15 @@ void RequestServerRequestAdapter::stream_into(Stream& stream)
|
|||
m_request->stream_into(stream);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<RequestServerAdapter>> RequestServerAdapter::try_create(NonnullRefPtr<Protocol::RequestClient> protocol_client)
|
||||
{
|
||||
return try_make_ref_counted<RequestServerAdapter>(move(protocol_client));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<RequestServerAdapter>> RequestServerAdapter::try_create()
|
||||
{
|
||||
auto protocol_client = TRY(Protocol::RequestClient::try_create());
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) RequestServerAdapter(move(protocol_client)));
|
||||
return try_make_ref_counted<RequestServerAdapter>(move(protocol_client));
|
||||
}
|
||||
|
||||
RequestServerAdapter::RequestServerAdapter(NonnullRefPtr<Protocol::RequestClient> protocol_client)
|
||||
|
|
|
@ -36,6 +36,9 @@ private:
|
|||
|
||||
class RequestServerAdapter : public Web::ResourceLoaderConnector {
|
||||
public:
|
||||
explicit RequestServerAdapter(NonnullRefPtr<Protocol::RequestClient> protocol_client);
|
||||
|
||||
static ErrorOr<NonnullRefPtr<RequestServerAdapter>> try_create(NonnullRefPtr<Protocol::RequestClient>);
|
||||
static ErrorOr<NonnullRefPtr<RequestServerAdapter>> try_create();
|
||||
virtual ~RequestServerAdapter() override;
|
||||
|
||||
|
@ -45,8 +48,6 @@ public:
|
|||
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(DeprecatedString const& method, URL const&, HashMap<DeprecatedString, DeprecatedString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) override;
|
||||
|
||||
private:
|
||||
RequestServerAdapter(NonnullRefPtr<Protocol::RequestClient> protocol_client);
|
||||
|
||||
RefPtr<Protocol::RequestClient> m_protocol_client;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue