Skip to content

Commit

Permalink
fix: Re-enable inspector code
Browse files Browse the repository at this point in the history
Uncomment the code that starts the inspector. However, comment out the
parts that don't work yet.

At this point, the JsV8InspectorClient compiles, but doesn't do
anything.
  • Loading branch information
ptomato committed Mar 20, 2023
1 parent 4a23795 commit 14faf01
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions NativeScript/NativeScript.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Foundation/Foundation.h>
#include "NativeScript.h"
// #include "inspector/JsV8InspectorClient.h"
#include "inspector/JsV8InspectorClient.h"
#include "runtime/RuntimeConfig.h"
#include "runtime/Helpers.h"
#include "runtime/Runtime.h"
Expand Down Expand Up @@ -45,14 +45,14 @@ - (instancetype)initWithConfig:(Config*)config {
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count();
printf("Runtime initialization took %llims\n", duration);

// if (config.IsDebug) {
// Isolate::Scope isolate_scope(isolate);
// HandleScope handle_scope(isolate);
// v8_inspector::JsV8InspectorClient* inspectorClient = new v8_inspector::JsV8InspectorClient(runtime_.get());
// inspectorClient->init();
// inspectorClient->registerModules();
// inspectorClient->connect([config ArgumentsCount], [config Arguments]);
// }
if (config.IsDebug) {
Isolate::Scope isolate_scope(isolate);
HandleScope handle_scope(isolate);
v8_inspector::JsV8InspectorClient* inspectorClient = new v8_inspector::JsV8InspectorClient(runtime_.get());
inspectorClient->init();
inspectorClient->registerModules();
inspectorClient->connect([config ArgumentsCount], [config Arguments]);
}
}

return self;
Expand Down
28 changes: 14 additions & 14 deletions NativeScript/inspector/JsV8InspectorClient.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdio.h>
#include "JsV8InspectorClient.h"
#include "src/inspector/v8-inspector-session-impl.h"
//#include "src/inspector/v8-inspector-session-impl.h"
#include "Helpers.h"

using namespace v8;
Expand All @@ -14,19 +14,19 @@ void JsV8InspectorClient::inspectorSendEventCallback(const FunctionCallbackInfo<
Local<v8::String> arg = args[0].As<v8::String>();
std::string message = tns::ToString(isolate, arg);

if (message.find("\"Network.") != std::string::npos) {
// The Network domain is handled directly by the corresponding backend
V8InspectorSessionImpl* session = (V8InspectorSessionImpl*)client->session_.get();
session->networkArgent()->dispatch(message);
return;
}

if (message.find("\"DOM.") != std::string::npos) {
// The DOM domain is handled directly by the corresponding backend
V8InspectorSessionImpl* session = (V8InspectorSessionImpl*)client->session_.get();
session->domArgent()->dispatch(message);
return;
}
// if (message.find("\"Network.") != std::string::npos) {
// // The Network domain is handled directly by the corresponding backend
// V8InspectorSessionImpl* session = (V8InspectorSessionImpl*)client->session_.get();
// session->networkArgent()->dispatch(message);
// return;
// }
//
// if (message.find("\"DOM.") != std::string::npos) {
// // The DOM domain is handled directly by the corresponding backend
// V8InspectorSessionImpl* session = (V8InspectorSessionImpl*)client->session_.get();
// session->domArgent()->dispatch(message);
// return;
// }

client->dispatchMessage(message);
}
Expand Down
2 changes: 1 addition & 1 deletion NativeScript/inspector/JsV8InspectorClient.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "JsV8InspectorClient.h"
#include "InspectorServer.h"
#include "include/libplatform/libplatform.h"
#include "src/inspector/v8-log-agent-impl.h"
//#include "src/inspector/v8-log-agent-impl.h"
#include "Helpers.h"
#include "utils.h"

Expand Down

0 comments on commit 14faf01

Please sign in to comment.