From 3cccadcf0fbfc7ff4e7dd37299a65bea1cf0eab0 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 11 May 2020 20:20:14 +0200 Subject: Change plugin interface to prevent segfaults when unloading plugin (#5210) Fixes: #3473 Closes: #5193 --- test_plugin/src/lib.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'test_plugin/src') diff --git a/test_plugin/src/lib.rs b/test_plugin/src/lib.rs index 2304cd65b..37868b310 100644 --- a/test_plugin/src/lib.rs +++ b/test_plugin/src/lib.rs @@ -1,20 +1,17 @@ -extern crate deno_core; -extern crate futures; - -use deno_core::Buf; -use deno_core::CoreIsolate; -use deno_core::Op; -use deno_core::ZeroCopyBuf; +use deno_core::plugin_api::Buf; +use deno_core::plugin_api::Interface; +use deno_core::plugin_api::Op; +use deno_core::plugin_api::ZeroCopyBuf; use futures::future::FutureExt; #[no_mangle] -pub fn deno_plugin_init(isolate: &mut CoreIsolate) { - isolate.register_op("testSync", op_test_sync); - isolate.register_op("testAsync", op_test_async); +pub fn deno_plugin_init(interface: &mut dyn Interface) { + interface.register_op("testSync", op_test_sync); + interface.register_op("testAsync", op_test_async); } -pub fn op_test_sync( - _isolate: &mut CoreIsolate, +fn op_test_sync( + _interface: &mut dyn Interface, data: &[u8], zero_copy: Option, ) -> Op { @@ -31,8 +28,8 @@ pub fn op_test_sync( Op::Sync(result_box) } -pub fn op_test_async( - _isolate: &mut CoreIsolate, +fn op_test_async( + _interface: &mut dyn Interface, data: &[u8], zero_copy: Option, ) -> Op { -- cgit v1.2.3