private void RecomputeGraph()
        {
            _operationProcessor.Execute(new OperationHandlers {
            OnBeforeExecute = info => OnSnapshotComputing(info),
            OnError = (info, error) => OnSnapshotComputed(new SnapshotComputedResult { OperationInfo = info, Error = error }),
            Execute = info => {
              Logger.Log("Collecting list of files from file system.");
              Logger.LogMemoryStats();
              var sw = Stopwatch.StartNew();

              var files = new List<FullPath>();
              lock (_lock) {
            ValidateKnownFiles();
            files.AddRange(_addedFiles);
              }

              IFileSystemNameFactory fileNameFactory = _fileSystemNameFactory;
              if (ReuseFileNameInstances) {
            if (_fileSystemSnapshot.ProjectRoots.Count > 0) {
              fileNameFactory = new FileSystemTreeSnapshotNameFactory(_fileSystemSnapshot, fileNameFactory);
            }
              }
              var newSnapshot = _fileSystemSnapshotBuilder.Compute(fileNameFactory, files, Interlocked.Increment(ref _version));

              // Monitor all the Chromium directories for changes.
              var newRoots = newSnapshot.ProjectRoots
            .Select(entry => entry.Directory.DirectoryName.FullPath);
              _directoryChangeWatcher.WatchDirectories(newRoots);

              // Update current tree atomically
              FileSystemTreeSnapshot previousSnapshot;
              lock (_lock) {
            previousSnapshot = _fileSystemSnapshot;
            _fileSystemSnapshot = newSnapshot;
              }

              sw.Stop();
              Logger.Log(">>>>>>>> Done collecting list of files: {0:n0} files in {1:n0} directories collected in {2:n0} msec.",
            newSnapshot.ProjectRoots.Aggregate(0, (acc, x) => acc + CountFileEntries(x.Directory)),
            newSnapshot.ProjectRoots.Aggregate(0, (acc, x) => acc + CountDirectoryEntries(x.Directory)),
            sw.ElapsedMilliseconds);
              Logger.LogMemoryStats();

              OnSnapshotComputed(new SnapshotComputedResult {
            OperationInfo = info,
            PreviousSnapshot = previousSnapshot,
            NewSnapshot = newSnapshot
              });
            }
              });
        }
    private FileSystemTreeSnapshot ComputeNewSnapshot(FileSystemTreeSnapshot oldSnapshot, FullPathChanges pathChanges) {
      using (new TimeElapsedLogger("Computing snapshot delta from list of file changes")) {
        // Get list of currently registered files.
        var rootFiles = new List<FullPath>();
        lock (_lock) {
          ValidateKnownFiles();
          rootFiles.AddRange(_registeredFiles);
        }

        // file name factory
        var fileNameFactory = _fileSystemNameFactory;
        if (ReuseFileNameInstances) {
          if (_fileSystemSnapshot.ProjectRoots.Count > 0) {
            fileNameFactory = new FileSystemTreeSnapshotNameFactory(_fileSystemSnapshot, fileNameFactory);
          }
        }

        // Compute new snapshot
        var newSnapshot = _fileSystemSnapshotBuilder.Compute(
          fileNameFactory,
          oldSnapshot,
          pathChanges,
          rootFiles,
          Interlocked.Increment(ref _version));

        // Monitor all the Chromium directories for changes.
        var newRoots = newSnapshot.ProjectRoots
          .Select(entry => entry.Directory.DirectoryName.FullPath);
        _directoryChangeWatcher.WatchDirectories(newRoots);

        return newSnapshot;
      }
    }