Encapsulate runtime creation.

- Makes it easier to change down the line (and change is coming)
- Allows making g_ScriptRuntime thread-local easily.
- Remove ParentRuntime, which is not used at the moment.

Part of the SM52 migration, stage: SM45 compatible.

Patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3087
This was SVN commit r24171.
This commit is contained in:
wraitii
2020-11-12 09:34:40 +00:00
parent 90367cdc53
commit 66cc595c53
10 changed files with 46 additions and 49 deletions
+3 -3
View File
@@ -39,8 +39,8 @@
#include <string>
#include <vector>
// TODO: what's a good default? perhaps based on map size
#define RMS_RUNTIME_SIZE 96 * 1024 * 1024
// TODO: Maybe this should be optimized depending on the map size.
constexpr int RMS_RUNTIME_SIZE = 96 * 1024 * 1024;
extern bool IsQuitRequested();
@@ -89,7 +89,7 @@ void* CMapGeneratorWorker::RunThread(CMapGeneratorWorker* self)
debug_SetThreadName("MapGenerator");
g_Profiler2.RegisterCurrentThread("MapGenerator");
shared_ptr<ScriptRuntime> mapgenRuntime = ScriptInterface::CreateRuntime(g_ScriptRuntime, RMS_RUNTIME_SIZE);
shared_ptr<ScriptRuntime> mapgenRuntime = ScriptRuntime::CreateRuntime(RMS_RUNTIME_SIZE);
// Enable the script to be aborted
JS_SetInterruptCallback(mapgenRuntime->m_rt, MapGeneratorInterruptCallback);