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

Provide microtask enqueue api #13433

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

Provide microtask enqueue api #13433

vsmenon opened this issue Sep 19, 2013 · 10 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures
Milestone

Comments

@vsmenon
Copy link
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
Copy link
Contributor

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
Copy link
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.

@vsmenon
Copy link
Member Author

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
Copy link
Member Author

vsmenon commented Oct 2, 2013

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

@vsmenon
Copy link
Member Author

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
Copy link
Member Author

vsmenon commented Oct 9, 2013

[+iposva]


cc @iposva-google.

@andersjohnsen
Copy link

Yep, will update once landed.


Added Started label.

@iposva-google
Copy link
Contributor

Anders, is there more stuff to be done here?


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

@andersjohnsen
Copy link

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.

@andersjohnsen
Copy link

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


Added Fixed label.

@vsmenon vsmenon added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures labels Oct 20, 2013
@vsmenon vsmenon added this to the M8 milestone Oct 20, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

5 participants