mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
SystemMonitor: Invalidate ProcessModel indexes when necessary
If the process table grows or shrinks, we need to invalidate all the ProcessModel indexes. This is not great, but it's the most precise invalidation we can do at the moment.
This commit is contained in:
parent
17992fbab7
commit
b9ae937279
Notes:
sideshowbarker
2024-07-19 03:33:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b9ae937279e
1 changed files with 4 additions and 1 deletions
|
@ -352,6 +352,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, Role role) const
|
|||
|
||||
void ProcessModel::update()
|
||||
{
|
||||
auto previous_pid_count = m_pids.size();
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
|
||||
unsigned last_sum_times_scheduled = 0;
|
||||
|
@ -434,5 +435,7 @@ void ProcessModel::update()
|
|||
if (on_cpu_info_change)
|
||||
on_cpu_info_change(m_cpus);
|
||||
|
||||
did_update(GUI::Model::UpdateFlag::DontInvalidateIndexes);
|
||||
// FIXME: This is a rather hackish way of invalidating indexes.
|
||||
// It would be good if GUI::Model had a way to orchestrate removal/insertion while preserving indexes.
|
||||
did_update(previous_pid_count == m_pids.size() ? GUI::Model::UpdateFlag::DontInvalidateIndexes : GUI::Model::UpdateFlag::InvalidateAllIndexes);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue