diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-02 20:27:26 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-02 20:32:38 +0200 |
commit | d4ddb0013cda7a8ef59e01883c643cac53448ef6 (patch) | |
tree | 752128ff443b89bb1f15c3f785396535747d4ed3 /Libraries/LibWeb/Loader/ResourceLoader.h | |
parent | 1c6e4e04a8c02b27d24d65a99df3faa83762d5b9 (diff) | |
download | serenity-d4ddb0013cda7a8ef59e01883c643cac53448ef6.zip |
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! :^)
Diffstat (limited to 'Libraries/LibWeb/Loader/ResourceLoader.h')
-rw-r--r-- | Libraries/LibWeb/Loader/ResourceLoader.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibWeb/Loader/ResourceLoader.h b/Libraries/LibWeb/Loader/ResourceLoader.h index 34968790c3..bd3591e5d9 100644 --- a/Libraries/LibWeb/Loader/ResourceLoader.h +++ b/Libraries/LibWeb/Loader/ResourceLoader.h @@ -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); |