1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:07:34 +00:00

Inspector: Store remote object addresses as uintptr_t instead of String

This commit is contained in:
Andreas Kling 2020-03-05 16:30:27 +01:00
parent fbf345e03e
commit 6d66462254
5 changed files with 8 additions and 8 deletions

View file

@ -42,8 +42,8 @@ public:
RemoteObject* parent { nullptr };
NonnullOwnPtrVector<RemoteObject> children;
String address;
String parent_address;
uintptr_t address { 0 };
uintptr_t parent_address { 0 };
String class_name;
String name;

View file

@ -109,7 +109,7 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, Role rol
return m_object_icon;
}
if (role == Role::Display) {
return String::format("%s{%s}", remote_object->class_name.characters(), remote_object->address.characters());
return String::format("%s{%p}", remote_object->class_name.characters(), remote_object->address);
}
return {};
}

View file

@ -75,7 +75,7 @@ void RemoteObjectPropertyModel::update()
void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& new_value)
{
auto& property = m_properties[index.row()];
uintptr_t address = m_object.json.get("address").to_number<uintptr_t>();
uintptr_t address = m_object.address;
RemoteProcess::the().set_property(address, property.name.to_string(), new_value.to_string());
property.value = new_value.to_string();
did_update();

View file

@ -65,14 +65,14 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response)
auto& object_array = objects.as_array();
NonnullOwnPtrVector<RemoteObject> remote_objects;
HashMap<String, RemoteObject*> objects_by_address;
HashMap<uintptr_t, RemoteObject*> objects_by_address;
for (auto& value : object_array.values()) {
ASSERT(value.is_object());
auto& object = value.as_object();
auto remote_object = make<RemoteObject>();
remote_object->address = object.get("address").to_string();
remote_object->parent_address = object.get("parent").to_string();
remote_object->address = object.get("address").to_number<uintptr_t>();
remote_object->parent_address = object.get("parent").to_number<uintptr_t>();
remote_object->name = object.get("name").to_string();
remote_object->class_name = object.get("class_name").to_string();
remote_object->json = object;

View file

@ -86,7 +86,7 @@ int main(int argc, char** argv)
tree_view.on_activation = [&](auto& index) {
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
properties_table_view.set_model(remote_object->property_model());
remote_process.set_inspected_object(remote_object->json.get("address").to_number<uintptr_t>());
remote_process.set_inspected_object(remote_object->address);
};
window->show();