Skip to content

Convert PDFPageViewBuffer to a standard class, and use a Set internally #14245

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

Merged
merged 4 commits into from
Nov 7, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

Please refer to the individual commit messages.

…it-test (PR 14238 follow-up)

This small change will help validate an important part of the upcoming re-factoring, regarding the *correct* iteration of the `Set` in the `PDFPageViewBuffer.resize` method in particular.
This patch makes use of private `class` fields, to ensure that the previously "private" properties remain as such.
This relies on the fact that `Set`s preserve the insertion order[1], which means that we can utilize an iterator to access the *first* stored view.

Note that in the `resize`-method, we can now move the visible pages to the back of the buffer using a single loop (hence we don't need to use the `moveToEndOfArray` helper function any more).

---
[1] This applies to `Map`s as well, although that's not entirely relevant here.
With the previous patch, this helper function is no longer used and keeping it around will simply increase the size of the builds.
This removal is purposely done *separately*, to make it easy to revert the patch in the future if this helper function would become useful again.
Comment on lines +146 to +148
if (++i > ii) {
break;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note: The unit-test was updated to ensure that I didn't mess up this particular condition.

@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

pdfjsbot commented Nov 6, 2021

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/f782d4299391a8a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 6, 2021

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/9cfa9240d8ae041/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 6, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/f782d4299391a8a/output.txt

Total script time: 2.97 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Nov 6, 2021

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/9cfa9240d8ae041/output.txt

Total script time: 6.12 mins

  • Unit Tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Nov 6, 2021

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/455eaee7a43e1ed/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 6, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/455eaee7a43e1ed/output.txt

Total script time: 4.37 mins

Published

@Snuffleupagus Snuffleupagus marked this pull request as ready for review November 6, 2021 20:23
@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2021

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/aa865176a9e79e9/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2021

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/e0cba4b48d8dda0/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/e0cba4b48d8dda0/output.txt

Total script time: 3.94 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2021

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/aa865176a9e79e9/output.txt

Total script time: 6.15 mins

  • Integration Tests: Passed

@timvandermeij timvandermeij merged commit 891f21f into mozilla:master Nov 7, 2021
@timvandermeij
Copy link
Contributor

This looks great; thank you for doing this!

@Snuffleupagus Snuffleupagus deleted the PDFPageViewBuffer-class branch November 7, 2021 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants