Commit graph

35 commits

Author SHA1 Message Date
Anthony Ramine
50d31f7ec4 Don't access the reflector when dropping a Promise (fixes #18651)
The reflector may be dead already.
2018-03-15 09:53:33 +01:00
Simon Sapin
4d459bce32 Fix tyvar_behind_raw_pointer warnings
https://github.com/rust-lang/rust/issues/46906
2018-01-10 20:54:35 +01:00
Matt Brubeck
9cadf0981a Remove unnecessary Result::ok calls 2017-10-20 09:11:38 -07:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Anthony Ramine
386973efeb Make Promise::new_resolved unsafe 2017-09-22 14:18:32 +02:00
Anthony Ramine
a69c5da208 Make Promise::new_rejected unsafe 2017-09-22 14:18:28 +02:00
Anthony Ramine
860f2d806f Rename Promise::is_settled to Promise::is_fulfilled 2017-09-22 14:18:25 +02:00
Anthony Ramine
dabecfade6 Remove unused method Promise::then 2017-09-22 14:18:23 +02:00
Anthony Ramine
d31018d444 Make Promise::reject unsafe 2017-09-22 14:18:20 +02:00
Anthony Ramine
2400731bfc Make Promise::resolve unsafe 2017-09-22 02:15:28 +02:00
Anthony Ramine
af2e83f378 Make Promise::reject_error sound 2017-09-22 02:15:22 +02:00
Anthony Ramine
15acd1525e Make Promise::reject_native sound 2017-09-21 16:19:29 +02:00
Anthony Ramine
5addc2dfa3 Make Promise::resolve_native actually sound
We shouldn't have to pass a raw JSContext pointer, and to enter the
promise's context's compartment by hand.
2017-09-21 16:00:48 +02:00
Anthony Ramine
658dc8a501 Rename a couple of Promise methods 2017-09-21 15:35:04 +02:00
Alan Jeffrey
af8436c9be Implemented Houdini worklets. 2017-05-17 09:01:05 -05:00
mckaymatt
63f9ad022f Add way to get c_void ptr or c_char from caller 2017-04-04 16:46:52 -04:00
SendilKumar N
2996d3a413 removing mutHeapJs references
changes as per comments
2017-03-07 17:37:44 +08:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Josh Matthews
e5eaab3523 Use Heap in DOM object reflector implementation to ensure GC barriers are used. 2017-01-20 11:32:19 -05:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Rahul Sharma
114c491111 Initial work on job queues for service workers 2016-11-22 01:29:37 +05:30
Ms2ger
558afe1786 Update js. 2016-11-02 13:25:49 +01:00
Anthony Ramine
d8e92bb271 Rename Reflectable::global_scope to global 2016-10-06 21:36:41 +02:00
Anthony Ramine
907781eb75 Remove Reflectable::global 2016-10-06 21:35:58 +02:00
Anthony Ramine
02d38e74e9 Make Promise::Reject and Resolve take a &GlobalScope 2016-10-06 21:35:54 +02:00
Anthony Ramine
ac5c4c2194 Make Error::to_jsval take a &GlobalScope 2016-10-06 21:35:42 +02:00
Anthony Ramine
ac5a4adf5f Make Promise::new take a &GlobalScope 2016-10-06 21:35:40 +02:00
Josh Matthews
e9c0606454 Remove maybe_ prefix from Promise methods. 2016-09-22 16:21:23 -04:00
Josh Matthews
498ccd41e8 Support an equivalent of Trusted<T> for Rc<Promise> objects named TrustedPromise. 2016-09-22 16:16:59 -04:00
Josh Matthews
27d44c8d10 Add a simple API to reject promises with DOM error values. 2016-09-22 16:16:58 -04:00
Josh Matthews
ef501603bf Ensure Promise "reflector" is not GCed before the Rust object. 2016-09-22 16:16:54 -04:00
Josh Matthews
ab168204ed Support native promise callbacks. 2016-09-22 16:16:52 -04:00
Josh Matthews
7ba3172ce0 Useful APIs for resolving/rejecting from native code. 2016-09-22 16:16:51 -04:00
Mátyás Mustoha
fd778b4240 Enqueue promise jobs from SpiderMonkey callbacks, and execute them in batches. Implement native Promise APIs.
Add SpiderMonkey hooks for enqueuing promise jobs. Start porting various native Promise APIs.
2016-09-22 16:16:49 -04:00
Josh Matthews
a1091772ec Implement binding support for returning and accepting Promises in WebIDL. 2016-09-22 16:16:48 -04:00