mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
SystemMonitor: Prefer File::read_until_eof over DeprecatedFile
Because MemoryStatsWidget::refresh is run nearly directly by the EventLoop, the only real alternative to crashing would be to cancel the update, and keep the old data. That doesn't sound sufficiently better to warrant being implemented.
This commit is contained in:
parent
fbb4887d9c
commit
41b45d5599
Notes:
sideshowbarker
2024-07-17 07:06:47 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/41b45d5599 Pull-request: https://github.com/SerenityOS/serenity/pull/18844 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/krkk
1 changed files with 2 additions and 5 deletions
|
@ -9,7 +9,6 @@
|
|||
#include "GraphWidget.h"
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Label.h>
|
||||
|
@ -102,11 +101,9 @@ static inline u64 page_count_to_bytes(size_t count)
|
|||
|
||||
void MemoryStatsWidget::refresh()
|
||||
{
|
||||
auto proc_memstat = Core::DeprecatedFile::construct("/sys/kernel/memstat");
|
||||
if (!proc_memstat->open(Core::OpenMode::ReadOnly))
|
||||
VERIFY_NOT_REACHED();
|
||||
auto proc_memstat = Core::File::open("/sys/kernel/memstat"sv, Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto file_contents = proc_memstat->read_all();
|
||||
auto file_contents = proc_memstat->read_until_eof().release_value_but_fixme_should_propagate_errors();
|
||||
auto json_result = JsonValue::from_string(file_contents).release_value_but_fixme_should_propagate_errors();
|
||||
auto const& json = json_result.as_object();
|
||||
|
||||
|
|
Loading…
Reference in a new issue