_reportDiff(diff) {
      if (!diff || !diff.content) { return; }

      // Count the delta lines stemming from normal deltas, and from
      // due_to_rebase deltas.
      let nonRebaseDelta = 0;
      let rebaseDelta = 0;
      diff.content.forEach(chunk => {
        if (chunk.ab) { return; }
        const deltaSize = Math.max(
            chunk.a ? chunk.a.length : 0, chunk.b ? chunk.b.length : 0);
        if (chunk.due_to_rebase) {
          rebaseDelta += deltaSize;
        } else {
          nonRebaseDelta += deltaSize;
        }
      });

      // Find the percent of the delta from due_to_rebase chunks rounded to two
      // digits. Diffs with no delta are considered 0%.
      const totalDelta = rebaseDelta + nonRebaseDelta;
      const percentRebaseDelta = !totalDelta ? 0 :
          Math.round(100 * rebaseDelta / totalDelta);

      // Report the due_to_rebase percentage in the "diff" category when
      // applicable.
      if (this.patchRange.basePatchNum === 'PARENT') {
        this.$.reporting.reportInteraction(EVENT_AGAINST_PARENT);
      } else if (percentRebaseDelta === 0) {
        this.$.reporting.reportInteraction(EVENT_ZERO_REBASE);
      } else {
        this.$.reporting.reportInteraction(EVENT_NONZERO_REBASE,
            percentRebaseDelta);
      }
    }
/**
     * Report info about the diff response.
     */
Report info about the diff response.
Report info about the diff response .
_reportDiff(diff) {
      if (!diff || !diff.content) { return; }
      let nonRebaseDelta = 0;
      let rebaseDelta = 0;
      diff.content.forEach(chunk => {
        if (chunk.ab) { return; }
        const deltaSize = Math.max(
            chunk.a ? chunk.a.length : 0, chunk.b ? chunk.b.length : 0);
        if (chunk.due_to_rebase) {
          rebaseDelta += deltaSize;
        } else {
          nonRebaseDelta += deltaSize;
        }
      });
      const totalDelta = rebaseDelta + nonRebaseDelta;
      const percentRebaseDelta = !totalDelta ? 0 :
          Math.round(100 * rebaseDelta / totalDelta);
      if (this.patchRange.basePatchNum === 'PARENT') {
        this.$.reporting.reportInteraction(EVENT_AGAINST_PARENT);
      } else if (percentRebaseDelta === 0) {
        this.$.reporting.reportInteraction(EVENT_ZERO_REBASE);
      } else {
        this.$.reporting.reportInteraction(EVENT_NONZERO_REBASE,
            percentRebaseDelta);
      }
    }
_reportDiff ( diff ) { if ( ! diff || ! diff . content ) { return ; } let nonRebaseDelta = 0 ; let rebaseDelta = 0 ; diff . content . forEach ( chunk => { if ( chunk . ab ) { return ; } const deltaSize = Math . max ( chunk . a ? chunk . a . length : 0 , chunk . b ? chunk . b . length : 0 ) ; if ( chunk . due_to_rebase ) { rebaseDelta += deltaSize ; } else { nonRebaseDelta += deltaSize ; } } ) ; const totalDelta = rebaseDelta + nonRebaseDelta ; const percentRebaseDelta = ! totalDelta ? 0 : Math . round ( 100 * rebaseDelta / totalDelta ) ; if ( this . patchRange . basePatchNum === 'PARENT' ) { this . $ . reporting . reportInteraction ( EVENT_AGAINST_PARENT ) ; } else if ( percentRebaseDelta === 0 ) { this . $ . reporting . reportInteraction ( EVENT_ZERO_REBASE ) ; } else { this . $ . reporting . reportInteraction ( EVENT_NONZERO_REBASE , percentRebaseDelta ) ; } }
Report info about the diff response.
Report info about the diff response .
// Count the delta lines stemming from normal deltas, and from // due_to_rebase deltas. // Find the percent of the delta from due_to_rebase chunks rounded to two // digits. Diffs with no delta are considered 0%. // Report the due_to_rebase percentage in the "diff" category when // applicable.