anchor.diff:      _checkClosed();
   
       // See if this unit of work can be combined with scheduled work units.
  -    if (_pendingWork.isNotEmpty) {
  -      _IndexedDbWorkItem? compareWith = _pendingWork.last;
  -      assert(_currentWorkItem != compareWith,
  -          'Current work item should be removed from queue');
  -
  -      while (compareWith != null) {
  -        final result = work.mergeWith(compareWith);
  -        switch (result) {
  -          case _WorkSimplicationResult.mergedInto:
  -            return compareWith.completer.future;
  -          case _WorkSimplicationResult.cannotSimplify:
  -            compareWith = null;
  -            break;
  -          case _WorkSimplicationResult.lookFurther:
  -            compareWith = compareWith.previous;
  -            break;
  -          case _WorkSimplicationResult.deletePreviousAndContinue:
  -          case _WorkSimplicationResult.deletePreviousAndMergedWith:
  -            final next = compareWith.previous;
  -            compareWith.unlink();
  -            compareWith = next;
  -
  -            if (result == _WorkSimplicationResult.deletePreviousAndMergedWith) {
  -              return next?.completer.future ?? Future.value();
  -            }
  -        }
  -      }
  -    }
  -
  -    _pendingWork.add(work);
  -    _startWorkingIfNeeded();
  -
  -    return work.completer.future;
  +    if (work.insertInto(_pendingWork)) {
  +      _startWorkingIfNeeded();
  +      return work.completer.future;
  +    } else {
  +      // This item determined that it doesn't need to do any work at its place
  +      // in the queue, so just skip it.
  +      return Future.value();
  +    }
     }
   
     Future<void> _submitWorkFunction(
  
positive.code:   _DeleteFileWorkItem(this.fileSystem, this.path);
  
    @override
    _WorkSimplicationResult mergeWith(_IndexedDbWorkItem other) {
      if (other is _DeleteFileWorkItem) {
        // If there already is a pending "delete" request available, we don't have
        // to run a new one.
        return other.path == path
            ? _WorkSimplicationResult.mergedInto
            : _WorkSimplicationResult.lookFurther;
      } else if (other is _WriteFileWorkItem) {
        return other.path == path
            ? _WorkSimplicationResult.deletePreviousAndContinue
            : _WorkSimplicationResult.lookFurther;
      } else if (other is _CreateFileWorkItem) {
        return other.path == path
            ? _WorkSimplicationResult.deletePreviousAndMergedWith
            : _WorkSimplicationResult.lookFurther;
      }
  
      return _WorkSimplicationResult.cannotSimplify;
    }
  
    @override
  
negative.code:   }
  }
  
  abstract class _IndexedDbWorkItem extends LinkedListEntry<_IndexedDbWorkItem> {
    final Completer<void> completer = Completer.sync();
  
    /// Insert this item into the [pending] list, returning whether the item was
    /// actually added.
    ///
    /// Some items may want to look at the current state of the work queue for
    /// optimization purposes. For instance:
    ///
    ///  - if two writes to the same file are scheduled, they can be merged into
    ///    a single transaction for efficiency.
    ///  - if a file creation or writes are followed by inserting a delete request
    ///    to the same file, previous items can be deleted from the queue.
    bool insertInto(LinkedList<_IndexedDbWorkItem> pending) {
      pending.add(this);
      return true;
    }
  
    FutureOr<void> run();
  }
  