diff options
| author | andy finch <andyfinch7@gmail.com> | 2019-03-18 20:03:37 -0400 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-18 20:03:37 -0400 |
| commit | cdfd32dd74d6286afe99fb5400e3dc0e9f2cec49 (patch) | |
| tree | e8daa342c70ee472de28158d5448ed2078d0d9e9 /core/http_bench.rs | |
| parent | 34a2aa4de6cfe334cf0d26620d244d5c66a976a4 (diff) | |
Re-implement init scripts in core (#1958)
Re-enables arm64 CI test
Diffstat (limited to 'core/http_bench.rs')
| -rw-r--r-- | core/http_bench.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/core/http_bench.rs b/core/http_bench.rs index eb7acc379..cbb4bdea4 100644 --- a/core/http_bench.rs +++ b/core/http_bench.rs @@ -99,8 +99,13 @@ pub type HttpBenchOp = dyn Future<Item = i32, Error = std::io::Error> + Send; struct HttpBench(); impl Behavior for HttpBench { - fn startup_snapshot(&mut self) -> Option<deno_buf> { - None + fn startup_data(&mut self) -> Option<StartupData> { + let js_source = include_str!("http_bench.js"); + + Some(StartupData::Script(StartupScript { + source: js_source.to_string(), + filename: "http_bench.js".to_string(), + })) } fn resolve(&mut self, _specifier: &str, _referrer: deno_mod) -> deno_mod { @@ -164,15 +169,12 @@ impl Behavior for HttpBench { } fn main() { - let js_source = include_str!("http_bench.js"); - let main_future = lazy(move || { - let mut isolate = deno_core::Isolate::new(HttpBench()); - // TODO currently isolate.execute() must be run inside tokio, hence the // lazy(). It would be nice to not have that contraint. Probably requires // using v8::MicrotasksPolicy::kExplicit - js_check(isolate.execute("http_bench.js", js_source)); + let isolate = deno_core::Isolate::new(HttpBench()); + isolate.then(|r| { js_check(r); Ok(()) |
