mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
Inspector: Store remote object addresses as uintptr_t instead of String
This commit is contained in:
parent
fbf345e03e
commit
6d66462254
5 changed files with 8 additions and 8 deletions
|
@ -42,8 +42,8 @@ public:
|
||||||
RemoteObject* parent { nullptr };
|
RemoteObject* parent { nullptr };
|
||||||
NonnullOwnPtrVector<RemoteObject> children;
|
NonnullOwnPtrVector<RemoteObject> children;
|
||||||
|
|
||||||
String address;
|
uintptr_t address { 0 };
|
||||||
String parent_address;
|
uintptr_t parent_address { 0 };
|
||||||
String class_name;
|
String class_name;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, Role rol
|
||||||
return m_object_icon;
|
return m_object_icon;
|
||||||
}
|
}
|
||||||
if (role == Role::Display) {
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ void RemoteObjectPropertyModel::update()
|
||||||
void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& new_value)
|
void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& new_value)
|
||||||
{
|
{
|
||||||
auto& property = m_properties[index.row()];
|
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());
|
RemoteProcess::the().set_property(address, property.name.to_string(), new_value.to_string());
|
||||||
property.value = new_value.to_string();
|
property.value = new_value.to_string();
|
||||||
did_update();
|
did_update();
|
||||||
|
|
|
@ -65,14 +65,14 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response)
|
||||||
auto& object_array = objects.as_array();
|
auto& object_array = objects.as_array();
|
||||||
|
|
||||||
NonnullOwnPtrVector<RemoteObject> remote_objects;
|
NonnullOwnPtrVector<RemoteObject> remote_objects;
|
||||||
HashMap<String, RemoteObject*> objects_by_address;
|
HashMap<uintptr_t, RemoteObject*> objects_by_address;
|
||||||
|
|
||||||
for (auto& value : object_array.values()) {
|
for (auto& value : object_array.values()) {
|
||||||
ASSERT(value.is_object());
|
ASSERT(value.is_object());
|
||||||
auto& object = value.as_object();
|
auto& object = value.as_object();
|
||||||
auto remote_object = make<RemoteObject>();
|
auto remote_object = make<RemoteObject>();
|
||||||
remote_object->address = object.get("address").to_string();
|
remote_object->address = object.get("address").to_number<uintptr_t>();
|
||||||
remote_object->parent_address = object.get("parent").to_string();
|
remote_object->parent_address = object.get("parent").to_number<uintptr_t>();
|
||||||
remote_object->name = object.get("name").to_string();
|
remote_object->name = object.get("name").to_string();
|
||||||
remote_object->class_name = object.get("class_name").to_string();
|
remote_object->class_name = object.get("class_name").to_string();
|
||||||
remote_object->json = object;
|
remote_object->json = object;
|
||||||
|
|
|
@ -86,7 +86,7 @@ int main(int argc, char** argv)
|
||||||
tree_view.on_activation = [&](auto& index) {
|
tree_view.on_activation = [&](auto& index) {
|
||||||
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
|
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
|
||||||
properties_table_view.set_model(remote_object->property_model());
|
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();
|
window->show();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue