| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,8 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | 3 | #include "env-inl.h" | |
| 4 | 4 | #include "node_mutex.h" | |
| 5 | - #include "v8-inspector.h" | ||
| 5 | + #include "simdutf.h" | ||
| 6 | 6 | #include "util-inl.h" | |
| 7 | + #include "v8-inspector.h" | ||
| 7 | 8 | ||
| 8 | 9 | #include <unicode/unistr.h> | |
| 9 | 10 | ||
@@ -289,10 +290,12 @@ Deletable* MainThreadInterface::GetObjectIfExists(int id) { | |||
| 289 | 290 | } | |
| 290 | 291 | ||
| 291 | 292 | std::unique_ptr<StringBuffer> Utf8ToStringView(const std::string& message) { | |
| 292 | - icu::UnicodeString utf16 = icu::UnicodeString::fromUTF8( | ||
| 293 | - icu::StringPiece(message.data(), message.length())); | ||
| 294 | - StringView view(reinterpret_cast<const uint16_t*>(utf16.getBuffer()), | ||
| 295 | - utf16.length()); | ||
| 293 | + size_t expected_u16_length = | ||
| 294 | + simdutf::utf16_length_from_utf8(message.data(), message.length()); | ||
| 295 | + MaybeStackBuffer<char16_t> buffer(expected_u16_length); | ||
| 296 | + size_t utf16_length = simdutf::convert_utf8_to_utf16( | ||
| 297 | + message.data(), message.length(), buffer.out()); | ||
| 298 | + StringView view(reinterpret_cast<uint16_t*>(buffer.out()), utf16_length); | ||
| 296 | 299 | return StringBuffer::create(view); | |
| 297 | 300 | } | |
| 298 | 301 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments