Add support for multiple RemoteDebuggerPeer(s).

It is now possible to register protocol handlers (default tcp://) to
support additional debugging communication layers (e.g. websocket).
This commit is contained in:
Fabio Alessandrelli
2020-03-11 11:23:21 +01:00
parent beb87504e0
commit ed225faf31
6 changed files with 49 additions and 30 deletions

View File

@@ -38,6 +38,7 @@
#include "core/variant.h"
#include "core/vector.h"
class RemoteDebuggerPeer;
class ScriptDebugger;
class EngineDebugger {
@@ -45,8 +46,11 @@ public:
typedef void (*ProfilingToggle)(void *p_user, bool p_enable, const Array &p_opts);
typedef void (*ProfilingTick)(void *p_user, float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time);
typedef void (*ProfilingAdd)(void *p_user, const Array &p_arr);
typedef Error (*CaptureFunc)(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured);
typedef RemoteDebuggerPeer *(*CreatePeerFunc)(const String &p_uri);
class Profiler {
friend class EngineDebugger;
@@ -94,6 +98,7 @@ protected:
static Map<StringName, Profiler> profilers;
static Map<StringName, Capture> captures;
static Map<String, CreatePeerFunc> protocols;
public:
_FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; }
@@ -113,6 +118,8 @@ public:
static void unregister_message_capture(const StringName &p_name);
static bool has_capture(const StringName &p_name);
static void register_uri_handler(const String &p_protocol, CreatePeerFunc p_func);
void iteration(uint64_t p_frame_ticks, uint64_t p_idle_ticks, uint64_t p_physics_ticks, float p_physics_frame_time);
void profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts = Array());
Error capture_parse(const StringName &p_name, const String &p_msg, const Array &p_args, bool &r_captured);