Skip to content

Commit

Permalink
[unreal]这个commit:80d3acf ,被这个commit给冲掉了:205486e ,重新提交下
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Mar 6, 2024
1 parent a3f08ce commit 6d385b5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions unreal/Puerts/Source/JsEnv/Private/V8InspectorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ namespace PUERTS_NAMESPACE
class V8InspectorChannelImpl : public v8_inspector::V8Inspector::Channel, public V8InspectorChannel
{
public:
V8InspectorChannelImpl(const std::unique_ptr<v8_inspector::V8Inspector>& InV8Inspector, const int32_t InCxtGroupID);
V8InspectorChannelImpl(
v8::Isolate* InIsolate, const std::unique_ptr<v8_inspector::V8Inspector>& InV8Inspector, const int32_t InCxtGroupID);

void DispatchProtocolMessage(const std::string& Message) override;

Expand All @@ -79,12 +80,15 @@ class V8InspectorChannelImpl : public v8_inspector::V8Inspector::Channel, public
std::unique_ptr<v8_inspector::V8InspectorSession> V8InspectorSession;

std::function<void(const std::string&)> OnSendMessage;

v8::Isolate* Isolate;
};

V8InspectorChannelImpl::V8InspectorChannelImpl(
const std::unique_ptr<v8_inspector::V8Inspector>& InV8Inspector, const int32_t InCxtGroupID)
v8::Isolate* InIsolate, const std::unique_ptr<v8_inspector::V8Inspector>& InV8Inspector, const int32_t InCxtGroupID)
{
v8_inspector::StringView DummyState;
Isolate = InIsolate;
V8InspectorSession = InV8Inspector->connect(InCxtGroupID, this, DummyState);
}

Expand All @@ -95,6 +99,11 @@ void V8InspectorChannelImpl::DispatchProtocolMessage(const std::string& Message)

v8_inspector::StringView StringView(MessagePtr, MessageLen);

#ifdef THREAD_SAFE
v8::Locker Locker(Isolate);
#endif
v8::Isolate::Scope IsolateScope(Isolate);
v8::SealHandleScope HandleScope(Isolate);
V8InspectorSession->dispatchProtocolMessage(StringView);
}

Expand Down Expand Up @@ -339,7 +348,7 @@ V8InspectorClientImpl::V8InspectorClientImpl(int32_t InPort, v8::Local<v8::Conte

V8InspectorChannel* V8InspectorClientImpl::CreateV8InspectorChannel()
{
return new V8InspectorChannelImpl(V8Inspector, CtxGroupID);
return new V8InspectorChannelImpl(Isolate, V8Inspector, CtxGroupID);
}

V8InspectorClientImpl::~V8InspectorClientImpl()
Expand Down Expand Up @@ -460,7 +469,7 @@ void V8InspectorClientImpl::OnHTTP(wspp_connection_hdl Handle)

void V8InspectorClientImpl::OnOpen(wspp_connection_hdl Handle)
{
V8InspectorChannelImpl* channel = new V8InspectorChannelImpl(V8Inspector, CtxGroupID);
V8InspectorChannelImpl* channel = new V8InspectorChannelImpl(Isolate, V8Inspector, CtxGroupID);
V8InspectorChannels[Handle.lock().get()] = channel;
channel->OnMessage(std::bind(&V8InspectorClientImpl::OnSendMessage, this, Handle, std::placeholders::_1));
#if USING_UE
Expand Down

0 comments on commit 6d385b5

Please sign in to comment.