diff options
Diffstat (limited to 'core/examples')
-rw-r--r-- | core/examples/http_bench_bin_ops.rs | 30 | ||||
-rw-r--r-- | core/examples/http_bench_json_ops.rs | 8 |
2 files changed, 19 insertions, 19 deletions
diff --git a/core/examples/http_bench_bin_ops.rs b/core/examples/http_bench_bin_ops.rs index bc92007b0..8d612f146 100644 --- a/core/examples/http_bench_bin_ops.rs +++ b/core/examples/http_bench_bin_ops.rs @@ -76,14 +76,14 @@ impl From<Record> for RecordBuf { } } -fn create_isolate() -> JsRuntime { - let mut isolate = JsRuntime::new(Default::default()); - register_op_bin_sync(&mut isolate, "listen", op_listen); - register_op_bin_sync(&mut isolate, "close", op_close); - register_op_bin_async(&mut isolate, "accept", op_accept); - register_op_bin_async(&mut isolate, "read", op_read); - register_op_bin_async(&mut isolate, "write", op_write); - isolate +fn create_js_runtime() -> JsRuntime { + let mut js_runtime = JsRuntime::new(Default::default()); + register_op_bin_sync(&mut js_runtime, "listen", op_listen); + register_op_bin_sync(&mut js_runtime, "close", op_close); + register_op_bin_async(&mut js_runtime, "accept", op_accept); + register_op_bin_async(&mut js_runtime, "read", op_read); + register_op_bin_async(&mut js_runtime, "write", op_write); + js_runtime } fn op_listen( @@ -172,7 +172,7 @@ fn op_write( } fn register_op_bin_sync<F>( - isolate: &mut JsRuntime, + js_runtime: &mut JsRuntime, name: &'static str, op_fn: F, ) where @@ -193,11 +193,11 @@ fn register_op_bin_sync<F>( Op::Sync(buf) }; - isolate.register_op(name, base_op_fn); + js_runtime.register_op(name, base_op_fn); } fn register_op_bin_async<F, R>( - isolate: &mut JsRuntime, + js_runtime: &mut JsRuntime, name: &'static str, op_fn: F, ) where @@ -227,7 +227,7 @@ fn register_op_bin_async<F, R>( Op::Async(fut.boxed_local()) }; - isolate.register_op(name, base_op_fn); + js_runtime.register_op(name, base_op_fn); } fn bad_resource_id() -> Error { @@ -246,7 +246,7 @@ fn main() { // NOTE: `--help` arg will display V8 help and exit deno_core::v8_set_flags(env::args().collect()); - let mut isolate = create_isolate(); + let mut js_runtime = create_js_runtime(); let mut runtime = runtime::Builder::new() .basic_scheduler() .enable_all() @@ -254,13 +254,13 @@ fn main() { .unwrap(); let future = async move { - isolate + js_runtime .execute( "http_bench_bin_ops.js", include_str!("http_bench_bin_ops.js"), ) .unwrap(); - isolate.await + js_runtime.await }; runtime.block_on(future).unwrap(); } diff --git a/core/examples/http_bench_json_ops.rs b/core/examples/http_bench_json_ops.rs index a260159e5..106b96f36 100644 --- a/core/examples/http_bench_json_ops.rs +++ b/core/examples/http_bench_json_ops.rs @@ -41,7 +41,7 @@ impl log::Log for Logger { fn flush(&self) {} } -fn create_isolate() -> JsRuntime { +fn create_js_runtime() -> JsRuntime { let mut runtime = JsRuntime::new(Default::default()); runtime.register_op("listen", deno_core::json_op_sync(op_listen)); runtime.register_op("close", deno_core::json_op_sync(op_close)); @@ -179,7 +179,7 @@ fn main() { // NOTE: `--help` arg will display V8 help and exit deno_core::v8_set_flags(env::args().collect()); - let mut isolate = create_isolate(); + let mut js_runtime = create_js_runtime(); let mut runtime = runtime::Builder::new() .basic_scheduler() .enable_all() @@ -187,13 +187,13 @@ fn main() { .unwrap(); let future = async move { - isolate + js_runtime .execute( "http_bench_json_ops.js", include_str!("http_bench_json_ops.js"), ) .unwrap(); - isolate.await + js_runtime.await }; runtime.block_on(future).unwrap(); } |