Skip to content

Commit

Permalink
Restrict compilationQueue to library-visibility (flutter#21280)
Browse files Browse the repository at this point in the history
Its type uses a generic type which is limited to library-visibility.
Eliminating compilationQueue from ResidentCompiler's public interface
makes it possible to mock in tests.
  • Loading branch information
cbracken authored Aug 31, 2018
1 parent 80a5843 commit 9d0084f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/flutter_tools/lib/src/compile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,19 @@ class ResidentCompiler {
return _stdoutHandler.compilerOutput.future;
}

final List<_CompilationRequest> compilationQueue = <_CompilationRequest>[];
final List<_CompilationRequest> _compilationQueue = <_CompilationRequest>[];

void _handleCompilationRequest(_CompilationRequest request) async {
final bool isEmpty = compilationQueue.isEmpty;
compilationQueue.add(request);
final bool isEmpty = _compilationQueue.isEmpty;
_compilationQueue.add(request);
// Only trigger processing if queue was empty - i.e. no other requests
// are currently being processed. This effectively enforces "one
// compilation request at a time".
if (isEmpty) {
while (compilationQueue.isNotEmpty) {
final _CompilationRequest request = compilationQueue.first;
while (_compilationQueue.isNotEmpty) {
final _CompilationRequest request = _compilationQueue.first;
await request.run(this);
compilationQueue.removeAt(0);
_compilationQueue.removeAt(0);
}
}
}
Expand Down

0 comments on commit 9d0084f

Please sign in to comment.