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

LibCore: Don't needlessly use StringView in Core::Object APIs

Taking a StringView parameter that gets immediately converted to
a String anyway is silly. Just take a String directly instead.

This pattern is the main reason we have the "StringView internal
StringImpl pointer" optimization, and I suspect that we can throw
that whole thing out if we make a couple more patches like this.
This commit is contained in:
Andreas Kling 2021-04-16 19:59:31 +02:00
parent 73aa59ccf1
commit 942a5afd23
2 changed files with 5 additions and 5 deletions

View file

@ -75,7 +75,7 @@ public:
virtual const char* class_name() const = 0;
const String& name() const { return m_name; }
void set_name(const StringView& name) { m_name = name; }
void set_name(String name) { m_name = move(name); }
NonnullRefPtrVector<Object>& children() { return m_children; }
const NonnullRefPtrVector<Object>& children() const { return m_children; }
@ -120,8 +120,8 @@ public:
void save_to(JsonObject&);
bool set_property(const StringView& name, const JsonValue& value);
JsonValue property(const StringView& name) const;
bool set_property(String const& name, const JsonValue& value);
JsonValue property(String const& name) const;
const HashMap<String, NonnullOwnPtr<Property>>& properties() const { return m_properties; }
static IntrusiveList<Object, RawPtr<Object>, &Object::m_all_objects_list_node>& all_objects();