Commit graph

152 commits

Author SHA1 Message Date
Ms2ger
601e80fa43 Simplify RootCollection::unroot a bit. 2015-02-23 22:46:41 +01:00
Ms2ger
6d30ec77c8 Replace uint/int by usize/isize in various places. 2015-02-20 14:45:47 +01:00
Ms2ger
7b1b030f8a Remove MutNullableJS::get_inner.
There should be no reason to call this.
2015-02-12 20:59:22 +01:00
Ms2ger
b3f93b25a5 Remove JS::unsafe_get.
The codegen users already migrated to Unrooted, and the layout users are
better off using LayoutJS.
2015-02-12 20:59:22 +01:00
Ms2ger
8ab7d37ef2 Add Unrooted::from_js.
There should not be a JS here; that is #2661. Until that's fixed, though,
it's better to encapsulate it.
2015-02-12 20:59:22 +01:00
Ms2ger
37584ab056 Improve documentation for MutHeap and RootCollection. 2015-02-10 12:52:52 +01:00
Ms2ger
84425bf4d7 Improve the documentation in js.rs. 2015-02-10 11:09:41 +01:00
Ms2ger
1d3cd4c34d Rewrap the documentation in js.rs to 80 columns for readability. 2015-02-10 09:43:19 +01:00
Ms2ger
147dadce89 Implement an Unrooted smart pointer to replace JS when it is not traced. 2015-02-06 12:33:32 +01:00
Ms2ger
4036206734 Remove the Root.jsref member.
It is simpler to just construct it when the methods are called.
2015-02-05 18:45:21 +01:00
Ms2ger
d8c2c88bbd Replace Root::deref by a custom get_unsound_ref_forever method.
This will hopefully make it clearer that this is not the correct function
to call.
2015-02-05 18:45:20 +01:00
Ms2ger
eb5759774c Remove JS::from_trusted_node_address. 2015-02-03 16:04:47 +01:00
Tetsuharu OHZEKI
2cca095481 Add LayoutJS<T: Reflectable>.get_jsobject(). 2015-02-01 01:54:38 +09:00
Tetsuharu OHZEKI
b7443bef83 Remove JS<From>.transmute<To>(). 2015-02-01 01:54:38 +09:00
Tetsuharu OHZEKI
9f57fa17d0 Add LayoutJS<Node>::from_trusted_node_address() 2015-02-01 01:54:38 +09:00
Tetsuharu OHZEKI
8889041c19 Use BarCast::to_layout_js() instead of LayoutJS.to_script(). 2015-02-01 01:54:37 +09:00
Tetsuharu OHZEKI
6b1e2bd11c Use LayoutJS<T> in layout crate. 2015-02-01 01:54:37 +09:00
Tetsuharu OHZEKI
a5d7240534 Introduce LayoutJS<T> 2015-02-01 01:50:16 +09:00
Ms2ger
5225442dc1 Use NonZero to reduce the size of DOM smart pointers (fixes #4502). 2015-01-30 22:18:22 +01: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
f8ac1777ff Don't shadow lifetimes in script. 2015-01-28 13:48:28 +01:00
bors-servo
d373f8dc26 auto merge of #4739 : Manishearth/servo/warning-patrol, r=Ms2ger 2015-01-28 02:27:50 -07:00
bors-servo
1a2a08aa50 auto merge of #4717 : Ms2ger/servo/doc-proxy, r=saneyuki 2015-01-28 01:48:52 -07:00
Manish Goregaokar
e44ee70faf Remove some old impls 2015-01-28 13:37:18 +05:30
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
238f3e2d91 Require documentation for all code in dom::bindings (excluding dom::bindings::codegen). 2015-01-25 22:01:04 +01:00
Ms2ger
801949556d Return *const T from JS::unsafe_get() (fixes #4712). 2015-01-24 16:43:19 +01:00
Ms2ger
dfbf83a8ac Don't call transmute_copy in JS::unsafe_get.
It hasn't had borrow flags for quite a while.
2015-01-24 15:57:09 +01:00
Ms2ger
13c7cf928a Stop calling deref() and deref_mut() explicitly. 2015-01-22 16:04:21 +01:00
Ms2ger
e239bd9644 Document js.rs. 2015-01-19 23:09:00 +01:00
Ms2ger
8a08fff0b4 Remove OptionalSettable.
It was obsoleted by MutNullableJS.
2015-01-19 23:08:11 +01:00
Matthew Rasmus
dc72119998 Fix non_upper_case_globals warnings 2015-01-08 08:51:11 -08:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
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