Skip to content

Commit 0e6b776

Browse files
committed
In version for .NET Core improved a performance of the embedding of objects and types
1 parent d395655 commit 0e6b776

26 files changed

+2053
-1371
lines changed
Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
#if NETSTANDARD
3-
using System.Collections.Generic;
4-
using System.Runtime.InteropServices;
5-
#endif
62

73
using MsieJavaScriptEngine.Utilities;
84

@@ -22,18 +18,6 @@ internal abstract class ChakraJsRtJsEngineBase : InnerJsEngineBase
2218
/// Flag indicating whether debugging started
2319
/// </summary>
2420
private StatedFlag _debuggingStartedFlag;
25-
#if NETSTANDARD
26-
27-
/// <summary>
28-
/// Set of external objects
29-
/// </summary>
30-
protected HashSet<object> _externalObjects = new HashSet<object>();
31-
32-
/// <summary>
33-
/// Callback for finalization of external object
34-
/// </summary>
35-
protected JsObjectFinalizeCallback _externalObjectFinalizeCallback;
36-
#endif
3721

3822
/// <summary>
3923
/// Script dispatcher
@@ -52,9 +36,6 @@ protected ChakraJsRtJsEngineBase(JsEngineSettings settings)
5236
_dispatcher = new ScriptDispatcher();
5337
#else
5438
_dispatcher = new ScriptDispatcher(settings.MaxStackSize);
55-
#endif
56-
#if NETSTANDARD
57-
_externalObjectFinalizeCallback = ExternalObjectFinalizeCallback;
5839
#endif
5940
}
6041

@@ -71,50 +52,5 @@ protected void StartDebugging()
7152
}
7253

7354
protected abstract void InnerStartDebugging();
74-
#if NETSTANDARD
75-
76-
private void ExternalObjectFinalizeCallback(IntPtr data)
77-
{
78-
if (data == IntPtr.Zero)
79-
{
80-
return;
81-
}
82-
83-
GCHandle handle = GCHandle.FromIntPtr(data);
84-
object obj = handle.Target;
85-
86-
if (obj != null && _externalObjects != null)
87-
{
88-
_externalObjects.Remove(obj);
89-
}
90-
91-
handle.Free();
92-
}
93-
#endif
94-
95-
#region IDisposable implementation
96-
97-
/// <summary>
98-
/// Destroys object
99-
/// </summary>
100-
/// <param name="disposing">Flag, allowing destruction of
101-
/// managed objects contained in fields of class</param>
102-
protected virtual void Dispose(bool disposing)
103-
{
104-
#if NETSTANDARD
105-
if (disposing)
106-
{
107-
if (_externalObjects != null)
108-
{
109-
_externalObjects.Clear();
110-
_externalObjects = null;
111-
}
112-
113-
_externalObjectFinalizeCallback = null;
114-
}
115-
#endif
116-
}
117-
118-
#endregion
11955
}
12056
}

0 commit comments

Comments
 (0)