electron/patches/node/fix_build_and_expose_inspec...

66 строки
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Mon, 30 Jul 2018 15:18:11 -0700
Subject: fix: build and expose inspector agent
Node inspector initialization happens in a different start-up function in node.cc, which we don't call in Electron. This allows for us to use the inspector agent in electron/atom/browser/node_debugger.cc
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 8a12c2dddf7493a1c2a5f5deff7114d35ffa4f76..b208fad547fb5af9a1ff3988428e205a2a9ef39f 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -217,7 +217,7 @@ const int CONTEXT_GROUP_ID = 1;
std::string GetWorkerLabel(node::Environment* env) {
std::ostringstream result;
- result << "Worker[" << env->thread_id() << "]";
+ result << "Electron Worker[" << env->thread_id() << "]";
return result.str();
}
@@ -461,7 +461,7 @@ class NodeInspectorClient : public V8InspectorClient {
client_ = V8Inspector::create(env->isolate(), this);
// TODO(bnoordhuis) Make name configurable from src/node.cc.
std::string name =
- is_main_ ? GetHumanReadableProcessName() : GetWorkerLabel(env);
+ is_main_ ? "Electron Main Context" : GetWorkerLabel(env);
ContextInfo info(name);
info.is_default = true;
contextCreated(env->context(), info);
diff --git a/src/inspector_agent.h b/src/inspector_agent.h
index 1c2bde0da73e846159843a8c32879f227a8f0dd7..133e2187dcd6fed9cb3a2d13eb646ef5e9851e01 100644
--- a/src/inspector_agent.h
+++ b/src/inspector_agent.h
@@ -6,7 +6,9 @@
#error("This header can only be used when inspector is enabled")
#endif
+#include "node.h"
#include "node_options.h"
+#include "node_platform.h"
#include "v8.h"
#include <cstddef>
@@ -40,7 +42,7 @@ class InspectorSessionDelegate {
= 0;
};
-class Agent {
+class NODE_EXTERN Agent {
public:
explicit Agent(node::Environment* env);
~Agent();
diff --git a/src/inspector_io.cc b/src/inspector_io.cc
index 223e3592a1fc0901575153f2ec000dcaac37ea1f..d500d15b07c249f973c41967b5510f69429117b7 100644
--- a/src/inspector_io.cc
+++ b/src/inspector_io.cc
@@ -13,6 +13,8 @@
#include "util-inl.h"
#include "zlib.h"
+#include "libplatform/libplatform.h"
+
#include <deque>
#include <cstring>
#include <vector>