mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibWeb: Share decoded images at the Resource level :^)
This patch adds ImageResource as a subclass of Resource. This new class also keeps a Gfx::ImageDecoder so that we can share decoded bitmaps between all clients of an image resource inside LibWeb. With this, we now share both encoded and decoded data for images. :^) I had to change how the purgeable-volatile flag is updated to keep the volatile-images-outside-the-visible-viewport optimization working. HTMLImageElement now inherits from ImageResourceClient (a subclass of ResourceClient with additional image-specific stuff) and informs its ImageResource about whether it's inside the viewport or outside. This is pretty awesome! :^)
This commit is contained in:
parent
1c6e4e04a8
commit
d4ddb0013c
14 changed files with 200 additions and 30 deletions
|
@ -29,7 +29,7 @@
|
|||
#include <AK/Function.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Loader/Resource.h>
|
||||
|
||||
namespace Protocol {
|
||||
class Client;
|
||||
|
@ -42,7 +42,7 @@ class ResourceLoader : public Core::Object {
|
|||
public:
|
||||
static ResourceLoader& the();
|
||||
|
||||
RefPtr<Resource> load_resource(const LoadRequest&);
|
||||
RefPtr<Resource> load_resource(Resource::Type, const LoadRequest&);
|
||||
|
||||
void load(const URL&, Function<void(const ByteBuffer&, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers)> success_callback, Function<void(const String&)> error_callback = nullptr);
|
||||
void load_sync(const URL&, Function<void(const ByteBuffer&, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers)> success_callback, Function<void(const String&)> error_callback = nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue