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 7712a62d7cbeb0975f00877be36b55da150f1459..1e990059198de3fedc912bfbd5eb6eae8e5c3eea 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -220,7 +220,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();
 }
 
@@ -468,7 +468,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 089077370db049a7e6d00ff2bf4d6b61cbc427d9..5594f4ba637c5c890a8226d9face18815c41a97b 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 75290317d2fcae8585ac8d91f49add5fdd0d79c0..8af7427c463e98705dc7a6a4c86341faec3620b2 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>
