mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Make UntrustedNodeAddress a newtype.
This will allow us to make it Send after the Rust upgrade.
This commit is contained in:
parent
1b496d80de
commit
d2f0aac5ce
5 changed files with 7 additions and 5 deletions
|
@ -159,7 +159,7 @@ impl ImageResponder<UntrustedNodeAddress> for LayoutImageResponder {
|
||||||
let f: proc(ImageResponseMsg, UntrustedNodeAddress):Send =
|
let f: proc(ImageResponseMsg, UntrustedNodeAddress):Send =
|
||||||
proc(_, node_address) {
|
proc(_, node_address) {
|
||||||
let ScriptControlChan(chan) = script_chan;
|
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();
|
let mut nodes = SmallVec1::new();
|
||||||
nodes.vec_push(node_address);
|
nodes.vec_push(node_address);
|
||||||
drop(chan.send_opt(ConstellationControlMsg::SendEvent(
|
drop(chan.send_opt(ConstellationControlMsg::SendEvent(
|
||||||
|
|
|
@ -325,7 +325,7 @@ impl<'ln> LayoutNode<'ln> {
|
||||||
|
|
||||||
pub fn debug_id(self) -> uint {
|
pub fn debug_id(self) -> uint {
|
||||||
let opaque: OpaqueNode = OpaqueNodeMethods::from_layout_node(&self);
|
let opaque: OpaqueNode = OpaqueNodeMethods::from_layout_node(&self);
|
||||||
opaque.to_untrusted_node_address() as uint
|
opaque.to_untrusted_node_address().0 as uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -886,7 +886,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
||||||
pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
|
pub fn from_untrusted_node_address(runtime: *mut JSRuntime, candidate: UntrustedNodeAddress)
|
||||||
-> Temporary<Node> {
|
-> Temporary<Node> {
|
||||||
unsafe {
|
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,
|
let object: *mut JSObject = jsfriendapi::bindgen::JS_GetAddressableObject(runtime,
|
||||||
candidate);
|
candidate);
|
||||||
if object.is_null() {
|
if object.is_null() {
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ impl ScriptTask {
|
||||||
let page = get_page(&*self.page.borrow(), pipeline_id);
|
let page = get_page(&*self.page.borrow(), pipeline_id);
|
||||||
match page.hit_test(&point) {
|
match page.hit_test(&point) {
|
||||||
Some(node_address) => {
|
Some(node_address) => {
|
||||||
debug!("node address is {}", node_address);
|
debug!("node address is {}", node_address.0);
|
||||||
|
|
||||||
let temp_node =
|
let temp_node =
|
||||||
node::from_untrusted_node_address(
|
node::from_untrusted_node_address(
|
||||||
|
|
|
@ -39,7 +39,9 @@ use serialize::{Encodable, Encoder};
|
||||||
|
|
||||||
/// The address of a node. Layout sends these back. They must be validated via
|
/// 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.
|
/// `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 struct NewLayoutInfo {
|
||||||
pub old_pipeline_id: PipelineId,
|
pub old_pipeline_id: PipelineId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue