File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 1- #include " nodeobs_api.hpp"
21#include " controller.hpp"
32#include " error.hpp"
3+ #include " nodeobs_api.hpp"
44#include " utility-v8.hpp"
55
66#include < node.h>
@@ -141,6 +141,17 @@ void api::SetWorkingDirectory(const v8::FunctionCallbackInfo<v8::Value>& args)
141141 ValidateResponse (response);
142142}
143143
144+ void api::StopCrashHandler (const v8::FunctionCallbackInfo<v8::Value>& args)
145+ {
146+ auto conn = GetConnection ();
147+ if (!conn)
148+ return ;
149+
150+ std::vector<ipc::value> response = conn->call_synchronous_helper (" API" , " StopCrashHandler" , {});
151+
152+ ValidateResponse (response);
153+ }
154+
144155INITIALIZER (nodeobs_api)
145156{
146157 initializerFunctions.push ([](v8::Local<v8::Object> exports) {
@@ -152,5 +163,6 @@ INITIALIZER(nodeobs_api)
152163 exports, " OBS_API_getOBS_existingSceneCollections" , api::OBS_API_getOBS_existingSceneCollections);
153164 NODE_SET_METHOD (exports, " OBS_API_isOBS_installed" , api::OBS_API_isOBS_installed);
154165 NODE_SET_METHOD (exports, " SetWorkingDirectory" , api::SetWorkingDirectory);
166+ NODE_SET_METHOD (exports, " StopCrashHandler" , api::StopCrashHandler);
155167 });
156168}
Original file line number Diff line number Diff line change @@ -11,4 +11,5 @@ namespace api
1111 static void OBS_API_getOBS_existingSceneCollections (const v8::FunctionCallbackInfo<v8::Value>& args);
1212 static void OBS_API_isOBS_installed (const v8::FunctionCallbackInfo<v8::Value>& args);
1313 static void SetWorkingDirectory (const v8::FunctionCallbackInfo<v8::Value>& args);
14+ static void StopCrashHandler (const v8::FunctionCallbackInfo<v8::Value>& args);
1415} // namespace api
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ void OBS_API::Register(ipc::server& srv)
6363 std::make_shared<ipc::function>(" OBS_API_isOBS_installed" , std::vector<ipc::type>{}, OBS_API_isOBS_installed));
6464 cls->register_function (std::make_shared<ipc::function>(
6565 " SetWorkingDirectory" , std::vector<ipc::type>{ipc::type::String}, SetWorkingDirectory));
66+ cls->register_function (std::make_shared<ipc::function>(
67+ " StopCrashHandler" , std::vector<ipc::type>{}, StopCrashHandler));
6668
6769 srv.register_collection (cls);
6870}
@@ -800,11 +802,21 @@ static void SaveProfilerData(const profiler_snapshot_t* snap)
800802 blog (LOG_WARNING, " Could not save profiler data to '%s'" , dst.c_str ());
801803}
802804
803- void OBS_API::destroyOBS_API (void )
805+ void OBS_API::StopCrashHandler (
806+ void * data,
807+ const int64_t id,
808+ const std::vector<ipc::value>& args,
809+ std::vector<ipc::value>& rval)
804810{
805811 writeCrashHandler (unregisterProcess ());
806812 writeCrashHandler (terminateCrashHandler ());
807813
814+ rval.push_back (ipc::value ((uint64_t )ErrorCode::Ok));
815+ AUTO_DEBUG;
816+ }
817+
818+ void OBS_API::destroyOBS_API (void )
819+ {
808820 os_cpu_usage_info_destroy (cpuUsageInfo);
809821
810822#ifdef _WIN32
Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ class OBS_API
6363 const int64_t id,
6464 const std::vector<ipc::value>& args,
6565 std::vector<ipc::value>& rval);
66+ static void StopCrashHandler (
67+ void * data,
68+ const int64_t id,
69+ const std::vector<ipc::value>& args,
70+ std::vector<ipc::value>& rval);
6671
6772 private:
6873 static void initAPI (void );
You can’t perform that action at this time.
0 commit comments