Skip to content

Commit a561611

Browse files
Nancy LiDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Add render blocking information in the summary tab
Screenshots: https://screenshot.googleplex.com/45W9y9y5xAfJmuF Bug: 369638421 Change-Id: I59082faf8417aa82772f566ed5643973545ebd5f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5934457 Commit-Queue: Paul Irish <[email protected]> Reviewed-by: Paul Irish <[email protected]> Reviewed-by: Connor Clark <[email protected]>
1 parent 8acdcd5 commit a561611

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

front_end/panels/timeline/TimelineDetailsView.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ describeWithEnvironment('TimelineDetailsView', function() {
7777
title: 'Initiated by',
7878
value: 'chromedevtools.github.io/performance-stories/lcp-web-font/index.html',
7979
},
80+
{
81+
title: 'Blocking',
82+
value: 'Render blocking',
83+
},
8084
{title: 'From cache', value: 'Yes'},
8185
{title: 'Duration', value: durationInnerText},
8286
],

front_end/panels/timeline/components/NetworkRequestDetails.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ describeWithMockConnection('NetworkRequestDetails', () => {
5252
title: 'Initiated by',
5353
value: 'chromedevtools.github.io/performance-stories/lcp-web-font/index.html',
5454
},
55+
{
56+
title: 'Blocking',
57+
value: 'Render blocking',
58+
},
5559
{title: 'From cache', value: 'Yes'},
5660
{title: 'Duration', value: durationInnerText},
5761
],

front_end/panels/timeline/components/NetworkRequestDetails.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import '../../../ui/components/request_link_icon/request_link_icon.js';
77
import * as i18n from '../../../core/i18n/i18n.js';
88
import * as Platform from '../../../core/platform/platform.js';
99
import type * as SDK from '../../../core/sdk/sdk.js';
10+
import * as Helpers from '../../../models/trace/helpers/helpers.js';
1011
import * as Trace from '../../../models/trace/trace.js';
1112
import type * as RequestLinkIcon from '../../../ui/components/request_link_icon/request_link_icon.js';
1213
import * as PerfUI from '../../../ui/legacy/components/perf_ui/perf_ui.js';
@@ -107,6 +108,18 @@ const UIStrings = {
107108
*@description Text that refers to the waiting on main thread time of a network request
108109
*/
109110
waitingOnMainThread: 'Waiting on main thread',
111+
/**
112+
*@description Text that refers to if the network request is blocking
113+
*/
114+
blocking: 'Blocking',
115+
/**
116+
*@description Text that refers to if the network request is in-body parser render blocking
117+
*/
118+
inBodyParserBlocking: 'In-body parser blocking',
119+
/**
120+
*@description Text that refers to if the network request is render blocking
121+
*/
122+
renderBlocking: 'Render blocking',
110123
};
111124
const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/NetworkRequestDetails.ts', UIStrings);
112125
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -295,6 +308,26 @@ export class NetworkRequestDetails extends HTMLElement {
295308
return null;
296309
}
297310

311+
#renderBlockingRow(): LitHtml.TemplateResult|null {
312+
if (!this.#networkRequest || !Helpers.Network.isSyntheticNetworkRequestEventRenderBlocking(this.#networkRequest)) {
313+
return null;
314+
}
315+
316+
let renderBlockingText;
317+
switch (this.#networkRequest.args.data.renderBlocking) {
318+
case 'blocking':
319+
renderBlockingText = UIStrings.renderBlocking;
320+
break;
321+
case 'in_body_parser_blocking':
322+
renderBlockingText = UIStrings.inBodyParserBlocking;
323+
break;
324+
default:
325+
// Shouldn't fall to this block, if so, this network request is not render blocking, so return null.
326+
return null;
327+
}
328+
return this.#renderRow(i18nString(UIStrings.blocking), renderBlockingText);
329+
}
330+
298331
async #renderPreviewElement(): Promise<LitHtml.TemplateResult|null> {
299332
if (!this.#networkRequest) {
300333
return null;
@@ -400,6 +433,7 @@ export class NetworkRequestDetails extends HTMLElement {
400433
${this.#renderEncodedDataLength()}
401434
${this.#renderRow(i18nString(UIStrings.decodedBody), Platform.NumberUtilities.bytesToString(this.#networkRequest.args.data.decodedBodyLength))}
402435
${this.#renderInitiatedBy()}
436+
${this.#renderBlockingRow()}
403437
${await this.#renderPreviewElement()}
404438
</div>
405439
<div class="network-request-details-col">

0 commit comments

Comments
 (0)