static browserMainThread(tracingModel) {
    const processes = tracingModel.sortedProcesses();
    // Avoid warning for an empty model.
    if (!processes.length)
      return null;
    const browserMainThreadName = 'CrBrowserMain';
    const browserProcesses = [];
    const browserMainThreads = [];
    for (const process of processes) {
      if (process.name().toLowerCase().endsWith('browser'))
        browserProcesses.push(process);
      browserMainThreads.push(...process.sortedThreads().filter(t => t.name() === browserMainThreadName));
    }
    if (browserMainThreads.length === 1)
      return browserMainThreads[0];
    if (browserProcesses.length === 1)
      return browserProcesses[0].threadByName(browserMainThreadName);
    const tracingStartedInBrowser =
        tracingModel.devToolsMetadataEvents().filter(e => e.name === 'TracingStartedInBrowser');
    if (tracingStartedInBrowser.length === 1)
      return tracingStartedInBrowser[0].thread;
    Common.console.error('Failed to find browser main thread in trace, some timeline features may be unavailable');
    return null;
  }
/**
   * @param {!SDK.TracingModel} tracingModel
   * @return {?SDK.TracingModel.Thread}
   *
   * TODO: Move this to a better place. This is here just for convenience o
   * re-use between modules. This really belongs to a higher level, since it
   * is specific to chrome's usage of tracing.
   */


Move this to a better place. This is here just for convenience o
re-use between modules. This really belongs to a higher level, since it
is specific to chrome's usage of tracing.
Move this to a better place . This is here just for convenience o re - use between modules . This really belongs to a higher level since it is specific to chrome ' s usage of tracing .
static browserMainThread(tracingModel) {
    const processes = tracingModel.sortedProcesses();
    if (!processes.length)
      return null;
    const browserMainThreadName = 'CrBrowserMain';
    const browserProcesses = [];
    const browserMainThreads = [];
    for (const process of processes) {
      if (process.name().toLowerCase().endsWith('browser'))
        browserProcesses.push(process);
      browserMainThreads.push(...process.sortedThreads().filter(t => t.name() === browserMainThreadName));
    }
    if (browserMainThreads.length === 1)
      return browserMainThreads[0];
    if (browserProcesses.length === 1)
      return browserProcesses[0].threadByName(browserMainThreadName);
    const tracingStartedInBrowser =
        tracingModel.devToolsMetadataEvents().filter(e => e.name === 'TracingStartedInBrowser');
    if (tracingStartedInBrowser.length === 1)
      return tracingStartedInBrowser[0].thread;
    Common.console.error('Failed to find browser main thread in trace, some timeline features may be unavailable');
    return null;
  }
static browserMainThread ( tracingModel ) { const processes = tracingModel . sortedProcesses ( ) ; if ( ! processes . length ) return null ; const browserMainThreadName = 'CrBrowserMain' ; const browserProcesses = [ ] ; const browserMainThreads = [ ] ; for ( const process of processes ) { if ( process . name ( ) . toLowerCase ( ) . endsWith ( 'browser' ) ) browserProcesses . push ( process ) ; browserMainThreads . push ( ... process . sortedThreads ( ) . filter ( t => t . name ( ) === browserMainThreadName ) ) ; } if ( browserMainThreads . length === 1 ) return browserMainThreads [ 0 ] ; if ( browserProcesses . length === 1 ) return browserProcesses [ 0 ] . threadByName ( browserMainThreadName ) ; const tracingStartedInBrowser = tracingModel . devToolsMetadataEvents ( ) . filter ( e => e . name === 'TracingStartedInBrowser' ) ; if ( tracingStartedInBrowser . length === 1 ) return tracingStartedInBrowser [ 0 ] . thread ; Common . console . error ( 'Failed to find browser main thread in trace, some timeline features may be unavailable' ) ; return null ; }
@param {!SDK.TracingModel} tracingModel
 @return {?SDK.TracingModel.Thread}
@param { !SDK . TracingModel } tracingModel @return { ?SDK . TracingModel . Thread }
// Avoid warning for an empty model.