1010#include " Runtime.h"
1111#include " src/inspector/string-16.h"
1212
13- #include " src/inspector/task-runner.h"
1413#include " ArgConverter.h"
1514
1615using namespace std ;
@@ -19,82 +18,11 @@ using namespace v8;
1918
2019using 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-
9221JsV8InspectorClient::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-
12141void 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
0 commit comments