LeviLamina
Loading...
Searching...
No Matches
ScriptPluginManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/resource/ResourceInformation.h"
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8#include "mc/deps/script_core/lifetime_registry/scripting/WeakLifetimeScope.h"
9#include "mc/deps/script_core/reflection/scripting/Privilege.h"
10#include "mc/deps/script_core/runtime/scripting/RuntimeConditions.h"
11#include "mc/scripting/PluginExecutionGroup.h"
12#include "mc/scripting/modules/FilterResult.h"
13#include "mc/util/BaseGameVersion.h"
14
15// auto generated forward declare list
16// clang-format off
17class DebuggerStat;
20class PackManifest;
21class ScriptPlugin;
24class ServerLevel;
25namespace Scripting { class DependencyLocator; }
26namespace Scripting { class IRuntime; }
27namespace Scripting { class ScriptEngine; }
28namespace Scripting { struct ModuleDescriptor; }
29namespace Scripting { struct RuntimeStats; }
30namespace mce { class UUID; }
31// clang-format on
32
33class ScriptPluginManager {
34public:
35 // ScriptPluginManager inner types declare
36 // clang-format off
38 // clang-format on
39
40 // ScriptPluginManager inner types define
42 public:
43 // member variables
44 // NOLINTBEGIN
45 ::ll::TypedStorage<8, 32, ::std::string> name;
46 ::ll::TypedStorage<8, 16, ::Scripting::WeakLifetimeScope> scope;
47 // NOLINTEND
48 };
49
50public:
51 // member variables
52 // NOLINTBEGIN
53 ::ll::TypedStorage<8, 32, ::BaseGameVersion> mBaseGameVersion;
54 ::ll::TypedStorage<8, 8, ::Scripting::ScriptEngine&> mScriptEngine;
55 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::ScriptPlugin>>> mScriptPlugins;
56 ::ll::TypedStorage<8, 24, ::Scripting::RuntimeConditions> mCurrentRuntimeConditions;
57 ::ll::TypedStorage<1, 1, bool> mSystemPackDiscoveryError;
58 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DebuggerStatCollector>> mMemoryStatCollector;
59 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DebuggerStatCollector>> mHandleCountStatCollector;
60 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DebuggerStatCollector>> mSubscriberCountStatCollector;
61 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DebuggerStatCollector>> mQuickJsStatCollector;
62 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DebuggerStatCollector>> mScriptingStatCollector;
63 // NOLINTEND
64
65public:
66 // prevent constructor by default
67 ScriptPluginManager& operator=(ScriptPluginManager const&);
68 ScriptPluginManager(ScriptPluginManager const&);
69 ScriptPluginManager();
70
71public:
72 // member functions
73 // NOLINTBEGIN
74 MCAPI ::std::optional<::DebuggerStat> _collectHandleCountStats(uint64, uint64, uint64);
75
76 MCAPI ::std::optional<::DebuggerStat> _collectMemoryStats(uint64, uint64, uint64);
77
78 MCAPI ::std::optional<::DebuggerStat> _collectQuickJsStats(uint64, uint64, uint64);
79
80 MCAPI ::std::optional<::DebuggerStat>
81 _collectScriptingStats(::std::reference_wrapper<::ServerLevel> serverLevel, uint64, uint64, uint64);
82
83 MCAPI ::std::optional<::DebuggerStat> _collectSubscriberCountStats(
84 ::Bedrock::NotNullNonOwnerPtr<::ServerLevel> serverLevel,
85 ::gsl::not_null<::Scripting::DependencyLocator*> locator,
86 uint64,
87 uint64,
88 uint64
89 );
90
91#ifdef LL_PLAT_C
92 MCAPI void _createPluginContext(::ScriptPlugin& plugin, ::ScriptPluginResult& pluginResult);
93#endif
94
95#ifdef LL_PLAT_S
96 MCAPI void _createPluginContext(::ScriptPlugin& plugin, ::ScriptPluginResult& pluginResult);
97#endif
98
99 MCAPI void _disableHandleCounter();
100
101 MCAPI void _enableHandleCounter();
102
103 MCAPI void _reloadHandleCounter(bool publisherEnabled);
104
105#ifdef LL_PLAT_C
106 MCAPI void _runPlugin(::ScriptPlugin& plugin, ::ScriptPluginResult& pluginResult, ::Scripting::Privilege privilege);
107#endif
108
109 MCAPI ::Scripting::RuntimeStats collectRuntimeStats() const;
110
111#ifdef LL_PLAT_C
112 MCAPI ::ScriptPluginManagerResult createContextsForGroup(::PluginExecutionGroup group);
113#endif
114
115 MCAPI ::ScriptPluginManagerResult discoverPlugins(
116 ::ResourceInformation::ResourceType moduleType,
117 ::IScriptPluginSourceEnumerator& pluginEnumerator,
118 ::std::vector<::std::function<::ScriptModuleFilters::FilterResult(
119 ::PackManifest const&,
123 )>> const& moduleFilters,
124 ::std::vector<::mce::UUID> excludeModuleIDs,
125 ::std::function<::PluginExecutionGroup(::std::vector<::Scripting::ModuleDescriptor> const&)>&&
126 pluginExecutionGroupSelector
127 );
128
129 MCAPI void forEachRuntime(::std::function<void(::Scripting::IRuntime&)> func);
130
131 MCAPI ::std::vector<::Scripting::ModuleDescriptor> getPluginModuleDescriptors() const;
132
133 MCAPI ::std::vector<::ScriptPluginManager::PackNameAndWeakScope> getPluginScopes() const;
134
135#ifdef LL_PLAT_C
136 MCAPI ::ScriptPluginManagerResult runGroup(::PluginExecutionGroup group);
137#endif
138
139 MCAPI ~ScriptPluginManager();
140 // NOLINTEND
141
142public:
143 // destructor thunk
144 // NOLINTBEGIN
145 MCAPI void $dtor();
146 // NOLINTEND
147};
Definition DebuggerStatCollector.h:15
Definition DebuggerStat.h:10
Definition IScriptPluginSourceEnumerator.h:10
Definition PackManifest.h:39
Definition ScriptPluginManagerResult.h:12
Definition ScriptPluginResult.h:9
Definition ScriptPlugin.h:27
Definition DependencyLocator.h:7
Definition IRuntime.h:37
Definition ScriptEngine.h:21
Definition ServerLevel.h:57
Definition UUID.h:8
Definition ScriptPluginManager.h:41
Definition ModuleDescriptor.h:7
Definition RuntimeStats.h:7