Skip to content

Commit c31e72d

Browse files
committed
In JavaScriptEngineSwitcher.ChakraCore was removed MaxStackSize configuration property from the version for .NET Standard 1.3
1 parent 891da69 commit c31e72d

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ public ChakraCoreJsEngine(ChakraCoreSettings settings)
159159
attributes |= JsRuntimeAttributes.EnableExperimentalFeatures;
160160
}
161161

162+
#if NETSTANDARD1_3
163+
_dispatcher = new ScriptDispatcher();
164+
#else
162165
_dispatcher = new ScriptDispatcher(chakraCoreSettings.MaxStackSize);
166+
#endif
163167
_externalObjectFinalizeCallback = ExternalObjectFinalizeCallback;
164168
_promiseContinuationCallback = PromiseContinuationCallback;
165169

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreSettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace JavaScriptEngineSwitcher.ChakraCore
1111
/// </summary>
1212
public sealed class ChakraCoreSettings
1313
{
14+
#if !NETSTANDARD1_3
1415
/// <summary>
1516
/// The stack size is sufficient to run the code of modern JavaScript libraries in 32-bit process
1617
/// </summary>
@@ -26,6 +27,7 @@ public sealed class ChakraCoreSettings
2627
/// </summary>
2728
private int _maxStackSize;
2829

30+
#endif
2931
/// <summary>
3032
/// Gets or sets a flag for whether to disable any background work (such as garbage collection)
3133
/// on background threads
@@ -90,6 +92,7 @@ public bool EnableExperimentalFeatures
9092
get;
9193
set;
9294
}
95+
#if !NETSTANDARD1_3
9396

9497
/// <summary>
9598
/// Gets or sets a maximum stack size in bytes
@@ -115,6 +118,7 @@ public int MaxStackSize
115118
_maxStackSize = value;
116119
}
117120
}
121+
#endif
118122

119123
/// <summary>
120124
/// Gets or sets a current memory limit for a runtime in bytes
@@ -139,7 +143,9 @@ public ChakraCoreSettings()
139143
DisableFatalOnOOM = false;
140144
DisableNativeCodeGeneration = false;
141145
EnableExperimentalFeatures = false;
146+
#if !NETSTANDARD1_3
142147
MaxStackSize = is64BitProcess ? STACK_SIZE_64 : STACK_SIZE_32;
148+
#endif
143149
MemoryLimit = is64BitProcess ? new UIntPtr(ulong.MaxValue) : new UIntPtr(uint.MaxValue);
144150
}
145151
}

src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ This package does not contain the native implementations of ChakraCore. Therefor
2424
<PackageIconUrl>https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png</PackageIconUrl>
2525
<PackageTags>JavaScriptEngineSwitcher;JavaScript;ECMAScript;ChakraCore</PackageTags>
2626
<PackageReleaseNotes>1. No longer used the old ChakraCore API for Windows (Internet Explorer-like API);
27-
2. Optimized a memory usage.</PackageReleaseNotes>
27+
2. Optimized a memory usage;
28+
3. `MaxStackSize` configuration property was removed from the version for .NET Standard 1.3.</PackageReleaseNotes>
2829
</PropertyGroup>
2930

3031
<Import Project="../../build/common.props" />

src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,21 @@ internal sealed class ScriptDispatcher : IDisposable
4444
private InterlockedStatedFlag _disposedFlag = new InterlockedStatedFlag();
4545

4646

47+
#if NETSTANDARD1_3
48+
/// <summary>
49+
/// Constructs an instance of script dispatcher
50+
/// </summary>
51+
public ScriptDispatcher()
52+
{
53+
_thread = new Thread(StartThread)
54+
#else
4755
/// <summary>
4856
/// Constructs an instance of script dispatcher
4957
/// </summary>
5058
/// <param name="maxStackSize">The maximum stack size, in bytes, to be used by the thread,
5159
/// or 0 to use the default maximum stack size specified in the header for the executable.</param>
5260
public ScriptDispatcher(int maxStackSize)
5361
{
54-
#if NETSTANDARD1_3
55-
_thread = new Thread(StartThread)
56-
#else
5762
_thread = new Thread(StartThread, maxStackSize)
5863
#endif
5964
{

src/JavaScriptEngineSwitcher.ChakraCore/readme.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
=============
3333
1. No longer used the old ChakraCore API for Windows (Internet Explorer-like
3434
API);
35-
2. Optimized a memory usage.
35+
2. Optimized a memory usage;
36+
3. `MaxStackSize` configuration property was removed from the version for .NET
37+
Standard 1.3.
3638

3739
=============
3840
DOCUMENTATION

0 commit comments

Comments
 (0)