mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Make Blob and File GC-allocated
This commit is contained in:
parent
018d236439
commit
647ac1bdba
10 changed files with 77 additions and 61 deletions
|
@ -16,12 +16,13 @@ struct FilePropertyBag : BlobPropertyBag {
|
|||
};
|
||||
|
||||
class File : public Blob {
|
||||
WEB_PLATFORM_OBJECT(File, Blob);
|
||||
|
||||
public:
|
||||
using WrapperType = Bindings::FileWrapper;
|
||||
static DOM::ExceptionOr<JS::NonnullGCPtr<File>> create(HTML::Window&, Vector<BlobPart> const& file_bits, String const& file_name, Optional<FilePropertyBag> const& options = {});
|
||||
static DOM::ExceptionOr<JS::NonnullGCPtr<File>> create_with_global_object(HTML::Window&, Vector<BlobPart> const& file_bits, String const& file_name, Optional<FilePropertyBag> const& options = {});
|
||||
|
||||
static DOM::ExceptionOr<NonnullRefPtr<File>> create(Vector<BlobPart> const& file_bits, String const& file_name, Optional<FilePropertyBag> const& options = {});
|
||||
static DOM::ExceptionOr<NonnullRefPtr<File>> create_with_global_object(HTML::Window&, Vector<BlobPart> const& file_bits, String const& file_name, Optional<FilePropertyBag> const& options = {});
|
||||
virtual ~File() override;
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dfn-name
|
||||
String const& name() const { return m_name; }
|
||||
|
@ -29,10 +30,12 @@ public:
|
|||
i64 last_modified() const { return m_last_modified; }
|
||||
|
||||
private:
|
||||
File(ByteBuffer byte_buffer, String file_name, String type, i64 last_modified);
|
||||
File(HTML::Window&, ByteBuffer, String file_name, String type, i64 last_modified);
|
||||
|
||||
String m_name;
|
||||
i64 m_last_modified { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(File, Web::FileAPI)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue