Skip to content

Commit

Permalink
[unreal]上个提交的unreal修复
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Nov 20, 2024
1 parent fb669ca commit 4126b5a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/unity_build_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- unity/native_src/**
- unity/cli/**
- unreal/Puerts/Source/JsEnv/Private/V8InspectorImpl.cpp
- unreal/Puerts/Source/JsEnv/Private/WebSocketImpl.cpp
- unreal/Puerts/Source/JsEnv/Private/V8InspectorImpl.h
- unreal/Puerts/Source/JsEnv/Private/PromiseRejectCallback.hpp
- unreal/Puerts/ThirdParty/**
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unity_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- unity/cli/**
- unreal/Puerts/Source/JsEnv/Private/V8InspectorImpl.cpp
- unreal/Puerts/Source/JsEnv/Private/V8InspectorImpl.h
- unreal/Puerts/Source/JsEnv/Private/WebSocketImpl.cpp
- unreal/Puerts/Source/JsEnv/Private/PromiseRejectCallback.hpp
- .github/workflows/unity_unittest.yml

Expand Down
14 changes: 4 additions & 10 deletions unreal/Puerts/Source/JsEnv/Private/WebSocketImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ class DataTransfer
#endif
#endif
}

static v8::Local<v8::ArrayBuffer> NewArrayBuffer(v8::Local<v8::Context> Context, void* Data, size_t DataLength)
{
v8::Local<v8::ArrayBuffer> Ab = v8::ArrayBuffer::New(Context->GetIsolate(), DataLength);
void* Buff = Ab->GetBackingStore()->Data();
::memcpy(Buff, Data, DataLength);
return Ab;
}
};
#endif

Expand Down Expand Up @@ -352,8 +344,10 @@ void V8WebSocketClientImpl::OnMessage(wspp_connection_hdl InHandle, wspp_message
}
else if (InMessage->get_opcode() == websocketpp::frame::opcode::BINARY)
{
args[0] = DataTransfer::NewArrayBuffer(
GContext.Get(Isolate), (void*) InMessage->get_payload().data(), InMessage->get_payload().size());
v8::Local<v8::ArrayBuffer> Ab = v8::ArrayBuffer::New(Isolate, InMessage->get_payload().size());
void* Buff = Ab->GetBackingStore()->Data();
::memcpy(Buff, InMessage->get_payload().data(), InMessage->get_payload().size());
args[0] = Ab;
}
else
{
Expand Down

0 comments on commit 4126b5a

Please sign in to comment.