1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

22 commits

Author SHA1 Message Date
Ryan Dahl
1770a77bca Clean up return value of deno_execute
and deno_respond
2019-02-02 16:46:31 -05:00
Ryan Dahl
00597ffde1
Refactor libdeno ES module interface. (#1624)
Allows for future asynchronous module loading.

Add support for import.meta.url

Fixes #1496
2019-01-30 17:21:31 -05:00
Kevin (Kun) "Kassimo" Qian
c870cf4082 Add --prefetch flag for deps prefetch without running (#1475) 2019-01-15 12:19:58 -05:00
Ryan Dahl
7024d9f253 Add rust binding and test for deno_execute_mod() 2019-01-03 09:45:40 -05:00
Ryan Dahl
d2b85d4904 Use camel-case for libdeno::deno_recv_cb
For better greppability and conformance with other symbols in libdeno.rs
2019-01-03 09:45:40 -05:00
Ryan Dahl
2c477dd7cb Happy new year! 2019-01-02 02:37:08 +01:00
Ryan Dahl
f986eb25c5
Merge deno_new_snapshotter behavior into deno_new (#1318) 2018-12-13 16:25:42 -05:00
F001
60c008d23b Isolate::from_raw_ptr and other cleanups.
`Isolate::from_void_ptr` is renamed to `from_raw_ptr`, to keep
consistency with std libs.

It is changed to `unsafe` function, because it can't guarantee that the
input is valid. This guarantee should be provided by the caller.

Its return type is changed to `&Isolate`, because `&mut Isolate` type
requires that no other aliases co-exist in this period of time, this
does not seem true. So I changed most of the methods to accept shared
reference `&Isolate`. It is easier to reason about the correctness of
`unsafe` blocks. As long as these shared references are in the same
thread, these `unsafe` codes are probably correct.
2018-12-05 00:14:53 -08:00
Ryan Dahl
d70b04c6d7
Add deno_config struct for isolate creation. (#1277)
In preperation for adding other callbacks to libdeno.
2018-12-04 15:06:20 -08:00
F001
30420ad317 Remove static lifetime bound in OpCreator (#1276)
The main purpose of this PR is to remove the `'static` lifetime bound in

type OpCreator =
  fn(state: &Arc<IsolateState>, base: &msg::Base, data: &'static mut [u8])
    -> Box<Op>;

The reason is simple: it is plain wrong, the `data` is actually not `'static`. It is created when the message is sent from C side, and will be recycled when the message is responded. It violates the definition of `'static` lifetime.

If someone save this pointer somewhere else, and reuse it later again, uninitialized memory could be accessed. This kind of memory unsafety does not happen yet because the logic is carefully organized in this project. Lifetime constraints are maintained by code convention. It could be more robust if we can express this constraint by Rust's type system.

Basic idea: tie buffer's lifetime to an object's lifetime, a.k.a, RAII. The type `deno_buf` is pretty suitable for this job.
2018-12-04 13:21:02 -08:00
F001
9e839b7e23 Avoid memory leak (#1265) 2018-12-03 19:07:34 -08:00
Andy Hayden
aab02805dd clippy fixes (#1250) 2018-11-30 00:30:49 -08:00
F001
b6fda735ee Replace mutex by atomics (#1238) 2018-11-29 19:03:00 -08:00
Ryan Dahl
0501330607 Add libdeno.shared global shared ArrayBuffer. 2018-10-24 14:52:38 -07:00
Ryan Dahl
fd68f85ce8 libdeno: deno_new should take a snapshot parameter. 2018-10-24 14:52:38 -07:00
Kevin (Kun) "Kassimo" Qian
45d3b8955d Fix promise reject issue (#936) 2018-10-12 14:22:52 -04:00
Bert Belder
4f3250bc43
Remove deno_get_data()
Instead, pass the isolate data to the dispatch callback directly.
2018-10-08 18:19:36 +02:00
Bert Belder
e742af10aa
Abide by the rules when passing Isolate between c and rust
Ensure that at most one mutable Isolate reference exists at a time.

`deno_execute()` and `deno_respond()` now borrow a reference to the rust-side
isolate from the caller. When we need a reference to the isolate while one of
these functions is on the stack, `deno_get_data()` can be used to borrow back
that reference.
2018-10-08 18:19:32 +02:00
Bert Belder
ad4c4c214a
Rename Deno.data to Deno.user_data
Also use the correct rust type for it.
2018-10-08 18:10:28 +02:00
Ryan Dahl
d38ccfc6dc
Support zero-copy data in libdeno.send(). (#838)
This is a large API refactor of deno.h which replaces
deno_send() and deno_set_response() with deno_respond().
It also adds a req_id parameter to the deno_recv_cb.

Make writeFile/writeFileSync use it.
2018-09-27 17:33:10 -04:00
ztplz
f3684c28e5 Rename deno.argv, libdeno::DenoC and deno_set_flags (#796) 2018-09-22 08:47:44 -04:00
Ryan Dahl
e7741ab97f Rename src/binding.rs -> src/libdeno.rs 2018-09-05 22:27:47 -04:00
Renamed from src/binding.rs (Browse further)