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

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

Issue 2184263006: Avoid to schedule unnecessary empty rendering cicles (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Avoid to schedule unnecessary empty rendering cycles Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 /// A generic rendering task that can be scheduled. 9 /// A generic rendering task that can be scheduled.
10 abstract class RenderingTask { 10 abstract class RenderingTask {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void enqueue(RenderingTask r) { 59 void enqueue(RenderingTask r) {
60 assert(r != null); 60 assert(r != null);
61 // If no task are in the queue there is no rendering phase scheduled. 61 // If no task are in the queue there is no rendering phase scheduled.
62 if (isEmpty) _render(); 62 if (isEmpty) _render();
63 _queue.addLast(r); 63 _queue.addLast(r);
64 } 64 }
65 65
66 Future _render() async { 66 Future _render() async {
67 await _barrier.next; 67 await _barrier.next;
68 while (_queue.isNotEmpty) { 68 while (_queue.isNotEmpty) {
69 _queue.removeFirst().render(); 69 _queue.first.render();
70 _queue.removeFirst();
70 } 71 }
71 } 72 }
72 } 73 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698