docs: function(end_timestamp, args) {
        // Don't generate a slice if the last active thread is the idle task.
        if (this.lastActiveThread_ == undefined || this.lastActiveThread_ == 0)
          return;
  
        if (end_timestamp < this.lastActiveTimestamp_) {
          throw new Error('The end timestamp of a thread running on CPU ' +
                          this.cpuNumber + ' is before its start timestamp.');
        }
  
        // Merge |args| with |this.lastActiveArgs_|. If a key is in both
        // dictionaries, the value from |args| is used.
        for (var key in args) {
          this.lastActiveArgs_[key] = args[key];
        }
  
        var duration = end_timestamp - this.lastActiveTimestamp_;
        var slice = new tr.model.CpuSlice(
            '', this.lastActiveName_,
            ColorScheme.getColorIdForGeneralPurposeString(this.lastActiveName_),
            this.lastActiveTimestamp_,
            this.lastActiveArgs_,
            duration);
        slice.cpu = this;
        this.slices.push(slice);
  
        // Clear the last state.
        this.lastActiveTimestamp_ = undefined;
        this.lastActiveThread_ = undefined;
        this.lastActiveName_ = undefined;
        this.lastActiveArgs_ = undefined;
      }