servo: Merge #15515 - Remove rustc-serialize from range (from nox:rustc-serialize); r=jdm
authorAnthony Ramine <n.oxyde@gmail.com>
Sun, 12 Feb 2017 04:55:40 -0800
changeset 343168 d2b73aaa759a7d22aabc6d16fa257a7d1ac9638e
parent 343167 2b147f3dcae89e547ce05bae480389eed1aa45f6
child 343169 4b84a317c7517d5be38bd268076bc32611ca8296
push id31371
push usercbook@mozilla.com
push dateThu, 16 Feb 2017 12:15:11 +0000
treeherdermozilla-central@8c8b54b13be7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #15515 - Remove rustc-serialize from range (from nox:rustc-serialize); r=jdm Source-Repo: https://github.com/servo/servo Source-Revision: 89dcbec0ba95eaabb7bf4e5da62a6e7de89feed2
servo/Cargo.lock
servo/components/range/Cargo.toml
servo/components/range/lib.rs
servo/components/script/dom/bindings/conversions.rs
--- a/servo/Cargo.lock
+++ b/servo/Cargo.lock
@@ -2142,17 +2142,16 @@ dependencies = [
 
 [[package]]
 name = "range"
 version = "0.0.1"
 dependencies = [
  "heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "heapsize_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 0.8.20 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rayon"
 version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
--- a/servo/components/range/Cargo.toml
+++ b/servo/components/range/Cargo.toml
@@ -9,11 +9,10 @@ publish = false
 [lib]
 name = "range"
 path = "lib.rs"
 
 [dependencies]
 heapsize = "0.3.0"
 heapsize_derive = "0.1"
 num-traits = "0.1.32"
-rustc-serialize = "0.3"
 serde = "0.8"
 serde_derive = "0.8"
--- a/servo/components/range/lib.rs
+++ b/servo/components/range/lib.rs
@@ -4,17 +4,16 @@
 
 #![feature(step_trait)]
 
 #![deny(unsafe_code)]
 
 extern crate heapsize;
 #[macro_use] extern crate heapsize_derive;
 extern crate num_traits;
-extern crate rustc_serialize;
 #[macro_use]
 extern crate serde_derive;
 
 use std::cmp::{self, max, min};
 use std::fmt;
 use std::iter;
 use std::marker::PhantomData;
 use std::ops;
@@ -140,17 +139,17 @@ macro_rules! int_range_index {
             fn neg(self) -> $Self_ {
                 $Self_(-self.get())
             }
         }
     )
 }
 
 /// A range of indices
-#[derive(Clone, Copy, Deserialize, HeapSizeOf, RustcEncodable, Serialize)]
+#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
 pub struct Range<I> {
     begin: I,
     length: I,
 }
 
 impl<I: RangeIndex> fmt::Debug for Range<I> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "[{:?} .. {:?})", self.begin(), self.end())
--- a/servo/components/script/dom/bindings/conversions.rs
+++ b/servo/components/script/dom/bindings/conversions.rs
@@ -41,31 +41,29 @@ use dom::bindings::utils::DOMClass;
 use js;
 pub use js::conversions::{FromJSValConvertible, ToJSValConvertible, ConversionResult};
 pub use js::conversions::ConversionBehavior;
 use js::conversions::latin1_to_string;
 use js::error::throw_type_error;
 use js::glue::{GetProxyPrivate, IsWrapper};
 use js::glue::{RUST_JSID_IS_INT, RUST_JSID_TO_INT};
 use js::glue::{RUST_JSID_IS_STRING, RUST_JSID_TO_STRING, UnwrapObject};
-use js::jsapi::{HandleId, HandleObject, HandleValue, JSContext};
-use js::jsapi::{JSObject, JSString};
-use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetObjectAsArrayBuffer, JS_GetObjectAsArrayBufferView};
-use js::jsapi::{JS_GetReservedSlot, JS_GetTwoByteStringCharsAndLength};
-use js::jsapi::{JS_IsArrayObject, JS_NewStringCopyN, JS_StringHasLatin1Chars};
-use js::jsapi::{JS_NewFloat32Array, JS_NewFloat64Array};
-use js::jsapi::{JS_NewInt8Array, JS_NewInt16Array, JS_NewInt32Array};
+use js::jsapi::{HandleId, HandleObject, HandleValue, JSContext, JSObject, JSString};
+use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetReservedSlot};
+use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_IsArrayObject};
+use js::jsapi::{JS_NewFloat32Array, JS_NewFloat64Array, JS_NewInt8Array};
+use js::jsapi::{JS_NewInt16Array, JS_NewInt32Array, JS_NewStringCopyN};
 use js::jsapi::{JS_NewUint8Array, JS_NewUint16Array, JS_NewUint32Array};
-use js::jsapi::{MutableHandleValue, Type};
+use js::jsapi::{JS_StringHasLatin1Chars, MutableHandleValue, Type};
 use js::jsval::{ObjectValue, StringValue};
 use js::rust::{ToString, get_object_class, is_dom_class, is_dom_object, maybe_wrap_value};
 use libc;
 use num_traits::Float;
 use servo_config::opts;
-use std::{char, mem, ptr, slice};
+use std::{char, ptr, slice};
 
 /// A trait to check whether a given `JSObject` implements an IDL interface.
 pub trait IDLInterface {
     /// Returns whether the given DOM class derives that interface.
     fn derives(&'static DOMClass) -> bool;
 }
 
 /// A trait to mark an IDL interface as deriving from another one.
@@ -549,34 +547,16 @@ unsafe impl ArrayBufferViewContents for 
         ty as i32 == Type::Float64 as i32
     }
 
     unsafe fn new(cx: *mut JSContext, num: u32) -> *mut JSObject {
         JS_NewFloat64Array(cx, num)
     }
 }
 
-/// Returns a mutable slice of the Array Buffer View data, viewed as T, without
-/// checking the real type of it.
-pub unsafe fn array_buffer_view_data<'a, T>(abv: *mut JSObject) -> Option<&'a mut [T]>
-    where T: ArrayBufferViewContents
-{
-    assert!(!abv.is_null());
-
-    let mut byte_length = 0;
-    let mut ptr = ptr::null_mut();
-    let mut is_shared = false;
-    let ret = JS_GetObjectAsArrayBufferView(abv, &mut byte_length, &mut is_shared, &mut ptr);
-    assert!(!is_shared);
-    if ret.is_null() {
-        return None;
-    }
-    Some(slice::from_raw_parts_mut(ptr as *mut T, byte_length as usize / mem::size_of::<T>()))
-}
-
 /// Returns whether `value` is an array-like object.
 /// Note: Currently only Arrays are supported.
 /// TODO: Expand this to support sequences and other array-like objects
 pub unsafe fn is_array_like(cx: *mut JSContext, value: HandleValue) -> bool {
     let mut result = false;
     assert!(JS_IsArrayObject(cx, value, &mut result));
     result
 }