| 746 | } |
| 747 | |
| 748 | V8_EXPORT const char *GetArrayBufferFromResult(FResultInfo *ResultInfo, int *Length) |
| 749 | { |
| 750 | v8::Isolate* Isolate = ResultInfo->Isolate; |
| 751 | v8::Isolate::Scope IsolateScope(Isolate); |
| 752 | v8::HandleScope HandleScope(Isolate); |
| 753 | v8::Local<v8::Context> Context = ResultInfo->Context.Get(Isolate); |
| 754 | v8::Context::Scope ContextScope(Context); |
| 755 | |
| 756 | auto Value = ResultInfo->Result.Get(Isolate); |
| 757 | if (Value->IsArrayBufferView()) |
| 758 | { |
| 759 | v8::Local<v8::ArrayBufferView> BuffView = Value.As<v8::ArrayBufferView>(); |
| 760 | *Length = static_cast<int>(BuffView->ByteLength()); |
| 761 | auto ABC = BuffView->Buffer()->GetContents(); |
| 762 | return static_cast<char*>(ABC.Data()) + BuffView->ByteOffset(); |
| 763 | } |
| 764 | else if (Value->IsArrayBuffer()) |
| 765 | { |
| 766 | auto Ab = v8::Local <v8::ArrayBuffer>::Cast(Value); |
| 767 | auto ABC = Ab->GetContents(); |
| 768 | *Length = static_cast<int>(ABC.ByteLength()); |
| 769 | return static_cast<char*>(ABC.Data()); |
| 770 | } |
| 771 | else |
| 772 | { |
| 773 | return nullptr; |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | V8_EXPORT void *GetObjectFromResult(FResultInfo *ResultInfo) |
| 778 | { |
nothing calls this directly
no test coverage detected