constructor()

in src/main/resources/static/coverage.js [33:86]


  constructor(plugin) {
    this.provideCoverageRanges = this.provideCoverageRanges.bind(this);
    this.prefetchCoverageRanges = this.prefetchCoverageRanges.bind(this);
    this.provideCoveragePercentages =
        this.provideCoveragePercentages.bind(this);

    this.plugin = plugin;

    // Used to cache coverage config for a project.
    this.coverageConfig = {
      // Used to validate/invalidate the cache.
      project: null,

      // Used to indicate an async fetch of per-project configuration, and it
      // is exepcted to be resolved to an object defined by:
      // https://chromium.googlesource.com/infra/gerrit-plugins/code-coverage/+/refs/heads/master/src/main/java/com/googlesource/chromium/plugins/coverage/GetConfig.java#34
      configPromise: null,
    }

    // Used to cache coverage date for a patchset.
    this.coverageData = {
      // Used to validate/invalidate the cache.
      changeInfo: {
        host: null,
        project: null,
        changeNum: null,
        patchNum: null,
      },

      // Used to indicate that an async fetch of coverage ranges, and it is
      // expeccted to be resolved to an object with following format:
      // An object whose properties are file paths and corresponding values
      // are arrays of coverage ranges with the following format:
      // {
      //   side: 'right',
      //   type: 'COVERED',
      //   code_range: {
      //     start_line: 1,
      //     end_line: 3,
      //   },
      // };
      rangesPromise: null,

      // Used to indicate an async fetch of coverage percentages, and it is
      // expected to be resolved to an object with following format:
      // An object whose properties are file paths and corresponding values
      // are also objects that look like:
      // {
      //   absolute: 99, // Coverage percentage of all lines.
      //   incremental: 75, // Coverage percentages of added lines.
      // };
      percentagesPromise: null,
    };
  }