forked from mirrors/0ad
Remove ScriptContext::CreateContext
This function nudges one into using it instead of the constructor. Even though a `std::shared_ptr` isn't required.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -102,11 +102,6 @@ void GCSliceCallbackHook(JSContext*, JS::GCProgress progress, const JS::GCDescri
|
||||
#endif
|
||||
}
|
||||
|
||||
std::shared_ptr<ScriptContext> ScriptContext::CreateContext(int contextSize, uint32_t heapGrowthBytesGCTrigger)
|
||||
{
|
||||
return std::make_shared<ScriptContext>(contextSize, heapGrowthBytesGCTrigger);
|
||||
}
|
||||
|
||||
ScriptContext::ScriptContext(int contextSize, uint32_t heapGrowthBytesGCTrigger):
|
||||
m_JobQueue{std::make_unique<Script::JobQueue>()},
|
||||
m_ContextSize{contextSize},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -47,9 +47,6 @@ class JobQueue;
|
||||
class ScriptContext
|
||||
{
|
||||
public:
|
||||
ScriptContext(int contextSize, uint32_t heapGrowthBytesGCTrigger);
|
||||
~ScriptContext();
|
||||
|
||||
/**
|
||||
* Returns a context, in which any number of ScriptInterfaces compartments can live.
|
||||
* Each context should only ever be used on a single thread.
|
||||
@@ -57,10 +54,9 @@ public:
|
||||
* @param contextSize Maximum size in bytes of the new context
|
||||
* @param heapGrowthBytesGCTrigger Size in bytes of cumulated allocations after which a GC will be triggered
|
||||
*/
|
||||
static std::shared_ptr<ScriptContext> CreateContext(
|
||||
int contextSize = DEFAULT_CONTEXT_SIZE,
|
||||
ScriptContext(int contextSize = DEFAULT_CONTEXT_SIZE,
|
||||
uint32_t heapGrowthBytesGCTrigger = DEFAULT_HEAP_GROWTH_BYTES_GCTRIGGER);
|
||||
|
||||
~ScriptContext();
|
||||
|
||||
/**
|
||||
* MaybeIncrementalGC checks if running a GC is worth the time that will take.
|
||||
|
||||
Reference in New Issue
Block a user