Make UntrustedNodeAddress a newtype.

This will allow us to make it Send after the Rust upgrade.
This commit is contained in:
Josh Matthews 2015-01-22 15:26:56 -05:00 committed by Ms2ger
parent 1b496d80de
commit d2f0aac5ce
5 changed files with 7 additions and 5 deletions

View file

@ -159,7 +159,7 @@ impl ImageResponder<UntrustedNodeAddress> for LayoutImageResponder {
let f: proc(ImageResponseMsg, UntrustedNodeAddress):Send =
proc(_, node_address) {
let ScriptControlChan(chan) = script_chan;
debug!("Dirtying {:x}", node_address as uint);
debug!("Dirtying {:x}", node_address.0 as uint);
let mut nodes = SmallVec1::new();
nodes.vec_push(node_address);
drop(chan.send_opt(ConstellationControlMsg::SendEvent(

View file

@ -325,7 +325,7 @@ impl<'ln> LayoutNode<'ln> {
pub fn debug_id(self) -> uint {
let opaque: OpaqueNode = OpaqueNodeMethods::from_layout_node(&self);
opaque.to_untrusted_node_address() as uint
opaque.to_untrusted_node_address().0 as uint
}
}

View file

@ -886,7 +886,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
-> Temporary<Node> {
unsafe {
let candidate: uintptr_t = mem::transmute(candidate);
let candidate: uintptr_t = mem::transmute(candidate.0);
let object: *mut JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime,
candidate);
if object.is_null() {

View file

@ -1131,7 +1131,7 @@ impl ScriptTask {
let page = get_page(&*self.page.borrow(), pipeline_id);
match page.hit_test(&point) {
Some(node_address) => {
debug!("node address is {}", node_address);
debug!("node address is {}", node_address.0);
let temp_node =
node::from_untrusted_node_address(

View file

@ -39,7 +39,9 @@ use serialize::{Encodable, Encoder};
/// The address of a node. Layout sends these back. They must be validated via
/// `from_untrusted_node_address` before they can be used, because we do not trust layout.
pub type UntrustedNodeAddress = *const c_void;
#[allow(raw_pointer_deriving)]
#[deriving(Copy, Clone)]
pub struct UntrustedNodeAddress(pub *const c_void);
pub struct NewLayoutInfo {
pub old_pipeline_id: PipelineId,