@@ -1724,15 +1724,14 @@ static inline v8_inspector::StringView toStringView(const std::string &str) {
17241724 return toStringView (str.c_str (), str.length ());
17251725}
17261726
1727- static inline std::string fromStringView (v8::Isolate* isolate, const v8_inspector::StringView stringView) {
1727+ static v8::Local<v8::String> fromStringView (v8::Isolate* isolate, const v8_inspector::StringView stringView) {
17281728 int length = static_cast <int >(stringView.length ());
17291729 v8::Local<v8::String> message = (
17301730 stringView.is8Bit ()
17311731 ? v8::String::NewFromOneByte (isolate, stringView.characters8 (), v8::NewStringType::kNormal , length)
17321732 : v8::String::NewFromTwoByte (isolate, stringView.characters16 (), v8::NewStringType::kNormal , length)
17331733 ).ToLocalChecked ();
1734- v8::String::Utf8Value result (isolate, message);
1735- return *result;
1734+ return message;
17361735}
17371736
17381737// / Allocates a string as utf8 on the allocator without \0 terminator, for use in Zig.
@@ -1997,24 +1996,24 @@ void v8_inspector__Channel__IMPL__SET_DATA(v8_inspector__Channel__IMPL *self, vo
19971996// NOTE: zig project should provide those implementations with C-ABI functions
19981997void v8_inspector__Channel__IMPL__sendResponse (
19991998 v8_inspector__Channel__IMPL* self, void * data,
2000- int callId, const char * message, size_t length );
1999+ int callId, v8::Local<v8::String> resp );
20012000void v8_inspector__Channel__IMPL__sendNotification (
20022001 v8_inspector__Channel__IMPL* self, void *data,
2003- const char * msg, size_t length );
2002+ v8::Local<v8::String> notif );
20042003void v8_inspector__Channel__IMPL__flushProtocolNotifications (
20052004 v8_inspector__Channel__IMPL* self, void *data);
20062005
20072006// c++ implementation (just wrappers around the C/zig functions)
20082007} // extern "C"
20092008void v8_inspector__Channel__IMPL::sendResponse (
20102009 int callId, std::unique_ptr<v8_inspector::StringBuffer> message) {
2011- const std::string resp = fromStringView (this ->isolate , message->string ());
2012- return v8_inspector__Channel__IMPL__sendResponse (this , this ->data , callId, resp. c_str (), resp. length () );
2010+ const v8::Local<v8::String> resp = fromStringView (this ->isolate , message->string ());
2011+ return v8_inspector__Channel__IMPL__sendResponse (this , this ->data , callId, resp);
20132012}
20142013void v8_inspector__Channel__IMPL::sendNotification (
20152014 std::unique_ptr<v8_inspector::StringBuffer> message) {
2016- const std::string notif = fromStringView (this ->isolate , message->string ());
2017- return v8_inspector__Channel__IMPL__sendNotification (this , this ->data , notif. c_str (), notif. length () );
2015+ const v8::Local<v8::String> notif = fromStringView (this ->isolate , message->string ());
2016+ return v8_inspector__Channel__IMPL__sendNotification (this , this ->data , notif);
20182017}
20192018void v8_inspector__Channel__IMPL::flushProtocolNotifications () {
20202019 return v8_inspector__Channel__IMPL__flushProtocolNotifications (this , this ->data );
0 commit comments