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

dart2js: implement _enqueueImmediate #9002

Closed
floitschG opened this Issue Mar 8, 2013 · 19 comments

Comments

Projects
None yet
6 participants
@floitschG
Contributor

floitschG commented Mar 8, 2013

In an upcoming commit the library uses "_enqueueImmediate" with the following properties:
/** Enqueues the given callback before any other event in the event-loop. */
static void _enqueueImmediate(void callback())

Callbacks register through this function are always executed in order and are guaranteed to run before other asynchronous events (like [Timer] events, or DOM events).

Note: currently it would be ok to only allow one callback at a time. If you chose to implement the function with this behavior please let me (floitsch) know and I will update the documentation to make sure it won't be used otherwise.

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl Apr 22, 2013

Contributor

Added this to the Later milestone.

Contributor

kasperl commented Apr 22, 2013

Added this to the Later milestone.

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl May 23, 2013

Contributor

Added TriageForM5 label.

Contributor

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl May 28, 2013

Contributor

Removed TriageForM5 label.

Contributor

kasperl commented May 28, 2013

Removed TriageForM5 label.

@peter-ahe-google

This comment has been minimized.

Show comment
Hide comment
@peter-ahe-google

peter-ahe-google Jun 1, 2013

Contributor

Florian, how do you propose that we ensure something is run before other events? What primitive in the browser can we use to implement this? As far as I can tell, window.setImmediate is not what's spec'd above: setImmediate will flush the browser's event queue before calling the callback.


Added NeedsInfo label.

Contributor

peter-ahe-google commented Jun 1, 2013

Florian, how do you propose that we ensure something is run before other events? What primitive in the browser can we use to implement this? As far as I can tell, window.setImmediate is not what's spec'd above: setImmediate will flush the browser's event queue before calling the callback.


Added NeedsInfo label.

@floitschG

This comment has been minimized.

Show comment
Hide comment
@floitschG

floitschG Jun 6, 2013

Contributor

We can't use a browser primitive. (Otherwise we would have already implemented it).
dart2js needs to have its own event-loop.

A possible implementation would be:
main() {
  try {
    original_main();
  } catch(e) {
    reportError(e);
  } finally {
    runEnqueued();
  }
}

and the same for every callback from the dom.

Contributor

floitschG commented Jun 6, 2013

We can't use a browser primitive. (Otherwise we would have already implemented it).
dart2js needs to have its own event-loop.

A possible implementation would be:
main() {
  try {
    original_main();
  } catch(e) {
    reportError(e);
  } finally {
    runEnqueued();
  }
}

and the same for every callback from the dom.

@peter-ahe-google

This comment has been minimized.

Show comment
Hide comment
@peter-ahe-google

peter-ahe-google Jun 7, 2013

Contributor

This sounds like a pretty significant feature request. Have you made sure that both Dartium and dart2js teams have the resources to implement this? Is it even possible to implement this in Dartium?

Contributor

peter-ahe-google commented Jun 7, 2013

This sounds like a pretty significant feature request. Have you made sure that both Dartium and dart2js teams have the resources to implement this? Is it even possible to implement this in Dartium?

@blois

This comment has been minimized.

Show comment
Hide comment
@blois

blois Aug 14, 2013

The DOM Promise implementers are currently working through similar scheduling questions and appear to be closing in on something similar to Dart's request. It would be ideal if Dart and DOM could use the same timing primitives.

The closest polyfill AFAIK to the timing being discussed is using mutation observers- but this does not work on IE9 or IE10 (should work on IE11).

blois commented Aug 14, 2013

The DOM Promise implementers are currently working through similar scheduling questions and appear to be closing in on something similar to Dart's request. It would be ideal if Dart and DOM could use the same timing primitives.

The closest polyfill AFAIK to the timing being discussed is using mutation observers- but this does not work on IE9 or IE10 (should work on IE11).

@sethladd

This comment has been minimized.

Show comment
Hide comment
@sethladd

sethladd Aug 23, 2013

Member

Florian, is this important for 1.0 ?

Member

sethladd commented Aug 23, 2013

Florian, is this important for 1.0 ?

@floitschG

This comment has been minimized.

Show comment
Hide comment
@floitschG

floitschG Aug 23, 2013

Contributor

I think yes.

Contributor

floitschG commented Aug 23, 2013

I think yes.

@sethladd

This comment has been minimized.

Show comment
Hide comment
@sethladd

sethladd Aug 23, 2013

Member

Removed Priority-Medium label.
Added Priority-High label.

Member

sethladd commented Aug 23, 2013

Removed Priority-Medium label.
Added Priority-High label.

@larsbak

This comment has been minimized.

Show comment
Hide comment
@larsbak

larsbak Aug 27, 2013

Removed this from the Later milestone.
Added this to the M7 milestone.

larsbak commented Aug 27, 2013

Removed this from the Later milestone.
Added this to the M7 milestone.

@peter-ahe-google

This comment has been minimized.

Show comment
Hide comment
@peter-ahe-google

peter-ahe-google Aug 27, 2013

Contributor

Removed this from the M7 milestone.
Added this to the Later milestone.

Contributor

peter-ahe-google commented Aug 27, 2013

Removed this from the M7 milestone.
Added this to the Later milestone.

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl Sep 25, 2013

Contributor

Can we get an update on what we're supposed to implement now that the zone changes have landed?


Set owner to @floitschG.
Removed this from the Later milestone.
Added this to the M7 milestone.
_Changed the title to: "dart2js: implement enqueueImmediate".

Contributor

kasperl commented Sep 25, 2013

Can we get an update on what we're supposed to implement now that the zone changes have landed?


Set owner to @floitschG.
Removed this from the Later milestone.
Added this to the M7 milestone.
_Changed the title to: "dart2js: implement enqueueImmediate".

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl Oct 2, 2013

Contributor

Removed this from the M7 milestone.
Added this to the M8 milestone.

Contributor

kasperl commented Oct 2, 2013

Removed this from the M7 milestone.
Added this to the M8 milestone.

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl Jun 4, 2014

Contributor

Removed this from the M8 milestone.
Added this to the 1.6 milestone.

Contributor

kasperl commented Jun 4, 2014

Removed this from the M8 milestone.
Added this to the 1.6 milestone.

@kasperl

This comment has been minimized.

Show comment
Hide comment
@kasperl

kasperl Jul 11, 2014

Contributor

Added Accepted label.

Contributor

kasperl commented Jul 11, 2014

Added Accepted label.

@floitschG

This comment has been minimized.

Show comment
Hide comment
@floitschG

floitschG Jul 11, 2014

Contributor

Added Started label.

Contributor

floitschG commented Jul 11, 2014

Added Started label.

@floitschG

This comment has been minimized.

Show comment
Hide comment
@floitschG

floitschG Jul 11, 2014

Contributor

Issue #19982 has been merged into this issue.

Contributor

floitschG commented Jul 11, 2014

Issue #19982 has been merged into this issue.

@floitschG

This comment has been minimized.

Show comment
Hide comment
@floitschG

floitschG Aug 12, 2014

Contributor

Has been implemented for mutation observers.
Still needs support for IE's setImmediate.


Removed this from the 1.6 milestone.
Removed Priority-High label.
Added Priority-Medium label.

Contributor

floitschG commented Aug 12, 2014

Has been implemented for mutation observers.
Still needs support for IE's setImmediate.


Removed this from the 1.6 milestone.
Removed Priority-High label.
Added Priority-Medium label.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment