Skip to content

Commit 142ce21

Browse files
committed
remove task runner
enable tests
1 parent f1a7261 commit 142ce21

7 files changed

Lines changed: 31 additions & 380 deletions

File tree

runtime/src/main/jni/JsV8InspectorClient.cpp

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "Runtime.h"
1111
#include "src/inspector/string-16.h"
1212

13-
#include "src/inspector/task-runner.h"
1413
#include "ArgConverter.h"
1514

1615
using namespace std;
@@ -19,82 +18,11 @@ using namespace v8;
1918

2019
using namespace v8_inspector;
2120

22-
class ConnectTask : public TaskRunner::Task
23-
{
24-
public:
25-
ConnectTask(JsV8InspectorClient *client, v8::base_copied::Semaphore *ready_semaphore)
26-
: client_(client), ready_semaphore_(ready_semaphore)
27-
{
28-
29-
}
30-
31-
~ConnectTask() = default;
32-
33-
bool is_inspector_task() final
34-
{
35-
return true;
36-
}
37-
38-
void Run(v8::Isolate *isolate, const v8::Global<v8::Context> &global_context)
39-
{
40-
v8::HandleScope handle_scope(isolate);
41-
v8::Local<v8::Context> context = global_context.Get(isolate);
42-
client_->doConnect(isolate, context);
43-
if (ready_semaphore_ != nullptr)
44-
{
45-
ready_semaphore_->Signal();
46-
}
47-
}
48-
49-
private:
50-
JsV8InspectorClient *client_;
51-
v8::base_copied::Semaphore *ready_semaphore_;
52-
};
53-
54-
55-
class SendMessageToBackendTask : public TaskRunner::Task
56-
{
57-
public:
58-
explicit SendMessageToBackendTask(JsV8InspectorClient *client, const std::string &message)
59-
: client_(client), message_(message)
60-
{
61-
62-
}
63-
64-
bool is_inspector_task() final
65-
{
66-
return true;
67-
}
68-
69-
void Run(v8::Isolate *isolate, const v8::Global<v8::Context> &global_context) override
70-
{
71-
// v8_inspector::V8InspectorSession *session = nullptr;
72-
// {
73-
// v8::HandleScope handle_scope(isolate);
74-
// v8::Local<v8::Context> context = global_context.Get(isolate);
75-
// session = InspectorClientImpl::SessionFromContext(context);
76-
// CHECK(session);
77-
// }
78-
//
79-
// v8_inspector::StringView message_view(reinterpret_cast<const uint16_t *>(message_.characters16()), message_.length());
80-
// session->dispatchProtocolMessage(message_view);
81-
82-
v8::HandleScope handle_scope(isolate);
83-
v8::Local<v8::Context> context = global_context.Get(isolate);
84-
client_->doDispatchMessage(isolate, message_);
85-
}
86-
87-
private:
88-
JsV8InspectorClient *client_;
89-
std::string message_;
90-
};
91-
9221
JsV8InspectorClient::JsV8InspectorClient(v8::Isolate *isolate)
9322
: isolate_(isolate),
9423
inspector_(nullptr),
9524
session_(nullptr),
9625
connection(nullptr),
97-
backend_runner(nullptr),
9826
context_()
9927
{
10028
JEnv env;
@@ -110,20 +38,12 @@ JsV8InspectorClient::JsV8InspectorClient(v8::Isolate *isolate)
11038
assert(getInspectorMessageMethod != nullptr);
11139
}
11240

113-
JsV8InspectorClient::~JsV8InspectorClient()
114-
{
115-
if (backend_runner != nullptr)
116-
{
117-
delete backend_runner;
118-
}
119-
}
120-
12141
void JsV8InspectorClient::connect(jobject connection)
12242
{
12343
//Isolate::Scope isolate_scope(isolate_);
12444
//v8::HandleScope handleScope(isolate_);
12545

126-
v8::base_copied::Semaphore ready_semaphore(0);
46+
//v8::base_copied::Semaphore ready_semaphore(0);
12747

12848
JEnv env;
12949
this->connection = env.NewGlobalRef(connection);
@@ -351,18 +271,8 @@ void JsV8InspectorClient::init()
351271
return;
352272
}
353273

354-
v8::base_copied::Semaphore ready_semaphore(0);
355-
356-
this->backend_runner = new TaskRunner(nullptr, false, &ready_semaphore, isolate_);
357-
ready_semaphore.Wait();
358-
359-
360274
v8::HandleScope handle_scope(isolate_);
361275

362-
v8::Local<Context> entered = isolate_->GetEnteredContext();
363-
v8::Local<Context> calling = isolate_->GetCallingContext();
364-
v8::Local<Context> current = isolate_->GetCurrentContext();
365-
366276
v8::Local<Context> context = Context::New(isolate_);
367277
v8::Context::Scope context_scope(context);
368278

runtime/src/main/jni/JsV8InspectorClient.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define JSV8INSPECTORCLIENT_H_
33

44
#include <string>
5-
#include <v8_inspector/src/inspector/task-runner.h>
65
#include "v8.h"
76
#include "v8-debug.h"
87
#include "JEnv.h"
@@ -42,14 +41,12 @@ namespace tns
4241

4342
private:
4443
JsV8InspectorClient(v8::Isolate *isolate);
45-
~JsV8InspectorClient();
4644

4745
static JsV8InspectorClient* instance;
4846
static jclass inspectorClass;
4947
static jmethodID sendMethod;
5048
static jmethodID getInspectorMessageMethod;
5149

52-
TaskRunner* backend_runner;
5350
v8::Isolate* isolate_;
5451
v8::Persistent<v8::Context> context_;
5552
std::unique_ptr<V8Inspector> inspector_;

runtime/src/main/jni/v8_inspector/src/inspector/task-runner.cc

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)