removing mutHeapJs references

changes as per comments
This commit is contained in:
SendilKumar N 2017-03-04 22:25:47 +08:00
parent c62973b77b
commit 2996d3a413
7 changed files with 23 additions and 67 deletions

View file

@ -15,7 +15,6 @@ use dom::bindings::callback::CallbackContainer;
use dom::bindings::codegen::Bindings::PromiseBinding::AnyCallback;
use dom::bindings::conversions::root_from_object;
use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::MutHeapJSVal;
use dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
use dom::globalscope::GlobalScope;
use dom::promisenativehandler::PromiseNativeHandler;
@ -27,6 +26,7 @@ use js::jsapi::{JSContext, HandleValue, HandleObject, IsPromiseObject, GetFuncti
use js::jsapi::{JS_ClearPendingException, JSObject, AddRawValueRoot, RemoveRawValueRoot, PromiseState};
use js::jsapi::{MutableHandleObject, NewPromiseObject, ResolvePromise, RejectPromise, GetPromiseState};
use js::jsapi::{SetFunctionNativeReserved, NewFunctionWithReserved, AddPromiseReactions};
use js::jsapi::Heap;
use js::jsval::{JSVal, UndefinedValue, ObjectValue, Int32Value};
use std::ptr;
use std::rc::Rc;
@ -39,7 +39,7 @@ pub struct Promise {
/// native instance exists. This ensures that the reflector will never be GCed
/// while native code could still interact with its native representation.
#[ignore_heap_size_of = "SM handles JS values"]
permanent_js_root: MutHeapJSVal,
permanent_js_root: Heap<JSVal>,
}
/// Private helper to enable adding new methods to Rc<Promise>.
@ -93,7 +93,7 @@ impl Promise {
assert!(IsPromiseObject(obj));
let promise = Promise {
reflector: Reflector::new(),
permanent_js_root: MutHeapJSVal::new(),
permanent_js_root: Heap::default(),
};
let mut promise = Rc::new(promise);
Rc::get_mut(&mut promise).unwrap().init_reflector(obj.get());