mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:07:35 +00:00
LibCore+AK: Move MappedFile from AK to LibCore
MappedFile is strictly a userspace thing, so it doesn't belong in AK (which is supposed to be user/kernel agnostic.)
This commit is contained in:
parent
c1c9da6c35
commit
58fb3ebf66
48 changed files with 101 additions and 103 deletions
|
@ -72,7 +72,7 @@ ErrorOr<StringView> ManualModel::page_view(String const& path) const
|
|||
return StringView { mapped_file.value()->bytes() };
|
||||
}
|
||||
|
||||
auto file = TRY(MappedFile::map(path));
|
||||
auto file = TRY(Core::MappedFile::map(path));
|
||||
|
||||
StringView view { file->bytes() };
|
||||
m_mapped_files.set(path, move(file));
|
||||
|
|
|
@ -41,5 +41,5 @@ private:
|
|||
GUI::Icon m_section_open_icon;
|
||||
GUI::Icon m_section_icon;
|
||||
GUI::Icon m_page_icon;
|
||||
mutable HashMap<String, NonnullRefPtr<MappedFile>> m_mapped_files;
|
||||
mutable HashMap<String, NonnullRefPtr<Core::MappedFile>> m_mapped_files;
|
||||
};
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
#include "ViewWidget.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -243,7 +243,7 @@ void ViewWidget::load_from_file(const String& path)
|
|||
GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image", GUI::MessageBox::Type::Error);
|
||||
};
|
||||
|
||||
auto file_or_error = MappedFile::map(path);
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error()) {
|
||||
show_error();
|
||||
return;
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include <AK/JsonObjectSerializer.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/BMPWriter.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#include "Image.h"
|
||||
#include "Layer.h"
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/Result.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibImageDecoderClient/Client.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
@ -29,7 +29,7 @@ ErrorOr<void> ProjectLoader::try_load_from_fd_and_close(int fd, StringView path)
|
|||
if (json_or_error.is_error()) {
|
||||
m_is_raw_image = true;
|
||||
|
||||
auto mapped_file = TRY(MappedFile::map_from_fd_and_close(fd, path));
|
||||
auto mapped_file = TRY(Core::MappedFile::map_from_fd_and_close(fd, path));
|
||||
|
||||
// FIXME: Find a way to avoid the memory copy here.
|
||||
auto bitmap = TRY(Image::try_decode_bitmap(mapped_file->bytes()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue