Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1082)

Unified Diff: runtime/observatory/lib/src/elements/helpers/rendering_queue.dart

Issue 2995883002: Speedup Observatory elements first time rendering (Closed)
Patch Set: Fix task queueing Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/helpers/rendering_queue.dart
diff --git a/runtime/observatory/lib/src/elements/helpers/rendering_queue.dart b/runtime/observatory/lib/src/elements/helpers/rendering_queue.dart
index 707de2331ad3883bd0fca81ef112073aaacacb20..c2697b347357f027ddcc07885d019dc468d11f1c 100644
--- a/runtime/observatory/lib/src/elements/helpers/rendering_queue.dart
+++ b/runtime/observatory/lib/src/elements/helpers/rendering_queue.dart
@@ -56,15 +56,27 @@ class RenderingQueue {
/// Add a task to the queue.
/// If the current rendering phase is running it will be executed during this
/// rendering cycle, otherwise it will be queued for the next one.
- void enqueue(RenderingTask r) {
+ void enqueue(RenderingTask r, {bool realtime: false}) {
siva 2017/08/14 22:35:01 why not rename realtime to waitForBarrier to make
cbernaschina 2017/08/14 23:04:14 Done.
assert(r != null);
- // If no task are in the queue there is no rendering phase scheduled.
- if (isEmpty) _render();
+ final wasEmpty = _queue.isEmpty;
_queue.addLast(r);
+ // If no task are in the queue there is no rendering phase scheduled.
+ if (wasEmpty) {
+ if (realtime) {
+ // If it is a realtime request avoid to wait for the barrier
+ scheduleMicrotask(_renderLoop);
+ } else {
+ _render();
+ }
+ }
}
Future _render() async {
await _barrier.next;
+ _renderLoop();
+ }
+
+ void _renderLoop() {
while (_queue.isNotEmpty) {
_queue.first.render();
_queue.removeFirst();

Powered by Google App Engine
This is Rietveld 408576698