diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-05 16:30:27 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-05 16:31:03 +0100 |
commit | 6d66462254089112d9acf3d564bc3cb6c0b23191 (patch) | |
tree | a197521b5e6e1bb970092a4dab7a5599f75ff235 | |
parent | fbf345e03e3aaf2e98924dee96de736291f68d3f (diff) | |
download | serenity-6d66462254089112d9acf3d564bc3cb6c0b23191.zip |
Inspector: Store remote object addresses as uintptr_t instead of String
-rw-r--r-- | DevTools/Inspector/RemoteObject.h | 4 | ||||
-rw-r--r-- | DevTools/Inspector/RemoteObjectGraphModel.cpp | 2 | ||||
-rw-r--r-- | DevTools/Inspector/RemoteObjectPropertyModel.cpp | 2 | ||||
-rw-r--r-- | DevTools/Inspector/RemoteProcess.cpp | 6 | ||||
-rw-r--r-- | DevTools/Inspector/main.cpp | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/DevTools/Inspector/RemoteObject.h b/DevTools/Inspector/RemoteObject.h index b0f7291f32..b8d5d680ca 100644 --- a/DevTools/Inspector/RemoteObject.h +++ b/DevTools/Inspector/RemoteObject.h @@ -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; diff --git a/DevTools/Inspector/RemoteObjectGraphModel.cpp b/DevTools/Inspector/RemoteObjectGraphModel.cpp index 3f5b7d528f..d6df44161b 100644 --- a/DevTools/Inspector/RemoteObjectGraphModel.cpp +++ b/DevTools/Inspector/RemoteObjectGraphModel.cpp @@ -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 {}; } diff --git a/DevTools/Inspector/RemoteObjectPropertyModel.cpp b/DevTools/Inspector/RemoteObjectPropertyModel.cpp index 91cd6cca0c..c4e69a16f3 100644 --- a/DevTools/Inspector/RemoteObjectPropertyModel.cpp +++ b/DevTools/Inspector/RemoteObjectPropertyModel.cpp @@ -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(); diff --git a/DevTools/Inspector/RemoteProcess.cpp b/DevTools/Inspector/RemoteProcess.cpp index 66a412d8a9..9f3adab9a7 100644 --- a/DevTools/Inspector/RemoteProcess.cpp +++ b/DevTools/Inspector/RemoteProcess.cpp @@ -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; diff --git a/DevTools/Inspector/main.cpp b/DevTools/Inspector/main.cpp index e0d715a0cc..1b4e583293 100644 --- a/DevTools/Inspector/main.cpp +++ b/DevTools/Inspector/main.cpp @@ -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(); |