Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(core): reformat to reduce spurious newlines #16038

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions core/audits/byte-efficiency/byte-efficiency-audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {Audit} from '../audit.js';
import * as i18n from '../../lib/i18n/i18n.js';
import {NetworkRecords} from '../../computed/network-records.js';
import {LoadSimulator} from '../../computed/load-simulator.js';
import {LanternLargestContentfulPaint} from '../../computed/metrics/lantern-largest-contentful-paint.js';
import {LanternFirstContentfulPaint} from '../../computed/metrics/lantern-first-contentful-paint.js';
import {LanternLargestContentfulPaint as LanternLCP} from '../../computed/metrics/lantern-largest-contentful-paint.js';
import {LanternFirstContentfulPaint as LanternFCP} from '../../computed/metrics/lantern-first-contentful-paint.js';
import {LCPImageRecord} from '../../computed/lcp-image-record.js';

const str_ = i18n.createIcuMessageFn(import.meta.url, {});
Expand Down Expand Up @@ -171,12 +171,10 @@ class ByteEfficiencyAudit extends Audit {
// This is useful information in the LHR and should be preserved.
let wastedMs;
if (metricComputationInput.gatherContext.gatherMode === 'navigation') {
const {
optimisticGraph: optimisticFCPGraph,
} = await LanternFirstContentfulPaint.request(metricComputationInput, context);
const {
optimisticGraph: optimisticLCPGraph,
} = await LanternLargestContentfulPaint.request(metricComputationInput, context);
const optimisticFCPGraph = (await LanternFCP.request(metricComputationInput, context))
.optimisticGraph;
const optimisticLCPGraph = (await LanternLCP.request(metricComputationInput, context))
.optimisticGraph;

const {savings: fcpSavings} = this.computeWasteWithGraph(
results,
Expand Down
20 changes: 6 additions & 14 deletions core/lib/lantern/metrics/first-contentful-paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ class FirstContentfulPaint extends Metric {
* @param {FirstPaintBasedGraphOpts<T>} opts
* @return {{definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>}}
*/
static getRenderBlockingNodeData(
graph,
{cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}
) {
static getRenderBlockingNodeData(graph, opts) {
/** @type {Map<string, CpuNode>} A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */
const scriptUrlToNodeMap = new Map();
const {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking} =
opts;

/** @type {Array<CpuNode>} */
const cpuNodes = [];
Expand Down Expand Up @@ -135,17 +134,10 @@ class FirstContentfulPaint extends Metric {
* @param {FirstPaintBasedGraphOpts<T>} opts
* @return {Node}
*/
static getFirstPaintBasedGraph(
dependencyGraph,
{cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}
) {
const rbData = this.getRenderBlockingNodeData(dependencyGraph, {
cutoffTimestamp,
treatNodeAsRenderBlocking,
additionalCpuNodesToTreatAsRenderBlocking,
});
static getFirstPaintBasedGraph(dependencyGraph, opts) {
const rbData = this.getRenderBlockingNodeData(dependencyGraph, opts);
const {definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds} = rbData;

const {cutoffTimestamp, treatNodeAsRenderBlocking} = opts;
return dependencyGraph.cloneWithRelationships(node => {
if (node.type === BaseNode.TYPES.NETWORK) {
// Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)
Expand Down
Loading