Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MutHeapJSVal #15408

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -5,7 +5,7 @@
//! Base classes to work with IDL callbacks.

use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::js::{JS, Root, MutHeapJSVal};
use dom::bindings::js::{JS, Root, HeapJSVal};
use dom::bindings::reflector::DomObject;
use dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript};
use dom::globalscope::GlobalScope;
@@ -39,7 +39,7 @@ pub enum ExceptionHandling {
pub struct CallbackObject {
/// The underlying `JSObject`.
callback: Heap<*mut JSObject>,
permanent_js_root: MutHeapJSVal,
permanent_js_root: HeapJSVal,

/// The ["callback context"], that is, the global to use as incumbent
/// global when calling the callback.
@@ -235,20 +235,20 @@ impl LayoutJS<Node> {
/// GC barriers are enforced.
#[must_root]
#[derive(JSTraceable)]
pub struct MutHeapJSVal {
pub struct HeapJSVal {
val: UnsafeCell<Heap<JSVal>>,
}

impl MutHeapJSVal {
/// Create a new `MutHeapJSVal`.
pub fn new() -> MutHeapJSVal {
impl HeapJSVal {
/// Create a new `HeapJSVal`.
pub fn new() -> HeapJSVal {
debug_assert!(thread_state::get().is_script());
MutHeapJSVal {
HeapJSVal {
val: UnsafeCell::new(Heap::default()),
}
}

/// Set this `MutHeapJSVal` to the given value, calling write barriers as
/// Set this `HeapJSVal` to the given value, calling write barriers as
/// appropriate.
pub fn set(&self, val: JSVal) {
debug_assert!(thread_state::get().is_script());
@@ -258,7 +258,7 @@ impl MutHeapJSVal {
}
}

/// Get the value in this `MutHeapJSVal`, calling read barriers as appropriate.
/// Get the value in this `HeapJSVal`, calling read barriers as appropriate.
pub fn get(&self) -> JSVal {
debug_assert!(thread_state::get().is_script());
unsafe { (*self.val.get()).get() }
@@ -11,8 +11,10 @@ use js::jsval::JSVal;
use std::cell::Cell;

struct Foo {
bar: Cell<JSVal>
//~^ ERROR Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead,
bar: MutJS<JSVal>
//~^ ERROR Banned type MutJS<JSVal> detected. Use Heap<JSVal> instead,


}

fn main() {}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.