Skip to content

Commit b8a867c

Browse files
committed
remove commented code
1 parent 753662a commit b8a867c

2 files changed

Lines changed: 12 additions & 103 deletions

File tree

runtime/src/main/java/com/tns/AndroidJsV8Inspector.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void start() throws IOException
4646
this.server = new JsV8InspectorServer(context.getPackageName() + "-inspectorServer");
4747
this.server.start(-1);
4848

49-
Log.d("V8Inspector", "init ThreadId:" + Thread.currentThread().getId());
49+
//Log.d("V8Inspector", "init ThreadId:" + Thread.currentThread().getId());
5050

5151
init();
5252
}
@@ -72,7 +72,7 @@ public JsV8InspectorServer(String name)
7272
@Override
7373
protected Response serveHttp(IHTTPSession session)
7474
{
75-
Log.d("{N}.v8-inspector", "http request for " + session.getUri());
75+
//Log.d("{N}.v8-inspector", "http request for " + session.getUri());
7676
return super.serveHttp(session);
7777
}
7878

@@ -94,7 +94,7 @@ public JsV8InspectorWebSocket(NanoHTTPD.IHTTPSession handshakeRequest)
9494
@Override
9595
protected void onOpen()
9696
{
97-
Log.d("V8Inspector", "onOpen: ThreadID: " + Thread.currentThread().getId());
97+
//Log.d("V8Inspector", "onOpen: ThreadID: " + Thread.currentThread().getId());
9898

9999
final Object waitObject = new Object();
100100

@@ -105,7 +105,7 @@ public void run()
105105
{
106106
try
107107
{
108-
Log.d("V8Inspector", "onOpen: runnable ThreadID : " + Thread.currentThread().getId());
108+
//Log.d("V8Inspector", "onOpen: runnable ThreadID : " + Thread.currentThread().getId());
109109
connect(JsV8InspectorWebSocket.this);
110110
}
111111
finally
@@ -134,7 +134,7 @@ public void run()
134134
@Override
135135
protected void onClose(NanoWSD.WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote)
136136
{
137-
Log.d("V8Inspector", "onClose");
137+
//Log.d("V8Inspector", "onClose");
138138
mainHandler.post(new Runnable()
139139
{
140140
@Override
@@ -150,8 +150,8 @@ public void run()
150150
@Override
151151
protected void onMessage(final NanoWSD.WebSocketFrame message)
152152
{
153-
Log.d("V8Inspector", "onMessage");
154-
Log.d("V8Inspector", "onMessage TextPayload" + message.getTextPayload() + " ThreadId:" + Thread.currentThread().getId());
153+
//Log.d("V8Inspector", "onMessage");
154+
//Log.d("V8Inspector", "onMessage TextPayload" + message.getTextPayload() + " ThreadId:" + Thread.currentThread().getId());
155155
inspectorMessages.offer(message.getTextPayload());
156156

157157
mainHandler.post(new Runnable()
@@ -167,22 +167,12 @@ public void run()
167167
}
168168
}
169169
});
170-
171-
// mainHandler.post(new Runnable()
172-
// {
173-
// @Override
174-
// public void run()
175-
// {
176-
//
177-
// dispatchMessage(message.getTextPayload());
178-
// }
179-
// });
180170
}
181171

182172
@Override
183173
public void send(String payload) throws IOException
184174
{
185-
Log.d("V8Inspector", "send " + payload);
175+
//Log.d("V8Inspector", "send " + payload);
186176
super.send(payload);
187177
}
188178

@@ -212,7 +202,7 @@ public String getInspectorMessage()
212202
@Override
213203
protected void onPong(NanoWSD.WebSocketFrame pong)
214204
{
215-
Log.d("V8Inspector", "onPong");
205+
//Log.d("V8Inspector", "onPong");
216206
}
217207

218208
@Override

runtime/src/main/jni/JsV8InspectorClient.cpp

Lines changed: 3 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -39,41 +39,15 @@ JsV8InspectorClient::JsV8InspectorClient(v8::Isolate *isolate)
3939

4040
void 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

6648
void 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

7953
void JsV8InspectorClient::disconnect()
@@ -96,43 +70,10 @@ void JsV8InspectorClient::disconnect()
9670

9771
void 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-
13677
void 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

192118
void 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

204127
void 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

220142
void 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

Comments
 (0)