Skip to content

Commit da4bf5a

Browse files
Adam RaineDevtools-frontend LUCI CQ
authored andcommitted
[UseCache] Filter to context bounds
Bug: None Change-Id: Id481a6bade76630433c856ec652ffc8c57608ecc Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6379246 Auto-Submit: Adam Raine <[email protected]> Reviewed-by: Connor Clark <[email protected]> Commit-Queue: Connor Clark <[email protected]>
1 parent db52fce commit da4bf5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

front_end/models/trace/insights/UseCache.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,13 @@ export interface CacheableRequest {
190190

191191
export function generateInsight(
192192
parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): UseCacheInsightModel {
193+
const isWithinContext = (event: Types.Events.Event): boolean => Helpers.Timing.eventIsInBounds(event, context.bounds);
194+
const contextRequests = parsedTrace.NetworkRequests.byTime.filter(isWithinContext);
195+
193196
const results: CacheableRequest[] = [];
194-
const allRequests = parsedTrace.NetworkRequests.byTime;
195197
let totalWastedBytes = 0;
196198
const wastedBytesByRequestId = new Map<string, number>();
197-
for (const req of allRequests) {
199+
for (const req of contextRequests) {
198200
if (!isCacheable(req)) {
199201
continue;
200202
}

0 commit comments

Comments
 (0)