Bug 233075 - Add a helper class to coordinate batch analysis of images
Summary: Add a helper class to coordinate batch analysis of images
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks: 233210
  Show dependency treegraph
 
Reported: 2021-11-12 15:36 PST by Wenson Hsieh
Modified: 2021-11-17 12:23 PST (History)
12 users (show)

See Also:


Attachments
Patch (22.97 KB, patch)
2021-11-12 15:57 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Rebase + implement more logic (24.99 KB, patch)
2021-11-16 08:51 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Remove unnecessary SPI (24.27 KB, patch)
2021-11-17 08:50 PST, Wenson Hsieh
dino: review+
Details | Formatted Diff | Diff
Patch for landing (24.38 KB, patch)
2021-11-17 11:35 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2021-11-12 15:36:44 PST
.
Comment 1 Wenson Hsieh 2021-11-12 15:57:48 PST Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2021-11-16 08:51:20 PST Comment hidden (obsolete)
Comment 3 Wenson Hsieh 2021-11-17 08:50:31 PST
Created attachment 444527 [details]
Remove unnecessary SPI
Comment 4 Dean Jackson 2021-11-17 11:21:04 PST
Comment on attachment 444527 [details]
Remove unnecessary SPI

View in context: https://bugs.webkit.org/attachment.cgi?id=444527&action=review

> Source/WebCore/page/ImageAnalysisQueue.cpp:59
> +    auto imageIterator = document.images()->createIterator();

What order does document.images() use? I wonder if we can have an iterator that is in document order (more likely to have the images on screen up front).

Also, what happens with lazy loaded images?
Comment 5 Wenson Hsieh 2021-11-17 11:29:51 PST
Comment on attachment 444527 [details]
Remove unnecessary SPI

View in context: https://bugs.webkit.org/attachment.cgi?id=444527&action=review

Thanks for the review!

>> Source/WebCore/page/ImageAnalysisQueue.cpp:59
>> +    auto imageIterator = document.images()->createIterator();
> 
> What order does document.images() use? I wonder if we can have an iterator that is in document order (more likely to have the images on screen up front).
> 
> Also, what happens with lazy loaded images?

Good question! So `document.images()` is already in DOM order, but this is actually not ideal because (as you hinted) it would be better to prioritize images that are on-screen vs. images that are offscreen.

For lazily loaded images, I *think* we'll also exclude them from the queue here because the cached image would be 0x0. I have a followup task to add a way to queue images that are dynamically inserted into the document, so I'll use that to make sure lazy loaded images are also handled by these changes. For the time being, I'll file a new bugzilla bug and add a FIXME here.
Comment 6 Wenson Hsieh 2021-11-17 11:35:19 PST
Created attachment 444542 [details]
Patch for landing
Comment 7 EWS 2021-11-17 12:22:18 PST
Committed r285949 (244351@main): <https://commits.webkit.org/244351@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 444542 [details].
Comment 8 Radar WebKit Bug Importer 2021-11-17 12:23:26 PST
<rdar://problem/85515876>