mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
slightly more progress
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <JavaScriptCore/Heap.h>
|
||||
#include <JavaScriptCore/JSGlobalObject.h>
|
||||
#include "JSGlobalObjectInspectorController.h"
|
||||
#include <JavaScriptCore/JSGlobalObjectDebugger.h>
|
||||
|
||||
namespace Zig {
|
||||
|
||||
@@ -111,6 +112,8 @@ void BunInspector::drainOutgoingMessages()
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Bun__tickWhileWaitingForDebugger(JSC::JSGlobalObject* globalObject);
|
||||
|
||||
RefPtr<BunInspector> BunInspector::startWebSocketServer(
|
||||
WebCore::ScriptExecutionContext& context,
|
||||
WTF::String hostname,
|
||||
@@ -184,7 +187,13 @@ RefPtr<BunInspector> BunInspector::startWebSocketServer(
|
||||
*connectionPtr = new BunInspectorConnection(inspector);
|
||||
ws->subscribe("BunInspectorConnection");
|
||||
BunInspectorConnection* connection = *connectionPtr;
|
||||
inspector->connect(Inspector::FrontendChannel::ConnectionType::Local); },
|
||||
inspector->connect(Inspector::FrontendChannel::ConnectionType::Local);
|
||||
auto* debugger = reinterpret_cast<Inspector::JSGlobalObjectDebugger*>(inspector->globalObject()->inspectorController().debugger());
|
||||
debugger->runWhilePausedCallback = [](JSC::JSGlobalObject& globalObject, bool& isPaused) {
|
||||
while (isPaused) {
|
||||
Bun__tickWhileWaitingForDebugger(&globalObject);
|
||||
}
|
||||
}; },
|
||||
|
||||
.message = [inspector](auto* ws, std::string_view message, uWS::OpCode opCode) {
|
||||
if (opCode == uWS::OpCode::TEXT) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
namespace Zig {
|
||||
|
||||
using namespace JSC;
|
||||
using namespace WebCore;
|
||||
|
||||
class BunInspector final : public RefCounted<BunInspector>, ::Inspector::InspectorTarget, ::Inspector::FrontendChannel, public WebCore::ContextDestructionObserver {
|
||||
public:
|
||||
|
||||
@@ -879,3 +879,12 @@ pub const AnyEventLoop = union(enum) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
pub export fn Bun__tickWhileWaitingForDebugger(globalObject: *JSC.JSGlobalObject) callconv(.C) void {
|
||||
globalObject.bunVM().eventLoop().tickPossiblyForever();
|
||||
}
|
||||
|
||||
comptime {
|
||||
if (!JSC.is_bindgen)
|
||||
_ = Bun__tickWhileWaitingForDebugger;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user