Commit graph

85 commits

Author SHA1 Message Date
Simon Sapin
a3971eb686 Replace rust-encoding with encoding-rs 2017-11-01 10:16:11 +01: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
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
c52fd0a780 Rename MutNullableJS<T> to MutNullableDom<T> 2017-09-26 09:49:02 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Josh Matthews
77b3e911c1 Remove almost all uses of Heap::new. 2017-09-25 16:11:49 -04:00
Josh Matthews
da65698c5c Be more conservative about safety of dictionary and union values.
Mark dictionaries containing GC values as must_root, and wrap them in
RootedTraceableBox in automatically-generated APIs. To accommodate
union variants that are now flagged as unsafe, add RootedTraceableBox
to union variants that need to be rooted, rather than wrapping the
entire union value.
2017-09-25 16:10:58 -04:00
Anthony Ramine
6c9fb5ae7a Introduce TaskOnce
Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing
from CancellableTask<T>.
2017-09-20 10:37:09 +02:00
Anthony Ramine
46628fba05 Move Task to its own module 2017-09-18 02:47:04 +02:00
Anthony Ramine
4a39631eaf Remove FileReadingRunnable 2017-09-16 15:43:31 +02:00
Anthony Ramine
56117d3185 Rename Runnable to Task
The changes are:
 * `*Runnable` -> `*Task`;
 * `RunnableMsg` -> `Task`;
 * `RunnableWrapper` -> `TaskCanceller`;
 * `MainThreadRunnable` -> `MainThreadTask`;
 * `wrap_runnable` -> `wrap_task`;
 * `get_runnable_wrapper` -> `task_canceller`;
 * `handler` -> `run`;
 * `main_thread_handler` -> `run_with_script_thread`.
2017-09-16 15:43:26 +02:00
Anthony Ramine
7875fea6cf Use absolute paths in the event handlers macros 2017-09-01 11:54:09 +02:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
Anthony Ramine
0ed4df28b5 Replace use of rustc_serialize::base64 by base64 2017-03-26 14:15:31 +02:00
Charles Vandevoorde
44e05e224c Remove support for Blob::{close, isClosed} 2017-02-28 17:20:16 +01:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Ms2ger
8ce9ca6243 Use Heap for dictionary and union members. 2017-02-16 11:03:21 +01:00
Ms2ger
67c572af37 Update js.
Fixes #15553.
2017-02-15 16:27:29 +01:00
Ms2ger
2c7c8fd2be Use an ArrayBuffer to implement readAsArrayBuffer. 2017-01-19 15:41:16 +01:00
Alan Jeffrey
9be4fd56ce Removed util. 2016-12-14 18:04:37 -06:00
Anthony Ramine
1327ebd52f Remove HeapGCValue
It could be used to have mutable JSVal fields without GC barriers.
With the removal of that trait, MutHeap and MutNullableHeap can respectively
be replaced by MutJS and MutNullableJS.
2016-12-12 10:47:54 -10:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Abelardo E. Mendoza
b372e7c98f script creates methods taking '*mut JSContext' unsafe
rebase + marked the necessary new code as unsafe
2016-11-14 11:06:17 +01:00
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Ms2ger
558afe1786 Update js. 2016-11-02 13:25:49 +01:00
Nikhil Shagrithaya
51ef05bf3d Implemented FileReader::readAsArrayBuffer 2016-11-01 00:25:26 +05:30
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
e7a1149984 Introduce GlobalScope::file_reading_task_source 2016-10-06 21:35:57 +02:00
Anthony Ramine
514819f37a Introduce GlobalScope::get_runnable_wrapper 2016-10-06 21:35:51 +02:00
Anthony Ramine
19108aa330 Pass a &GlobalScope to WebIDL static methods and constructors 2016-10-06 21:35:49 +02:00
Anthony Ramine
ae6af5172b Introduce Reflectable::global_scope 2016-10-06 21:35:38 +02:00
Anthony Ramine
fcb59d3057 Make reflect_dom_object take a &GlobalScope 2016-10-06 20:59:09 +02:00
Keith Yeung
aa5f34fcd9 Implement file reading task source
And remove superfluous FileReaderEvent enum
2016-07-14 13:27:42 -04:00
Nikhil Shagrithaya
48fe15206e Implements name method for FilerReader event from trait Runnable 2016-07-10 15:40:22 +05:30
Zhen Zhang
ab14777312 Remove DataSlice, fix #12249 2016-07-05 17:51:53 +08:00
Zhen Zhang
43ad4ba585 Add file backend support for Blob and related
Changes include:
- Add BlobImpl to Blob, and related caching mechanism
- Expose ResourceThreads to document_loader, workerglobalscope, worker, and global
- Fix encode_multipart_form_data
- Other small fixes to accommodate the above changes
2016-06-01 09:47:07 +08:00
Josh Matthews
3cb8af20c2 Remove empty lines following braces. 2016-05-27 13:32:05 -04:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Keith Yeung
33acb1937c Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
Rahul Sharma
2caa9a2a76 refactors entities from script_thread into script_runtime 2016-04-06 12:46:49 +05:30
Kamil Muszyński
c6dfd7e2fa Issue #9561 continued - renamed *_thread_source to *_task_source in global.rs and related files 2016-02-17 21:25:12 +01:00
Chad Kimes
ce6075825d Add global default method for Reflectable trait 2016-01-11 20:23:47 -05:00
Chad Kimes
efaf4cdeca Remove global field from FileReader 2016-01-10 22:45:31 -05:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
David Raifaizen
76f689cd06 Changed blob to use DataSlice with Arc in order to limit wasteful copying of byte vector 2016-01-06 19:41:52 -05:00
Arthur Skobara
8acb21a594 Remove from Trusted::new an unnecessary argument 2015-12-12 22:31:19 +06:00
Corey Farwell
4accaf50b2 Pass around event types as Atoms instead of Strings
`Event` internally stores the `type` as an `Atom`, and we're `String`s
everywhere, which can cause unnecessary allocations to occur since
they'll end up as `Atom`s anyways.
2015-12-10 23:47:25 -05:00