| 8 | namespace |
| 9 | { |
| 10 | class Module final |
| 11 | { |
| 12 | public: |
| 13 | Module(const char* executablePath) |
| 14 | { |
| 15 | v8::V8::InitializeICUDefaultLocation(executablePath); |
| 16 | v8::V8::InitializeExternalStartupData(executablePath); |
| 17 | m_platform = v8::platform::NewDefaultPlatform(); |
| 18 | v8::V8::InitializePlatform(m_platform.get()); |
| 19 | v8::V8::Initialize(); |
| 20 | } |
| 21 | |
| 22 | ~Module() |
| 23 | { |
| 24 | v8::V8::Dispose(); |
| 25 | v8::V8::ShutdownPlatform(); |
| 26 | } |
| 27 | |
| 28 | static void Initialize(const char* executablePath) |
| 29 | { |
| 30 | if (s_module == nullptr) |
| 31 | { |
| 32 | s_module = std::make_unique<Module>(executablePath); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | private: |
| 37 | std::unique_ptr<v8::Platform> m_platform; |
| 38 | |
| 39 | static std::unique_ptr<Module> s_module; |
| 40 | }; |
| 41 | |
| 42 | std::unique_ptr<Module> Module::s_module; |
| 43 | } |
nothing calls this directly
no outgoing calls
no test coverage detected