mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-29 04:37:55 +00:00
LibWeb: Add a naive Resource cache
This patch introduces a caching mechanism in ResourceLoader. It's keyed on a LoadRequest object which is what you provide to load_resource() when you want to load a resource. We currently never prune the cache, so resources will stay in there forever. This is obviously not gonna stay that way, but we're just getting started here. :^) This should drastically reduce the number of requests when loading some sites (like Twitter) that reuse the same images over and over.
This commit is contained in:
@@ -29,13 +29,13 @@
|
||||
|
||||
namespace Web {
|
||||
|
||||
NonnullRefPtr<Resource> Resource::create(Badge<ResourceLoader>, const URL& url)
|
||||
NonnullRefPtr<Resource> Resource::create(Badge<ResourceLoader>, const LoadRequest& request)
|
||||
{
|
||||
return adopt(*new Resource(url));
|
||||
return adopt(*new Resource(request));
|
||||
}
|
||||
|
||||
Resource::Resource(const URL& url)
|
||||
: m_url(url)
|
||||
Resource::Resource(const LoadRequest& request)
|
||||
: m_request(request)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user