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

Everywhere: Stop using NonnullOwnPtrVector

Same as NonnullRefPtrVector: weird semantics, questionable benefits.
This commit is contained in:
Andreas Kling 2023-03-06 17:16:25 +01:00
parent 689ca370d4
commit 359d6e7b0b
111 changed files with 517 additions and 503 deletions

View file

@ -21,7 +21,7 @@ public:
RemoteObjectPropertyModel& property_model();
RemoteObject* parent { nullptr };
NonnullOwnPtrVector<RemoteObject> children;
Vector<NonnullOwnPtr<RemoteObject>> children;
FlatPtr address { 0 };
FlatPtr parent_address { 0 };

View file

@ -45,7 +45,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde
// NOTE: If the parent has no parent, it's a root, so we have to look among the remote roots.
if (!remote_object.parent->parent) {
for (size_t row = 0; row < m_process.roots().size(); ++row) {
if (&m_process.roots()[row] == remote_object.parent)
if (m_process.roots()[row] == remote_object.parent)
return create_index(row, 0, remote_object.parent);
}
VERIFY_NOT_REACHED();
@ -53,7 +53,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde
}
for (size_t row = 0; row < remote_object.parent->parent->children.size(); ++row) {
if (&remote_object.parent->parent->children[row] == remote_object.parent)
if (remote_object.parent->parent->children[row] == remote_object.parent)
return create_index(row, 0, remote_object.parent);
}

View file

@ -111,7 +111,7 @@ GUI::ModelIndex RemoteObjectPropertyModel::index(int row, int column, const GUI:
} else {
return nullptr;
}
return &m_paths.last();
return m_paths.last();
};
if (!parent.is_valid()) {
@ -176,16 +176,16 @@ JsonPath const* RemoteObjectPropertyModel::cached_path_at(int n, Vector<JsonPath
JsonPath const* index_path = nullptr;
int row_index = n;
for (auto& path : m_paths) {
if (path.size() != prefix.size() + 1)
if (path->size() != prefix.size() + 1)
continue;
for (size_t i = 0; i < prefix.size(); ++i) {
if (path[i] != prefix[i])
if ((*path)[i] != prefix[i])
goto do_continue;
}
if (row_index == 0) {
index_path = &path;
index_path = path;
break;
}
--row_index;
@ -198,15 +198,15 @@ JsonPath const* RemoteObjectPropertyModel::cached_path_at(int n, Vector<JsonPath
JsonPath const* RemoteObjectPropertyModel::find_cached_path(Vector<JsonPathElement> const& path) const
{
for (auto& cpath : m_paths) {
if (cpath.size() != path.size())
if (cpath->size() != path.size())
continue;
for (size_t i = 0; i < cpath.size(); ++i) {
if (cpath[i] != path[i])
for (size_t i = 0; i < cpath->size(); ++i) {
if ((*cpath)[i] != path[i])
goto do_continue;
}
return &cpath;
return cpath;
do_continue:;
}

View file

@ -45,7 +45,7 @@ private:
JsonPath const* find_cached_path(Vector<JsonPathElement> const& path) const;
RemoteObject& m_object;
mutable NonnullOwnPtrVector<JsonPath> m_paths;
mutable Vector<NonnullOwnPtr<JsonPath>> m_paths;
};
}

View file

@ -42,7 +42,7 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
// FIXME: It would be good if we didn't have to make a local copy of the array value here!
auto& object_array = response.get_array("objects"sv).value();
NonnullOwnPtrVector<RemoteObject> remote_objects;
Vector<NonnullOwnPtr<RemoteObject>> remote_objects;
HashMap<FlatPtr, RemoteObject*> objects_by_address;
for (auto& value : object_array.values()) {
@ -59,7 +59,7 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
}
for (size_t i = 0; i < remote_objects.size(); ++i) {
auto& remote_object = remote_objects.ptr_at(i);
auto& remote_object = remote_objects[i];
auto* parent = objects_by_address.get(remote_object->parent_address).value_or(nullptr);
if (!parent) {
m_roots.append(move(remote_object));

View file

@ -25,7 +25,7 @@ public:
DeprecatedString const& process_name() const { return m_process_name; }
RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; }
NonnullOwnPtrVector<RemoteObject> const& roots() const { return m_roots; }
Vector<NonnullOwnPtr<RemoteObject>> const& roots() const { return m_roots; }
void set_inspected_object(FlatPtr);
@ -42,7 +42,7 @@ private:
pid_t m_pid { -1 };
DeprecatedString m_process_name;
NonnullRefPtr<RemoteObjectGraphModel> m_object_graph_model;
NonnullOwnPtrVector<RemoteObject> m_roots;
Vector<NonnullOwnPtr<RemoteObject>> m_roots;
RefPtr<InspectorServerClient> m_client;
};