mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 06:29:43 +00:00
LibJS: Avoid string ref-count churn in PrimitiveString::*_string_view()
This commit is contained in:
parent
24934ba479
commit
cc560a6feb
Notes:
github-actions[bot]
2025-10-05 14:40:40 +00:00
Author: https://github.com/awesomekling
Commit: cc560a6feb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6400
Reviewed-by: https://github.com/gmta ✅
1 changed files with 4 additions and 2 deletions
|
@ -146,7 +146,8 @@ String PrimitiveString::utf8_string() const
|
|||
|
||||
StringView PrimitiveString::utf8_string_view() const
|
||||
{
|
||||
(void)utf8_string();
|
||||
if (!has_utf8_string())
|
||||
(void)utf8_string();
|
||||
return m_utf8_string->bytes_as_string_view();
|
||||
}
|
||||
|
||||
|
@ -164,7 +165,8 @@ Utf16String PrimitiveString::utf16_string() const
|
|||
|
||||
Utf16View PrimitiveString::utf16_string_view() const
|
||||
{
|
||||
(void)utf16_string();
|
||||
if (!has_utf16_string())
|
||||
(void)utf16_string();
|
||||
return *m_utf16_string;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue