processHeaders_(xhr) {
    if (this.format_ == 'text') {
      xhr.headers.set('Content-Type', 'application/grpc-web-text');
      xhr.headers.set('Accept', 'application/grpc-web-text');
    } else {
      xhr.headers.set('Content-Type', 'application/grpc-web+proto');
    }
    xhr.headers.set('X-User-Agent', 'grpc-web-javascript/0.1');
    xhr.headers.set('X-Grpc-Web', '1');
    if (xhr.headers.has('deadline')) {
      const deadline = Number(xhr.headers.get('deadline'));  // in ms
      const currentTime = (new Date()).getTime();
      let timeout = Math.ceil(deadline - currentTime);
      xhr.headers.delete('deadline');
      if (timeout === Infinity) {
        // grpc-timeout header defaults to infinity if not set.
        timeout = 0;
      }
      if (timeout > 0) {
        xhr.headers.set('grpc-timeout', timeout + 'm');
        // Also set timeout on the xhr request to terminate the HTTP request
        // if the server doesn't respond within the deadline. We use 110% of
        // grpc-timeout for this to allow the server to terminate the connection
        // with DEADLINE_EXCEEDED rather than terminating it in the Browser, but
        // at least 1 second in case the user is on a high-latency network.
        xhr.setTimeoutInterval(Math.max(1000, Math.ceil(timeout * 1.1)));
      }
    }
  }
@private
@param {!XhrIo} xhr The xhr object