Commit graph

46 commits

Author SHA1 Message Date
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Anthony Ramine
31a14082eb Make JSTraceable for DomRefCell<T> panic if cell is mutably borrowed (see #19871) 2018-01-26 10:12:40 +01:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
Gecko Backout
11c64178d8 Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
2017-10-19 21:26:51 +00:00
Bastien Orivel
e8e2d0a4b2 Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02: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
a819cfb0fa Replace uses of libcore with libstd in components/script 2017-10-16 20:19:59 +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
30f0553ac7 Introduce PendingScript
This moves scripts' loading results in Document, instead of maintaining them
behind a DOMRefCell in each HTMLScriptElement.
2017-01-11 17:37:19 +01:00
Anthony Ramine
1854566683 Update to Rust 1.14.0-nightly (19ac57926 2016-10-08)
A cargo bump and a switch to serde_derive is needed to do this rustup.
2016-10-09 18:53:47 +02:00
Simon Sapin
d15ac9be55 Don’t pretend DOMRefCell is Send or Sync, after all. 2016-10-04 18:35:03 +02:00
Simon Sapin
fbde392c3d Revert "Make DOMRefCell use style’s copy of RefCell"
This reverts commit ec723057b2.
2016-10-04 18:35:01 +02:00
Simon Sapin
c831369e3e Move DOMRefCell back into script.
We’re not using it in style after all.
2016-10-04 18:35:00 +02:00
Simon Sapin
c87180a2fb Move DOMRefCell to style. 2016-08-31 02:34:05 +02:00
Simon Sapin
ec723057b2 Make DOMRefCell use style’s copy of RefCell 2016-08-31 02:34:04 +02:00
Anthony Ramine
e034117152 Update Rust to 1.13.0-nightly (3c5a0fa45 2016-08-22) 2016-08-23 17:05:41 +02:00
Ms2ger
307d1ced3c Move thread_state to style. 2016-08-22 16:08:56 +02:00
Anthony Ramine
2e310f83ad Use feature try_borrow instead of borrow_state in script 2016-08-20 20:37:54 +02:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Ms2ger
0c61be7a57 Rustfmt some of script. 2015-11-18 11:14:05 +01:00
Bobby Holley
069c40f788 Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of
avoiding dirtying in the case where an event state is toggled an even
number of times between reflows.

The main benefit here though is that it sets us up to be smarter about
what we mark as dirty using restyle hints.
2015-10-27 12:48:48 -07:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
Josh Matthews
8620fe5995 Start reporting memory usage for Window and all nodes in all DOM trees for frame treese in script tasks. 2015-08-03 23:05:00 -04:00
Michael Wu
b7301ca06c Fix some warnings caused by the SM upgrade 2015-06-19 22:07:08 -04:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
Josh Matthews
5c7be5c9c3 Make async XMLHttpRequest requests use async network events. 2015-04-16 11:46:39 -04:00
Corey Farwell
2a01cec521 Utilize Option::expect 2015-04-06 14:06:05 -07:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Avi Weinstock
bcc27d9bd0 Replace borrow with borrow_for_gc_trace in JSTraceable::trace (Issue #4778). 2015-03-03 09:06:45 -05:00
Tetsuharu OHZEKI
dbb0f49bc7 DOMRefCell<T>.is_mutably_borrowed() should return the state correctly.
This method returned the result of `RefCell<T>.try_borrow().is_some()`.
But it meant whether the state **is not** BorrowState::Writing.

This wrong is introduced by [1], Before it revision, this method had
returned whether the state is BorrowState::Writing or not.

This doesn't change callers of this method because git blames ([3], [4]) says
that the caller is introduced by [2] and [2] is introduced before [1].

[1]: 86d609abaf
[2]: 49234484d6
[3]: 2cc08f289a/components/script/dom/servohtmlparser.rs
[4]: a7e29939a1/components/script/dom/bindings/cell.rs
2015-02-13 05:53:22 +09:00
Tetsuharu OHZEKI
552a418a33 Fix warnings about RefCell<T>.try_borrow(). 2015-02-13 05:40:46 +09:00
Diego Marcos
7b9c902a0a Adds borrow_for_script_deallocation and unsafe_mut_js_info method to avoid 'DOMRefCell already mutably borrowed' messages. This is just a temporary fix until the Rust standard library allows borrowing already-borrowed RefCell values during unwinding.
It also removes LiveDOMReferences destructor that it's a no-op but it contains an assert that was being violated causing an endless cycle of destructor calls ending up in a stack overflow.
2015-01-30 12:07:53 -08:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
Ms2ger
238f3e2d91 Require documentation for all code in dom::bindings (excluding dom::bindings::codegen). 2015-01-25 22:01:04 +01:00
Ms2ger
7ec11b22b4 Document DOMRefCell.
Based on the RefCell documentation.
2014-12-20 15:11:20 +01:00
Ms2ger
0274978a08 Remove the unused DOMRefCell::unwrap method. 2014-12-20 15:03:11 +01:00
Ms2ger
86d609abaf Use RefCell in DOMRefCell to reduce duplicated code. 2014-11-14 21:18:43 +01:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Keegan McAllister
f508a82582 Provide safety check helpers in release builds
debug_assert! uses

    if cfg!(not(ndebug)) { ... }

so the body in a release build is dead code, but it still needs to compile.
2014-10-24 16:53:58 -07:00
Keegan McAllister
49234484d6 Ignore the HTML parser's borrow flag in GC tracing
Adds some other dynamic checks in debug builds.
2014-10-24 16:27:37 -07:00
Keegan McAllister
6ec0939a22 Dynamically check DOMRefCell access from layout in debug builds 2014-10-24 16:27:37 -07:00
Keegan McAllister
96e180a22c Customize RefCell instead of wrapping it
This gets rid of a dubious transmute:

    let val = mem::transmute::<&RefCell<T>, &T>(&self.base);

The code duplication will be reduced once rust-lang/rust#18131 is fixed.
2014-10-24 16:27:36 -07:00
Tetsuharu OHZEKI
80593d9cc5 Add DOMRefCell<T> for safe borrowing in layout.
This type simply wraps `RefCell<T>` to add the special method,
and introduce the method to return the pointer of the value contained in
itself, for used in layout task.
2014-10-15 13:41:03 +09:00