diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-17 00:14:37 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-17 00:14:37 +0100 |
commit | 5522e8f59d2a175fb6096f5143d659b742370dc2 (patch) | |
tree | 2320f825fbcbacc992cd8eaa82d32b33aee8a1a7 /Userland/Services/Clipboard/Storage.h | |
parent | 1cb44ec5eebb7a1766ff9ec67665ece8c2a9f1fe (diff) | |
download | serenity-5522e8f59d2a175fb6096f5143d659b742370dc2.zip |
Clipboard+LibGUI: Move clipboard service to anonymous files
Diffstat (limited to 'Userland/Services/Clipboard/Storage.h')
-rw-r--r-- | Userland/Services/Clipboard/Storage.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Userland/Services/Clipboard/Storage.h b/Userland/Services/Clipboard/Storage.h index ce194c15f4..82f7408fda 100644 --- a/Userland/Services/Clipboard/Storage.h +++ b/Userland/Services/Clipboard/Storage.h @@ -28,8 +28,8 @@ #include <AK/Function.h> #include <AK/HashMap.h> -#include <AK/SharedBuffer.h> #include <AK/String.h> +#include <LibCore/AnonymousBuffer.h> namespace Clipboard { @@ -38,7 +38,7 @@ public: static Storage& the(); ~Storage(); - bool has_data() const { return m_shared_buffer; } + bool has_data() const { return m_buffer.is_valid(); } const String& mime_type() const { return m_mime_type; } const HashMap<String, String>& metadata() const { return m_metadata; } @@ -47,7 +47,7 @@ public: { if (!has_data()) return nullptr; - return m_shared_buffer->data<u8>(); + return m_buffer.data<u8>(); } size_t data_size() const @@ -57,15 +57,17 @@ public: return 0; } - void set_data(NonnullRefPtr<SharedBuffer>, size_t data_size, const String& mime_type, const HashMap<String, String>& metadata); + void set_data(Core::AnonymousBuffer, const String& mime_type, const HashMap<String, String>& metadata); Function<void()> on_content_change; + const Core::AnonymousBuffer& buffer() const { return m_buffer; } + private: Storage(); String m_mime_type; - RefPtr<SharedBuffer> m_shared_buffer; + Core::AnonymousBuffer m_buffer; size_t m_data_size { 0 }; HashMap<String, String> m_metadata; }; |