Commit graph

19 commits

Author SHA1 Message Date
Ms2ger
203d1669c8 Construct a new JSRef in Root::r(). 2015-01-02 10:28:24 +01:00
Ms2ger
c9f26dfd59 Rename Root::root_ref() to Root::r().
As it will be used much more widely after the upcoming changes, this limits
the effort reading and writing the method calls.
2015-01-01 20:36:43 +01:00
Ms2ger
1290c18794 Remove the 'b lifetime from Root.
It does not add any safety, as the reference is constructed from a raw pointer
without limiting the lifetime in any way.
2015-01-01 20:36:43 +01:00
Ms2ger
95ec20bd97 Remove the 'a lifetime from Root.
It does not add any safety, as the reference is constructed from a raw pointer
without limiting the lifetime in any way.
2015-01-01 20:36:43 +01:00
Josh Matthews
2f059c15e7 Allow refcounting arbitrary DOM objects in concert with the GC to enable safe, asynchronous/cross-task references to pinned objects. 2014-12-29 13:53:48 -05:00
Josh Matthews
8ff3e6bbdc Create a replacement for Cell<SM primitive>. Fixes #4337. 2014-12-19 11:17:02 -05:00
Manish Goregaokar
5511e02a78 Add Comparable trait to js.rs; fixups 2014-12-06 02:51:52 -08:00
Ms2ger
d26283c065 Implement MutNullableJS::or_init.
This will make it easier to implement lazy getters.
2014-12-04 15:49:29 +01:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Patrick Walton
5e9127e2b2 script: Use a 16-element SmallVec for the root collection.
In my tests the size of the root collection never exceeded 7, so 16
seems like a nice conservative number.
2014-10-28 11:12:09 -07:00
Josh Matthews
54fcab61d6 Implement MutNullableJS for mutable, nullable member pointers to DOM objects. 2014-10-01 17:06:23 +02:00
bors-servo
c10948736f Merge pull request #3497 from zwarich/extended-deref
Add an extended_deref method to JSRef

Reviewed-by: Manishearth
2014-09-27 12:48:30 -06:00
Cameron Zwarich
8334942d0c Add an extended_deref method to JSRef
The extended_deref method will take a JSRef<'a, T> and produce an &'a T,
in contrast to the standard deref method that takes an &'b JSRef<'a, T>
and produces an &'a T. This is useful when avoiding passing a JSRef by
reference.
2014-09-26 18:37:26 -07:00
Cameron Zwarich
78f061ee54 Improve the correctness of Root lifetimes
Use the new lifetime bounds feature of Rust to enforce that the
RootCollection field of Root outlives the jsref field. This still
doesn't enforce that the Root itself outlives the jsref field, and
doing this would require some sort of init dance.
2014-09-26 14:25:43 -07:00
Keegan McAllister
a640a7c5c3 Upgrade to rustc 0.12.0-pre (4d2af3861 2014-09-17 15:51:11 +0000) 2014-09-20 13:00:06 -07:00
Cameron Zwarich
4fa8725111 First steps of &JSRef -> JSRef conversion
Replace &JSRef with JSRef in the bulk of the generated code. This will
remove a level of indirection throughout all DOM code.

This patch doesn't change methods implemented on JSRef<T> to take `self`
rather than `&self`, and it leaves a few other uses of &JSRef, but those
changes can be made incrementally.
2014-09-19 13:39:17 -07:00
Manish Goregaokar
d241826987 Unwrap pointers and miscellany for unrooted_must_root check 2014-09-16 23:31:40 +05:30
Manish Goregaokar
12dc54d238 Add unrooted_must_root lint for enums and structs containing JS<T>, as well as functions with JS<T> in their parameter list
For safe wrappers over JS<T> (eg Temporary<T>) use #[allow(unrooted_must_root)].
For all other types containing a #[must_root] value, annotate the type with #[must_root] to ensure that it is never used unrooted
2014-09-16 22:11:27 +05:30
Jack Moffitt
c6ab60dbfc Cargoify servo 2014-09-08 20:21:42 -06:00
Renamed from src/components/script/dom/bindings/js.rs (Browse further)