@@ -39,41 +39,15 @@ JsV8InspectorClient::JsV8InspectorClient(v8::Isolate *isolate)
3939
4040void JsV8InspectorClient::connect (jobject connection)
4141{
42- // Isolate::Scope isolate_scope(isolate_);
43- // v8::HandleScope handleScope(isolate_);
44-
45- // v8::base_copied::Semaphore ready_semaphore(0);
46-
4742 JEnv env;
4843 this ->connection = env.NewGlobalRef (connection);
4944
50- // this->backend_runner->Append(new ConnectTask(this, &ready_semaphore));
51-
52- // ready_semaphore.Wait();
53-
5445 this ->doConnect (isolate_, JsV8InspectorClient::PersistentToLocal (isolate_, context_));
55-
56-
57- // inspector_ = V8Inspector::create(isolate_, this);
58-
59- // session_ = inspector_->connect(1, this, v8_inspector::StringView());
60-
61- // inspector_->contextCreated(v8_inspector::V8ContextInfo(isolate_->GetCurrentContext(), 1, v8_inspector::StringView()));
62-
63-
6446}
6547
6648void JsV8InspectorClient::doConnect (v8::Isolate *isolate, const v8::Local<v8::Context> &context)
6749{
68- // Isolate::Scope isolate_scope(isolate_);
69- // v8::HandleScope handleScope(isolate_);
70-
71-
72- // inspector_ = V8Inspector::create(isolate, this);
73-
7450 session_ = inspector_->connect (0 , this , v8_inspector::StringView ());
75-
76- // inspector_->contextCreated(v8_inspector::V8ContextInfo(/*isolate->GetCurrentContext()*/ context, 1, v8_inspector::StringView()));
7751}
7852
7953void JsV8InspectorClient::disconnect ()
@@ -96,43 +70,10 @@ void JsV8InspectorClient::disconnect()
9670
9771void JsV8InspectorClient::dispatchMessage (const std::string &message)
9872{
99- // Isolate::Scope isolate_scope(isolate_);
100- // v8::HandleScope handleScope(isolate_);
101-
102- // assert(session_ != nullptr);
103- //
104- // const String16 msg(message.c_str());
105- // v8_inspector::StringView message_view(reinterpret_cast<const uint16_t *>(msg.characters16()), msg.length());
106- // session_->dispatchProtocolMessage(message_view);
107-
108- // this->backend_runner->Append(new SendMessageToBackendTask(this, message));
109-
11073 this ->doDispatchMessage (isolate_, message);
11174
11275}
11376
114- // void JsV8InspectorClient::runMessageLoopOnPause(int context_group_id) override
115- // {
116- // if (running_nested_loop_)
117- // {
118- // return;
119- // }
120- //
121- // terminated_ = false;
122- // running_nested_loop_ = true;
123- // while (!terminated_)
124- // {
125- // agent_->WaitForFrontendMessage();
126- // while (v8::platform::PumpMessageLoop(platform_, env_->isolate()))
127- // {
128- //
129- // }
130- // }
131- // terminated_ = false;
132- // running_nested_loop_ = false;
133- // }
134-
135-
13677void JsV8InspectorClient::runMessageLoopOnPause (int context_group_id)
13778{
13879
@@ -148,19 +89,6 @@ void JsV8InspectorClient::runMessageLoopOnPause(int context_group_id)
14889 running_nested_loop_ = true ;
14990 while (!terminated_)
15091 {
151- // agent_->WaitForFrontendMessage();
152-
153- // string errMsg;
154- // JniLocalRef msg(env.CallStaticObjectMethod(NATIVESCRIPTEXCEPTION_CLASS, NATIVESCRIPTEXCEPTION_GET_STACK_TRACE_AS_STRING_METHOD_ID, exception));
155- //
156- // const char* msgStr = env.GetStringUTFChars(msg, nullptr);
157- //
158- // errMsg.append(msgStr);
159- //
160- // env.ReleaseStringUTFChars(msg, msgStr);
161- //
162- // return errMsg;
163-
16492 JniLocalRef msg (env.CallStaticObjectMethod (inspectorClass, getInspectorMessageMethod, this ->connection ));
16593 if (!msg.IsNull ())
16694 {
@@ -185,15 +113,10 @@ v8::Local<v8::Context> JsV8InspectorClient::ensureDefaultContextInGroup(int cont
185113{
186114 v8::Local<v8::Context> context = PersistentToLocal (isolate_, context_);
187115 return context;
188- // return env_->context();
189- // return v8::Local<v8::Context>();
190116}
191117
192118void JsV8InspectorClient::doDispatchMessage (v8::Isolate *isolate, const std::string &message)
193119{
194- // Isolate::Scope isolate_scope(isolate_);
195- // v8::HandleScope handleScope(isolate_);
196-
197120 assert (session_ != nullptr );
198121
199122 const String16 msg (message.c_str ());
@@ -203,7 +126,6 @@ void JsV8InspectorClient::doDispatchMessage(v8::Isolate *isolate, const std::str
203126
204127void JsV8InspectorClient::sendProtocolResponse (int callId, const v8_inspector::StringView &message)
205128{
206- // frontend_channel_->SendMessageToFrontend(message);
207129 sendProtocolNotification (message);
208130}
209131
@@ -219,8 +141,6 @@ static v8_inspector::String16 ToString16(const v8_inspector::StringView &string)
219141
220142void JsV8InspectorClient::sendProtocolNotification (const v8_inspector::StringView &message)
221143{
222- // frontend_channel_->SendMessageToFrontend(message);
223-
224144 if (inspectorClass == nullptr || this ->connection == nullptr )
225145 {
226146 return ;
@@ -294,11 +214,10 @@ JsV8InspectorClient *JsV8InspectorClient::GetInstance()
294214 return instance;
295215}
296216
297- void MessageHandler (v8::Local<v8::Message> message,
298- v8::Local<v8::Value> exception)
217+ void MessageHandler (v8::Local<v8::Message> message, v8::Local<v8::Value> exception)
299218{
300- v8::Isolate *isolate = v8::Isolate::GetCurrent ();
301- v8::Local<v8::Context> context = isolate->GetEnteredContext ();
219+ // v8::Isolate *isolate = v8::Isolate::GetCurrent();
220+ // v8::Local<v8::Context> context = isolate->GetEnteredContext();
302221// if (context.IsEmpty()) return;
303222// v8_inspector::V8Inspector *inspector = InspectorClientImpl::InspectorFromContext(context);
304223//
0 commit comments