backgroundSaveComplete method

void backgroundSaveComplete()
See CopyStateForBackgroundThreadSave. This method releases the "frozen" save state, applying its patch that it was using internally.

Implementation

void backgroundSaveComplete() {
  // CopyStateForBackgroundThreadSave must be called outside
  // of any async ink evaluation, since otherwise you'd be saving
  // during an intermediate state.
  // However, it's possible to *complete* the save in the middle of
  // a glue-lookahead when there's a state stored in _stateSnapshotAtLastNewline.
  // This state will have its own patch that is newer than the save patch.
  // We hold off on the final apply until the glue-lookahead is finished.
  // In that case, the apply is always done, it's just that it may
  // apply the looked-ahead changes OR it may simply apply the changes
  // made during the save process to the old _stateSnapshotAtLastNewline state.
  if (_stateSnapshotAtLastNewline == null) {
    _state.applyAnyPatch();
  }

  _asyncSaving = false;
}