Skip to content

Change RefCells in the DOM to a custom JSRefCell/DOMRefCell #3050

Closed

Description

@pcwalton

This ref cell would be just like the built-in ref cell but it would do two things:

  1. Calling any borrow/borrow-mut method would ensure this is not the layout thread in debug builds.
  2. A new special borrow-in-layout method would ensure that this is the layout thread in debug builds.

This would help prevent problems like the one that broke the in-progress Rust upgrade and would make our code nicer as well.

Activity

  1. tetsuharuohzeki commented on Aug 9, 2014

    @tetsuharuohzeki
    Contributor

    Does this import cell.rs from rust master and custom it?
    Or we introduce a new sub-type object like this?:

    struct DOMRefCell<T> {
      base: RefCell<T>,
      ...
    }
    impl<T> DOMRefCell<T> {
      ...
    }
  2. jdm commented on Aug 10, 2014

    @jdm
    Member

    I think it makes sense to wrap the original type like your example.

  3. added a commit that references this issue on Oct 15, 2014
  4. jdm commented on Oct 16, 2014

    @jdm
    Member

    To implement the safety assertions, let's add a local_data! in layout_interface that LayoutTask::new initializes. Borrow and borrow_in_layout can check it inside cfg!(debug) blocks, since I'm pretty sure task-local data is relatively slow right now.

  5. added a commit that references this issue on Oct 16, 2014
  6. tetsuharuohzeki commented on Oct 16, 2014

    @tetsuharuohzeki
    Contributor

    Once we'll replace all usage of RefCell in script to DOMRefCell for the above safety checking. I'll start to work it :)

  7. added 5 commits that reference this issue on Oct 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domI-refactorI-safety

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions