OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library dart2js.js.enqueue; | 5 library dart2js.js.enqueue; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common/tasks.dart' show CompilerTask; | 9 import '../common/tasks.dart' show CompilerTask; |
10 import '../common/work.dart' show WorkItem; | 10 import '../common/work.dart' show WorkItem; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 while (_queue.isNotEmpty) { | 222 while (_queue.isNotEmpty) { |
223 // TODO(johnniwinther): Find an optimal process order. | 223 // TODO(johnniwinther): Find an optimal process order. |
224 WorkItem work = _queue.removeLast(); | 224 WorkItem work = _queue.removeLast(); |
225 if (!_processedEntities.contains(work.element)) { | 225 if (!_processedEntities.contains(work.element)) { |
226 strategy.processWorkItem(f, work); | 226 strategy.processWorkItem(f, work); |
227 // TODO(johnniwinther): Register the processed element here. This | 227 // TODO(johnniwinther): Register the processed element here. This |
228 // is currently a side-effect of calling `work.run`. | 228 // is currently a side-effect of calling `work.run`. |
229 _processedEntities.add(work.element); | 229 _processedEntities.add(work.element); |
230 } | 230 } |
231 } | 231 } |
232 List recents = _recentClasses.toList(growable: false); | 232 List<ClassEntity> recents = _recentClasses.toList(growable: false); |
233 _recentClasses.clear(); | 233 _recentClasses.clear(); |
234 _recentConstants = false; | 234 _recentConstants = false; |
235 if (!_onQueueEmpty(recents)) _recentClasses.addAll(recents); | 235 if (!_onQueueEmpty(recents)) _recentClasses.addAll(recents); |
236 } while ( | 236 } while ( |
237 _queue.isNotEmpty || _recentClasses.isNotEmpty || _recentConstants); | 237 _queue.isNotEmpty || _recentClasses.isNotEmpty || _recentConstants); |
238 } | 238 } |
239 | 239 |
240 /// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses] | 240 /// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses] |
241 /// contains the set of all classes seen for the first time since | 241 /// contains the set of all classes seen for the first time since |
242 /// [_onQueueEmpty] was called last. A return value of [true] indicates that | 242 /// [_onQueueEmpty] was called last. A return value of [true] indicates that |
(...skipping 13 matching lines...) Expand all Loading... |
256 String toString() => 'Enqueuer($name)'; | 256 String toString() => 'Enqueuer($name)'; |
257 | 257 |
258 ImpactUseCase get impactUse => IMPACT_USE; | 258 ImpactUseCase get impactUse => IMPACT_USE; |
259 | 259 |
260 @override | 260 @override |
261 Iterable<MemberEntity> get processedEntities => _processedEntities; | 261 Iterable<MemberEntity> get processedEntities => _processedEntities; |
262 | 262 |
263 @override | 263 @override |
264 Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses; | 264 Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses; |
265 } | 265 } |
OLD | NEW |