use of org.dartlang.vm.service.consumer.ReloadReportConsumer in project flutter-intellij by flutter.
the class RenderThread method performReload.
/**
* Attempt to perform hot reload.
*
* @return true if successful, or false if unsuccessful or timeout.
*/
private boolean performReload() {
final CountDownLatch reloadLatch = new CountDownLatch(1);
final AtomicBoolean reloadSuccess = new AtomicBoolean(false);
myVmService.getVM(new VMConsumer() {
@Override
public void received(VM vm) {
final ElementList<IsolateRef> isolates = vm.getIsolates();
if (!isolates.isEmpty()) {
final String isolateId = isolates.get(0).getId();
myVmService.reloadSources(isolateId, new ReloadReportConsumer() {
@Override
public void received(ReloadReport report) {
reloadSuccess.set(report.getSuccess());
reloadLatch.countDown();
}
@Override
public void onError(RPCError error) {
reloadLatch.countDown();
}
});
}
}
@Override
public void onError(RPCError error) {
reloadLatch.countDown();
}
});
return Uninterruptibles.awaitUninterruptibly(reloadLatch, 2000, TimeUnit.MILLISECONDS) && reloadSuccess.get();
}
Aggregations