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

Provide microtask enqueue api #13433

Closed
vsmenon opened this Issue Sep 19, 2013 · 10 comments

Comments

Projects
None yet
5 participants
@vsmenon
Member

vsmenon commented Sep 19, 2013

dart:async needs the ability to schedule a microtask when running in Dartium.

The current Microtask code in Blink:

http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/Microtask.cpp?revision=152982

appears to drain the MutationObserver queue and CustomElement callback queue.

To support the general functionality dart:async, we could:

  • Add a direct hook for Dart microtasks
  • Piggyback MutationObserver (perhaps via a dart:html api)
  • Piggyback CustomElement (again, perhaps via dart:html)

thoughts?

@blois

This comment has been minimized.

Show comment
Hide comment
@blois

blois Sep 19, 2013

Long-term, I think Dart should piggyback off of DOM promises, though it looks like those are not in yet. There has been discussion of scheduling nuances between MutationObservers and promises (such as promises queue and mutation observers queues would be separate but flushed in sequence).

Short-term, dart:html is currently piggy-backing on MutationObserver for setImmediate in dart:html, the code is fairly minimal and performant (a div and a mutation observer, then we just toggle a property on the div every time it needs to be scheduled)-
https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/tools/dom/src/Microtask.dart#­86

We should be able to follow the same pattern for dart2js on downlevel Chrome and Firefox as well (Firefox should be getting DOM promises in the near future as well).

blois commented Sep 19, 2013

Long-term, I think Dart should piggyback off of DOM promises, though it looks like those are not in yet. There has been discussion of scheduling nuances between MutationObservers and promises (such as promises queue and mutation observers queues would be separate but flushed in sequence).

Short-term, dart:html is currently piggy-backing on MutationObserver for setImmediate in dart:html, the code is fairly minimal and performant (a div and a mutation observer, then we just toggle a property on the div every time it needs to be scheduled)-
https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/tools/dom/src/Microtask.dart#­86

We should be able to follow the same pattern for dart2js on downlevel Chrome and Firefox as well (Firefox should be getting DOM promises in the near future as well).

@floitschG

This comment has been minimized.

Show comment
Hide comment
@floitschG

floitschG Sep 20, 2013

Contributor

I think it is ok to piggyback on MutationObservers for now, but we need to discuss how to do that. Since the way microtasks are enqueued depends on the embedder we can't just import dart:html and use that everywhere. It needs to be the embedder that sets a function (or similar) that we then can use.

Contributor

floitschG commented Sep 20, 2013

I think it is ok to piggyback on MutationObservers for now, but we need to discuss how to do that. Since the way microtasks are enqueued depends on the embedder we can't just import dart:html and use that everywhere. It needs to be the embedder that sets a function (or similar) that we then can use.

@vsmenon

This comment has been minimized.

Show comment
Hide comment
@vsmenon

vsmenon Sep 20, 2013

Member

Note, we do that (setting a function) to forward print in dart:core to console.log in dart:html. E.g., Dartium ensures that a private variable in dart:core is set to console.log before executing user code.

(This also came up in Soren's URI CL. We might want refactor all these forwarding points into a class or singleton that the embedder provides.)

Member

vsmenon commented Sep 20, 2013

Note, we do that (setting a function) to forward print in dart:core to console.log in dart:html. E.g., Dartium ensures that a private variable in dart:core is set to console.log before executing user code.

(This also came up in Soren's URI CL. We might want refactor all these forwarding points into a class or singleton that the embedder provides.)

@vsmenon

This comment has been minimized.

Show comment
Hide comment
@vsmenon

vsmenon Oct 2, 2013

Member

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

Member

vsmenon commented Oct 2, 2013

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

@vsmenon

This comment has been minimized.

Show comment
Hide comment
@vsmenon

vsmenon Oct 8, 2013

Member

Anders - looks like this is covered by your CLs. Can you please reassign to me if there is anything else?


Set owner to @skabet.

Member

vsmenon commented Oct 8, 2013

Anders - looks like this is covered by your CLs. Can you please reassign to me if there is anything else?


Set owner to @skabet.

@vsmenon

This comment has been minimized.

Show comment
Hide comment
@vsmenon

vsmenon Oct 9, 2013

Member

[+iposva]


cc @iposva-google.

Member

vsmenon commented Oct 9, 2013

[+iposva]


cc @iposva-google.

@nordlien

This comment has been minimized.

Show comment
Hide comment
@nordlien

nordlien Oct 10, 2013

Yep, will update once landed.


Added Started label.

nordlien commented Oct 10, 2013

Yep, will update once landed.


Added Started label.

@iposva-google

This comment has been minimized.

Show comment
Hide comment
@iposva-google

iposva-google Oct 18, 2013

Contributor

Anders, is there more stuff to be done here?


Removed Priority-Unassigned label.
Added Priority-High label.

Contributor

iposva-google commented Oct 18, 2013

Anders, is there more stuff to be done here?


Removed Priority-Unassigned label.
Added Priority-High label.

@nordlien

This comment has been minimized.

Show comment
Hide comment
@nordlien

nordlien Oct 18, 2013

Yes, there may already be a Microtask-queue we could re-use. I misread the existing code, and will look into a fix next week.

nordlien commented Oct 18, 2013

Yes, there may already be a Microtask-queue we could re-use. I misread the existing code, and will look into a fix next week.

@nordlien

This comment has been minimized.

Show comment
Hide comment
@nordlien

nordlien Oct 20, 2013

Turns out it was removed, in favor of the new implementation. Dartium is working now.


Added Fixed label.

nordlien commented Oct 20, 2013

Turns out it was removed, in favor of the new implementation. Dartium is working now.


Added Fixed label.

This issue was closed.

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