diff options
Diffstat (limited to 'core/isolate.rs')
-rw-r--r-- | core/isolate.rs | 65 |
1 files changed, 4 insertions, 61 deletions
diff --git a/core/isolate.rs b/core/isolate.rs index 5df5b4d3c..0f693ff92 100644 --- a/core/isolate.rs +++ b/core/isolate.rs @@ -269,34 +269,14 @@ impl Isolate { zero_copy_buf: deno_pinned_buf, ) { let isolate = unsafe { Isolate::from_raw_ptr(user_data) }; - let control_shared = isolate.shared.shift(); - let op = if control_argv0.len() > 0 { - // The user called Deno.core.send(control) - if let Some(ref f) = isolate.dispatch { - f(control_argv0.as_ref(), PinnedBuf::new(zero_copy_buf)) - } else { - panic!("isolate.dispatch not set") - } - } else if let Some(c) = control_shared { - // The user called Deno.sharedQueue.push(control) - if let Some(ref f) = isolate.dispatch { - f(&c, PinnedBuf::new(zero_copy_buf)) - } else { - panic!("isolate.dispatch not set") - } + let op = if let Some(ref f) = isolate.dispatch { + f(control_argv0.as_ref(), PinnedBuf::new(zero_copy_buf)) } else { - // The sharedQueue is empty. The shouldn't happen usually, but it's also - // not technically a failure. - #[cfg(test)] - unreachable!(); - #[cfg(not(test))] - return; + panic!("isolate.dispatch not set") }; - // At this point the SharedQueue should be empty. - assert_eq!(isolate.shared.size(), 0); - + debug_assert_eq!(isolate.shared.size(), 0); match op { Op::Sync(buf) => { // For sync messages, we always return the response via Deno.core.send's @@ -872,43 +852,6 @@ pub mod tests { } #[test] - fn test_shared() { - run_in_task(|| { - let (mut isolate, dispatch_count) = setup(Mode::AsyncImmediate); - - js_check(isolate.execute( - "setup2.js", - r#" - let nrecv = 0; - Deno.core.setAsyncHandler((buf) => { - assert(buf.byteLength === 1); - assert(buf[0] === 43); - nrecv++; - }); - "#, - )); - assert_eq!(dispatch_count.load(Ordering::Relaxed), 0); - - js_check(isolate.execute( - "send1.js", - r#" - let control = new Uint8Array([42]); - Deno.core.sharedQueue.push(control); - Deno.core.send(); - assert(nrecv === 0); - - Deno.core.sharedQueue.push(control); - Deno.core.send(); - assert(nrecv === 0); - "#, - )); - assert_eq!(dispatch_count.load(Ordering::Relaxed), 2); - assert_eq!(Async::Ready(()), isolate.poll().unwrap()); - js_check(isolate.execute("send1.js", "assert(nrecv === 2);")); - }); - } - - #[test] fn dyn_import_err() { // Test an erroneous dynamic import where the specified module isn't found. run_in_task(|| { |