netlog_viewer/netlog_viewer/log_view_painter.js
function defaultWriteParameter(key, value, out) {
    if (key === 'headers' && value instanceof Array) {
      out.writeArrowIndentedLines(value);
      return;
    }

    // For transferred bytes, display the bytes in hex and ASCII.
    // TODO(eroman): 'hex_encoded_bytes' was removed in M73, and
    //               support for it can be removed in the future.
    if (key === 'hex_encoded_bytes' && typeof value === 'string') {
      const bytes = tryParseHexToBytes(value);
      if (bytes) {
        out.writeArrowKey(key);
        writeHexString(bytes, out);
        return;
      }
    }

    if (key === 'bytes' && typeof value === 'string') {
      const bytes = tryParseBase64ToBytes(value);
      if (bytes) {
        out.writeArrowKey(key);
        writeHexString(bytes, out);
        return;
      }
    }

    // Handle source_dependency entries - add link and map source type to
    // string.
    if (key === 'source_dependency' && typeof value === 'object') {
      const link = '#events&s=' + value.id;
      const valueStr = value.id + ' (' + EventSourceTypeNames[value.type] + ')';
      out.writeArrowKeyValue(key, valueStr, link);
      return;
    }

    if (key === 'net_error' && typeof value === 'number') {
      const valueStr = value + ' (' + netErrorToString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'quic_error' && typeof value === 'number') {
      const valueStr = value + ' (' + quicErrorToString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'quic_crypto_handshake_message' && typeof value === 'string') {
      const lines = value.split('\n');
      out.writeArrowIndentedLines(lines);
      return;
    }

    if (key === 'quic_rst_stream_error' && typeof value === 'number') {
      const valueStr = value + ' (' + quicRstStreamErrorToString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'load_flags' && typeof value === 'number') {
      const valueStr = value + ' (' + getLoadFlagSymbolicString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'load_state' && typeof value === 'number') {
      const valueStr = value + ' (' + getKeyWithValue(LoadState, value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    // Otherwise just default to JSON formatting of the value.
    out.writeArrowKeyValue(key, JSON.stringify(value));
  }
function defaultWriteParameter(key, value, out) {
    if (key === 'headers' && value instanceof Array) {
      out.writeArrowIndentedLines(value);
      return;
    }

    // For transferred bytes, display the bytes in hex and ASCII.
    // TODO(eroman): 'hex_encoded_bytes' was removed in M73, and
    //               support for it can be removed in the future.
    if (key === 'hex_encoded_bytes' && typeof value === 'string') {
      const bytes = tryParseHexToBytes(value);
      if (bytes) {
        out.writeArrowKey(key);
        writeHexString(bytes, out);
        return;
      }
    }

    if (key === 'bytes' && typeof value === 'string') {
      const bytes = tryParseBase64ToBytes(value);
      if (bytes) {
        out.writeArrowKey(key);
        writeHexString(bytes, out);
        return;
      }
    }

    // Handle source_dependency entries - add link and map source type to
    // string.
    if (key === 'source_dependency' && typeof value === 'object') {
      const link = '#events&s=' + value.id;
      const valueStr = value.id + ' (' + EventSourceTypeNames[value.type] + ')';
      out.writeArrowKeyValue(key, valueStr, link);
      return;
    }

    if (key === 'net_error' && typeof value === 'number') {
      const valueStr = value + ' (' + netErrorToString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'quic_error' && typeof value === 'number') {
      const valueStr = value + ' (' + quicErrorToString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'quic_crypto_handshake_message' && typeof value === 'string') {
      const lines = value.split('\n');
      out.writeArrowIndentedLines(lines);
      return;
    }

    if (key === 'quic_rst_stream_error' && typeof value === 'number') {
      const valueStr = value + ' (' + quicRstStreamErrorToString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'load_flags' && typeof value === 'number') {
      const valueStr = value + ' (' + getLoadFlagSymbolicString(value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    if (key === 'load_state' && typeof value === 'number') {
      const valueStr = value + ' (' + getKeyWithValue(LoadState, value) + ')';
      out.writeArrowKeyValue(key, valueStr);
      return;
    }

    // Otherwise just default to JSON formatting of the value.
    out.writeArrowKeyValue(key, JSON.stringify(value));
  }
function defaultWriteParameter ( key , value , out ) { if ( key === 'headers' && value instanceof Array ) { out . writeArrowIndentedLines ( value ) ; return ; } // For transferred bytes, display the bytes in hex and ASCII. // TODO(eroman): 'hex_encoded_bytes' was removed in M73, and //               support for it can be removed in the future. if ( key === 'hex_encoded_bytes' && typeof value === 'string' ) { const bytes = tryParseHexToBytes ( value ) ; if ( bytes ) { out . writeArrowKey ( key ) ; writeHexString ( bytes , out ) ; return ; } } if ( key === 'bytes' && typeof value === 'string' ) { const bytes = tryParseBase64ToBytes ( value ) ; if ( bytes ) { out . writeArrowKey ( key ) ; writeHexString ( bytes , out ) ; return ; } } // Handle source_dependency entries - add link and map source type to // string. if ( key === 'source_dependency' && typeof value === 'object' ) { const link = '#events&s=' + value . id ; const valueStr = value . id + ' (' + EventSourceTypeNames [ value . type ] + ')' ; out . writeArrowKeyValue ( key , valueStr , link ) ; return ; } if ( key === 'net_error' && typeof value === 'number' ) { const valueStr = value + ' (' + netErrorToString ( value ) + ')' ; out . writeArrowKeyValue ( key , valueStr ) ; return ; } if ( key === 'quic_error' && typeof value === 'number' ) { const valueStr = value + ' (' + quicErrorToString ( value ) + ')' ; out . writeArrowKeyValue ( key , valueStr ) ; return ; } if ( key === 'quic_crypto_handshake_message' && typeof value === 'string' ) { const lines = value . split ( '\n' ) ; out . writeArrowIndentedLines ( lines ) ; return ; } if ( key === 'quic_rst_stream_error' && typeof value === 'number' ) { const valueStr = value + ' (' + quicRstStreamErrorToString ( value ) + ')' ; out . writeArrowKeyValue ( key , valueStr ) ; return ; } if ( key === 'load_flags' && typeof value === 'number' ) { const valueStr = value + ' (' + getLoadFlagSymbolicString ( value ) + ')' ; out . writeArrowKeyValue ( key , valueStr ) ; return ; } if ( key === 'load_state' && typeof value === 'number' ) { const valueStr = value + ' (' + getKeyWithValue ( LoadState , value ) + ')' ; out . writeArrowKeyValue ( key , valueStr ) ; return ; } // Otherwise just default to JSON formatting of the value. out . writeArrowKeyValue ( key , JSON . stringify ( value ) ) ; }
Default parameter writer that outputs a visualization of field named |key|
with value |value| to |out|.
Default parameter writer that outputs a visualization of field named |key| with value |value| to |out| .