@@ -308,6 +308,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
308308 #interactionsListEl?: HTMLElement ;
309309 #layoutShiftsListEl?: HTMLElement ;
310310 #listIsScrolling = false ;
311+ #deviceModeModel = EmulationModel . DeviceModeModel . DeviceModeModel . tryInstance ( ) ;
311312
312313 constructor ( ) {
313314 super ( ) ;
@@ -396,8 +397,8 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
396397 const cruxManager = CrUXManager . CrUXManager . instance ( ) ;
397398 cruxManager . addEventListener ( CrUXManager . Events . FIELD_DATA_CHANGED , this . #onFieldDataChanged, this ) ;
398399
399- const emulationModel = this . #deviceModeModel( ) ;
400- emulationModel ?. addEventListener ( EmulationModel . DeviceModeModel . Events . UPDATED , this . #onEmulationChanged, this ) ;
400+ this . #deviceModeModel?. addEventListener (
401+ EmulationModel . DeviceModeModel . Events . UPDATED , this . #onEmulationChanged, this ) ;
401402
402403 if ( cruxManager . getConfigSetting ( ) . get ( ) . enabled ) {
403404 void this . #refreshFieldDataForCurrentPage( ) ;
@@ -411,27 +412,13 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
411412 void ComponentHelpers . ScheduledRender . scheduleRender ( this , this . #render) ;
412413 }
413414
414- #deviceModeModel( ) : EmulationModel . DeviceModeModel . DeviceModeModel | null {
415- // This is wrapped in a try/catch because in some DevTools entry points
416- // (such as worker_app.ts) the Emulation panel is not included and as such
417- // the below code fails; it tries to instantiate the model which requires
418- // reading the value of a setting which has not been registered.
419- // In this case, we fallback to 'ALL'. See crbug.com/361515458 for an
420- // example bug that this resolves.
421- try {
422- return EmulationModel . DeviceModeModel . DeviceModeModel . instance ( ) ;
423- } catch {
424- return null ;
425- }
426- }
427-
428415 disconnectedCallback ( ) : void {
429416 LiveMetrics . LiveMetrics . instance ( ) . removeEventListener ( LiveMetrics . Events . STATUS , this . #onMetricStatus, this ) ;
430417
431418 const cruxManager = CrUXManager . CrUXManager . instance ( ) ;
432419 cruxManager . removeEventListener ( CrUXManager . Events . FIELD_DATA_CHANGED , this . #onFieldDataChanged, this ) ;
433420
434- this . #deviceModeModel( ) ?. removeEventListener (
421+ this . #deviceModeModel?. removeEventListener (
435422 EmulationModel . DeviceModeModel . Events . UPDATED , this . #onEmulationChanged, this ) ;
436423 }
437424
@@ -448,6 +435,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
448435 fieldValue : fieldData ?. percentiles ?. p75 ,
449436 histogram : fieldData ?. histogram ,
450437 tooltipContainer : this . #tooltipContainerEl,
438+ warnings : this . #lcpValue?. warnings ,
451439 phases : phases && [
452440 [ i18nString ( UIStrings . timeToFirstByte ) , phases . timeToFirstByte ] ,
453441 [ i18nString ( UIStrings . resourceLoadDelay ) , phases . resourceLoadDelay ] ,
@@ -482,6 +470,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
482470 fieldValue : fieldData ?. percentiles ?. p75 ,
483471 histogram : fieldData ?. histogram ,
484472 tooltipContainer : this . #tooltipContainerEl,
473+ warnings : this . #clsValue?. warnings ,
485474 } as MetricCardData } >
486475 ${ clusterIsVisible ? html `
487476 < div class ="related-info " slot ="extra-info ">
@@ -512,6 +501,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
512501 fieldValue : fieldData ?. percentiles ?. p75 ,
513502 histogram : fieldData ?. histogram ,
514503 tooltipContainer : this . #tooltipContainerEl,
504+ warnings : this . #inpValue?. warnings ,
515505 phases : phases && [
516506 [ i18nString ( UIStrings . inputDelay ) , phases . inputDelay ] ,
517507 [ i18nString ( UIStrings . processingDuration ) , phases . processingDuration ] ,
@@ -756,13 +746,11 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
756746 }
757747
758748 #getAutoDeviceScope( ) : CrUXManager . DeviceScope {
759- const emulationModel = this . #deviceModeModel( ) ;
760-
761- if ( emulationModel === null ) {
749+ if ( this . #deviceModeModel === null ) {
762750 return 'ALL' ;
763751 }
764752
765- if ( emulationModel . isMobile ( ) ) {
753+ if ( this . #deviceModeModel . isMobile ( ) ) {
766754 if ( this . #cruxPageResult?. [ `${ this . #fieldPageScope} -PHONE` ] ) {
767755 return 'PHONE' ;
768756 }
0 commit comments