mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 12:46:06 +00:00
LibGUI: Make clipboard-as-bitmap parsing less data-race-y
This encourages the caller to first fetch data and type atomically, and then parse that, instead of potentially making multiple requests.
This commit is contained in:
parent
55526634b6
commit
b6419f2cf2
Notes:
sideshowbarker
2024-07-18 00:55:40 +09:00
Author: https://github.com/BenWiederhake
Commit: b6419f2cf2
Pull-request: https://github.com/SerenityOS/serenity/pull/10984
Reviewed-by: https://github.com/linusg
3 changed files with 13 additions and 12 deletions
|
@ -32,6 +32,8 @@ public:
|
|||
ByteBuffer data;
|
||||
String mime_type;
|
||||
HashMap<String, String> metadata;
|
||||
|
||||
RefPtr<Gfx::Bitmap> as_bitmap() const;
|
||||
};
|
||||
|
||||
static void initialize(Badge<Application>);
|
||||
|
@ -40,7 +42,6 @@ public:
|
|||
DataAndType data_and_type() const;
|
||||
ByteBuffer data() const { return data_and_type().data; }
|
||||
String mime_type() const { return data_and_type().mime_type; }
|
||||
RefPtr<Gfx::Bitmap> bitmap() const;
|
||||
|
||||
void set_data(ReadonlyBytes data, String const& mime_type = "text/plain", HashMap<String, String> const& metadata = {});
|
||||
void set_plain_text(String const& text) { set_data(text.bytes()); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue