Unverified Commit 9d0084ff authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Restrict compilationQueue to library-visibility (#21280)

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.
parent 80a58439
...@@ -311,19 +311,19 @@ class ResidentCompiler { ...@@ -311,19 +311,19 @@ class ResidentCompiler {
return _stdoutHandler.compilerOutput.future; return _stdoutHandler.compilerOutput.future;
} }
final List<_CompilationRequest> compilationQueue = <_CompilationRequest>[]; final List<_CompilationRequest> _compilationQueue = <_CompilationRequest>[];
void _handleCompilationRequest(_CompilationRequest request) async { void _handleCompilationRequest(_CompilationRequest request) async {
final bool isEmpty = compilationQueue.isEmpty; final bool isEmpty = _compilationQueue.isEmpty;
compilationQueue.add(request); _compilationQueue.add(request);
// Only trigger processing if queue was empty - i.e. no other requests // Only trigger processing if queue was empty - i.e. no other requests
// are currently being processed. This effectively enforces "one // are currently being processed. This effectively enforces "one
// compilation request at a time". // compilation request at a time".
if (isEmpty) { if (isEmpty) {
while (compilationQueue.isNotEmpty) { while (_compilationQueue.isNotEmpty) {
final _CompilationRequest request = compilationQueue.first; final _CompilationRequest request = _compilationQueue.first;
await request.run(this); await request.run(this);
compilationQueue.removeAt(0); _compilationQueue.removeAt(0);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment