forked from Taritsyn/JavaScriptEngineSwitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathV8PrecompiledScript.cs
More file actions
78 lines (67 loc) · 1.69 KB
/
V8PrecompiledScript.cs
File metadata and controls
78 lines (67 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using OriginalCacheKind = Microsoft.ClearScript.V8.V8CacheKind;
using JavaScriptEngineSwitcher.Core;
namespace JavaScriptEngineSwitcher.V8
{
/// <summary>
/// Represents a pre-compiled script that can be executed by different instances of the V8 JS engine
/// </summary>
internal sealed class V8PrecompiledScript : IPrecompiledScript
{
/// <summary>
/// Gets a source code of the script
/// </summary>
public string Code
{
get;
private set;
}
/// <summary>
/// Gets a kind of cache data to be generated
/// </summary>
public OriginalCacheKind CacheKind
{
get;
private set;
}
/// <summary>
/// Gets a cached data for accelerated recompilation
/// </summary>
public byte[] CachedBytes
{
get;
private set;
}
/// <summary>
/// Gets a document name
/// </summary>
public string DocumentName
{
get;
private set;
}
/// <summary>
/// Constructs an instance of pre-compiled script
/// </summary>
/// <param name="code">The source code of the script</param>
/// <param name="cacheKind">The kind of cache data to be generated</param>
/// <param name="cachedBytes">Cached data for accelerated recompilation</param>
/// <param name="documentName">Document name</param>
public V8PrecompiledScript(string code, OriginalCacheKind cacheKind, byte[] cachedBytes,
string documentName)
{
Code = code;
CacheKind = cacheKind;
CachedBytes = cachedBytes;
DocumentName = documentName;
}
#region IPrecompiledScript implementation
/// <summary>
/// Gets a name of JS engine for which the pre-compiled script was created
/// </summary>
public string EngineName
{
get { return V8JsEngine.EngineName; }
}
#endregion
}
}