#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/task_manager/task_manager_table_model.h"
#include <stddef.h>
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/i18n/number_formatting.h"
#include "base/i18n/rtl.h"
#include "base/i18n/time_formatting.h"
#include "base/process/process_handle.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/task_manager/task_manager_interface.h"
#include "chrome/browser/ui/task_manager/task_manager_columns.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/nacl/browser/nacl_browser.h"
#include "components/nacl/common/buildflags.h"
#include "components/nacl/common/nacl_switches.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/common/result_codes.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/base/models/table_model_observer.h"
#include "ui/base/text/bytes_formatting.h"
namespace task_manager {
namespace {
const char kCpuTextFormatString[] = …;
#if BUILDFLAG(IS_MAC)
const int64_t kRefreshTimeMS = 2000;
#else
const int64_t kRefreshTimeMS = …;
#endif
bool IsSharedByGroup(int column_id) { … }
template <class T>
int ValueCompare(T value1, T value2) { … }
template <>
int ValueCompare(double value1, double value2) { … }
int BooleanCompare(bool value1, bool value2) { … }
int OrderUnavailableValue(bool v1, bool v2) { … }
}
class TaskManagerValuesStringifier { … };
TableSortDescriptor::TableSortDescriptor()
: … { … }
TableSortDescriptor::TableSortDescriptor(int col_id, bool ascending)
: … { … }
TaskManagerTableModel::TaskManagerTableModel(TableViewDelegate* delegate)
: … { … }
TaskManagerTableModel::~TaskManagerTableModel() { … }
size_t TaskManagerTableModel::RowCount() { … }
std::u16string TaskManagerTableModel::GetText(size_t row, int column) { … }
ui::ImageModel TaskManagerTableModel::GetIcon(size_t row) { … }
void TaskManagerTableModel::SetObserver(
ui::TableModelObserver* observer) { … }
int TaskManagerTableModel::CompareValues(size_t row1,
size_t row2,
int column_id) { … }
void TaskManagerTableModel::GetRowsGroupRange(size_t row_index,
size_t* out_start,
size_t* out_length) { … }
void TaskManagerTableModel::OnTaskAdded(TaskId id) { … }
void TaskManagerTableModel::OnTaskToBeRemoved(TaskId id) { … }
void TaskManagerTableModel::OnTasksRefreshed(
const TaskIdList& task_ids) { … }
void TaskManagerTableModel::OnActiveTaskFetched(TaskId id) { … }
void TaskManagerTableModel::ActivateTask(size_t row_index) { … }
void TaskManagerTableModel::KillTask(size_t row_index) { … }
void TaskManagerTableModel::UpdateRefreshTypes(int column_id, bool visibility) { … }
bool TaskManagerTableModel::IsTaskKillable(size_t row_index) const { … }
void TaskManagerTableModel::RetrieveSavedColumnsSettingsAndUpdateTable() { … }
void TaskManagerTableModel::StoreColumnsSettings() { … }
void TaskManagerTableModel::ToggleColumnVisibility(int column_id) { … }
std::optional<size_t> TaskManagerTableModel::GetRowForWebContents(
content::WebContents* web_contents) { … }
std::optional<size_t> TaskManagerTableModel::GetRowForActiveTask() { … }
void TaskManagerTableModel::StartUpdating() { … }
void TaskManagerTableModel::StopUpdating() { … }
void TaskManagerTableModel::OnRefresh() { … }
bool TaskManagerTableModel::IsTaskFirstInGroup(size_t row_index) const { … }
}