On 7/12/13 7:45 PM, Patrick Walton wrote:
2. Use the JS GC for wrapped objects and reference counting for
non-wrapped objects. This assumes there are no cycles between them,
which I believe to be the case (though could be wrong)

If we can have both wrapped and unwrapped DOM nodes, I don't see how we can have no cycles between the two...

3. Use the JS GC for wrapped objects and unique ownership coupled with
weak pointers for non-wrapped objects. In other words, there is a single
"strong owner" for each node and all other pointers from Rust to the DOM
are weak. (For example, event targets for queued events would be weak
and if the DOM node dies then the event is dropped.)

I rather doubt this is web-compatible...  Consider this simple testcase:

  (function foo() {
    var img = new Image();
    img.addEventListener("load", function(e) { window.x = e; });
    img.src = whatever;
  })();

The event needs to fire. Futhermore, once it's fired window.x.target needs to be the DOM node... I suppose the DOM event could trace the DOM node and the image load could be the unique "strong owner", but this seems fragile...

Option 4 is to go with a GC and CC setup and refcounting on the Rust side, I guess.

-Boris
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to