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

Add external event notifications in transactions. #3020

Merged
merged 3 commits into from Sep 12, 2018

Conversation

Projects
None yet
3 participants
@nical
Collaborator

nical commented Sep 5, 2018

This allows gecko to attach a callback to the transaction and run it after the scene is built to notify the tab switcher that the work is done.

The first commit adds a drain_filter utility modeled after currently unstable Vec::drain_filter. The idea is to be able to get a vector of operations, and each stage of the pipeline can decide to move operations out of the the array and handle them or let them for the next stages to consume.
Hopefully we can use this to merge back the frame_ops, scene_ops and the other vectors in the Transaction struct.
This was previously inconvenient because of how some operations need to move elements out of the vector but while we need to keep the array alive at the same time, and drain_filter makes that less painful.

This PR is based on top of #2989


This change is Reviewable

@bors-servo

This comment has been minimized.

Show comment
Hide comment
@bors-servo

bors-servo Sep 5, 2018

Contributor

☔️ The latest upstream changes (presumably #2989) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors-servo commented Sep 5, 2018

☔️ The latest upstream changes (presumably #2989) made this pull request unmergeable. Please resolve the merge conflicts.

Show outdated Hide outdated webrender/src/resource_cache.rs
Show outdated Hide outdated webrender/src/util.rs
Show outdated Hide outdated webrender/src/util.rs
Show outdated Hide outdated webrender/src/util.rs
Show outdated Hide outdated webrender/src/util.rs
let mut i = 0;
while i != vec.len() {
if filter(&mut vec[i]) {
action(vec.remove(i));

This comment has been minimized.

@kvark

kvark Sep 5, 2018

Member

This is quadratic asymptotic complexity, or rather O(N*M) where M is the number of filter matches. Can we do better?

@kvark

kvark Sep 5, 2018

Member

This is quadratic asymptotic complexity, or rather O(N*M) where M is the number of filter matches. Can we do better?

This comment has been minimized.

@nical

nical Sep 5, 2018

Collaborator

We can but should we? We'll get the the optimized version for free when the std implementation stabilizes and I am certain this will not show up in profiles.
To be honest it also rubs me the wrong way and I'd probably have made more of an effort if we weren't getting the better implementation through std eventually.

@nical

nical Sep 5, 2018

Collaborator

We can but should we? We'll get the the optimized version for free when the std implementation stabilizes and I am certain this will not show up in profiles.
To be honest it also rubs me the wrong way and I'd probably have made more of an effort if we weren't getting the better implementation through std eventually.

This comment has been minimized.

@kvark

kvark Sep 6, 2018

Member

ok, that's fine by me, assuming there is a limited array size on the input

@kvark

kvark Sep 6, 2018

Member

ok, that's fine by me, assuming there is a limited array size on the input

This comment has been minimized.

@nical

nical Sep 6, 2018

Collaborator

Right now the size of resource updates vector is 0 the vast majority of times, 3 while playing a video. occasionally 1 when loading an image, etc.

@nical

nical Sep 6, 2018

Collaborator

Right now the size of resource updates vector is 0 the vast majority of times, 3 while playing a video. occasionally 1 when loading an image, etc.

Show outdated Hide outdated webrender_api/src/api.rs
Show outdated Hide outdated webrender_api/src/api.rs
Show outdated Hide outdated webrender/src/render_backend.rs
Show outdated Hide outdated webrender_api/src/api.rs
@bors-servo

This comment has been minimized.

Show comment
Hide comment
@bors-servo

bors-servo Sep 10, 2018

Contributor

☔️ The latest upstream changes (presumably #3036) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors-servo commented Sep 10, 2018

☔️ The latest upstream changes (presumably #3036) made this pull request unmergeable. Please resolve the merge conflicts.

@nical

This comment has been minimized.

Show comment
Hide comment
@nical

nical Sep 12, 2018

Collaborator

@kvark are we good to go?

Collaborator

nical commented Sep 12, 2018

@kvark are we good to go?

@kvark

This comment has been minimized.

Show comment
Hide comment
@kvark

kvark Sep 12, 2018

Member

@nical yes, if you are confident that a try push isn't needed here :)

Member

kvark commented Sep 12, 2018

@nical yes, if you are confident that a try push isn't needed here :)

@nical

This comment has been minimized.

Show comment
Hide comment
@nical

nical Sep 12, 2018

Collaborator

@bors-servo r=kvark

Collaborator

nical commented Sep 12, 2018

@bors-servo r=kvark

@bors-servo

This comment has been minimized.

Show comment
Hide comment
@bors-servo

bors-servo Sep 12, 2018

Contributor

📌 Commit 503be4a has been approved by kvark

Contributor

bors-servo commented Sep 12, 2018

📌 Commit 503be4a has been approved by kvark

@bors-servo

This comment has been minimized.

Show comment
Hide comment
@bors-servo

bors-servo Sep 12, 2018

Contributor

⌛️ Testing commit 503be4a with merge fb61f1b...

Contributor

bors-servo commented Sep 12, 2018

⌛️ Testing commit 503be4a with merge fb61f1b...

bors-servo added a commit that referenced this pull request Sep 12, 2018

Auto merge of #3020 - nical:txn-notif, r=kvark
Add external event notifications in transactions.

This allows gecko to attach a callback to the transaction and run it after the scene is built to notify the tab switcher that the work is done.

The first commit adds a drain_filter utility modeled after currently unstable Vec::drain_filter. The idea is to be able to get a vector of operations, and each stage of the pipeline can decide to move operations out of the the array and handle them or let them for the next stages to consume.
Hopefully we can use this to merge back the frame_ops, scene_ops and the other vectors in the `Transaction` struct.
This was previously inconvenient because of how some operations need to move elements out of the vector but while we need to keep the array alive at the same time, and drain_filter makes that less painful.

This PR is based on top of #2989

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3020)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Show comment
Hide comment
@bors-servo

bors-servo Sep 12, 2018

Contributor

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing fb61f1b to master...

Contributor

bors-servo commented Sep 12, 2018

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing fb61f1b to master...

@bors-servo bors-servo merged commit 503be4a into servo:master Sep 12, 2018

3 checks passed

Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment