| 795 | } |
| 796 | |
| 797 | jsi::String V8Runtime::createStringFromUtf8(const uint8_t *str, size_t length) { |
| 798 | v8::Locker locker(isolate_); |
| 799 | v8::Isolate::Scope scopedIsolate(isolate_); |
| 800 | v8::HandleScope scopedHandle(isolate_); |
| 801 | v8::Context::Scope scopedContext(context_.Get(isolate_)); |
| 802 | |
| 803 | V8PointerValue *value = V8PointerValue::createFromUtf8(isolate_, str, length); |
| 804 | if (!value) { |
| 805 | throw jsi::JSError(*this, "createFromUtf8() - string creation failed."); |
| 806 | } |
| 807 | |
| 808 | return make<jsi::String>(value); |
| 809 | } |
| 810 | |
| 811 | std::string V8Runtime::utf8(const jsi::String &str) { |
| 812 | v8::Locker locker(isolate_); |