File tree Expand file tree Collapse file tree 4 files changed +142
-5
lines changed Expand file tree Collapse file tree 4 files changed +142
-5
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,7 @@ unicode-normalization = "0.1.23"
285
285
url = " 2.3.1"
286
286
urlencoding = " 2.1.2"
287
287
uuid = { version = " 1.2.1" , features = [" v4" ] }
288
+ v8 = " 137.2"
288
289
walkdir = " 2.2.5"
289
290
wasmbin = " 0.6"
290
291
webbrowser = " 1.0.2"
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ tracing.workspace = true
112
112
url.workspace = true
113
113
urlencoding.workspace = true
114
114
uuid.workspace = true
115
+ v8.workspace = true
115
116
wasmtime.workspace = true
116
117
jwks.workspace = true
117
118
async_cache = " 0.3.1"
Original file line number Diff line number Diff line change @@ -24,17 +24,22 @@ impl ModuleRuntime for V8Runtime {
24
24
}
25
25
}
26
26
27
- static V8_RUNTIME_GLOBAL : LazyLock < V8RuntimeInner > = LazyLock :: new ( V8RuntimeInner :: new ) ;
27
+ static V8_RUNTIME_GLOBAL : LazyLock < V8RuntimeInner > = LazyLock :: new ( V8RuntimeInner :: init ) ;
28
28
29
29
/// The actual V8 runtime, with initialization of V8.
30
30
struct V8RuntimeInner {
31
31
_priv : ( ) ,
32
32
}
33
33
34
34
impl V8RuntimeInner {
35
- #[ allow( clippy:: new_without_default) ]
36
- const fn new ( ) -> Self {
37
- // TODO: actually setup V8.
35
+ fn init ( ) -> Self {
36
+ // Our current configuration:
37
+ // - will pick a number of worker threads for background jobs based on the num CPUs.
38
+ // - does not allow idle tasks
39
+ let platform = v8:: new_default_platform ( 0 , false ) . make_shared ( ) ;
40
+ // Initialize V8. Internally, this uses a global lock so it's safe that we don't.
41
+ v8:: V8 :: initialize_platform ( platform) ;
42
+ v8:: V8 :: initialize ( ) ;
38
43
39
44
Self { _priv : ( ) }
40
45
}
You can’t perform that action at this time.
0 commit comments