Skip to content

Commit c100f72

Browse files
authored
feat: re-enabled inspector protocol handling (#202)
1 parent 2e5f5f1 commit c100f72

14 files changed

+483
-78
lines changed

NativeScript/NativeScript-Prefix.pch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef NativeScript_Prefix_pch
22
#define NativeScript_Prefix_pch
33

4-
#define NATIVESCRIPT_VERSION "8.5.1"
4+
#define NATIVESCRIPT_VERSION "8.5.2-alpha.3"
55

66
#ifdef DEBUG
77
#define SIZEOF_OFF_T 8

NativeScript/NativeScript.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ - (instancetype)initWithConfig:(Config*)config {
4646
runtime_->Init(isolate);
4747
std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
4848
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count();
49-
printf("Runtime initialization took %llims\n", duration);
50-
printf("Runtime V8 Version %s\n", V8::GetVersion());
49+
printf("Runtime initialization took %llims (version %s, V8 version %s)\n", duration, NATIVESCRIPT_VERSION, V8::GetVersion());
5150

5251
if (config.IsDebug) {
5352
Isolate::Scope isolate_scope(isolate);

NativeScript/inspector/JsV8InspectorClient.cpp

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

NativeScript/inspector/JsV8InspectorClient.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "include/v8-inspector.h"
1111
#include "src/inspector/v8-console-message.h"
1212

13+
#include "ns-v8-tracing-agent-impl.h"
1314
#include "runtime/Runtime.h"
1415

1516
namespace v8_inspector {
@@ -46,14 +47,18 @@ class JsV8InspectorClient : V8InspectorClient, V8Inspector::Channel {
4647
v8::Persistent<v8::Context> context_;
4748
std::unique_ptr<V8InspectorSession> session_;
4849
tns::Runtime* runtime_;
50+
v8::Isolate* isolate_;
4951
bool terminated_;
50-
std::vector<std::string> messages_;
52+
std::queue<std::string> messages_;
5153
bool runningNestedLoops_;
5254
dispatch_queue_t messagesQueue_;
5355
dispatch_queue_t messageLoopQueue_;
5456
dispatch_semaphore_t messageArrived_;
5557
std::function<void (std::string)> sender_;
5658
bool isWaitingForDebugger_;
59+
bool hasScheduledDebugBreak_;
60+
61+
std::unique_ptr<tns::inspector::TracingAgentImpl> tracing_agent_;
5762

5863
// Override of V8InspectorClient
5964
v8::Local<v8::Context> ensureDefaultContextInGroup(int contextGroupId) override;
@@ -67,6 +72,14 @@ class JsV8InspectorClient : V8InspectorClient, V8Inspector::Channel {
6772
static void registerDomainDispatcherCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
6873
static void inspectorSendEventCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
6974
static void inspectorTimestampCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
75+
76+
// {N} specific helpers
77+
bool CallDomainHandlerFunction(v8::Local<v8::Context> context,
78+
v8::Local<v8::Function> domainMethodFunc,
79+
const v8::Local<v8::Object>& arg,
80+
v8::Local<v8::Object>& domainDebugger,
81+
v8::Local<v8::Value>& result);
82+
std::string GetReturnMessageFromDomainHandlerResult(const v8::Local<v8::Value>& result, const v8::Local<v8::Value>& requestId);
7083
};
7184

7285
}

0 commit comments

Comments
 (0)