Implement SiteDataManager::cookies_for_url_async#43794
Conversation
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
6d1926e to
27da176
Compare
|
@mrobinson this PR is ready, can you help review? Thank you. |
|
This implementation works, and I can see the appeal of reusing the existing GetCookiesForUrl message. However, polling while spinning the event loop has a subtle performance issue—if there's nothing else happening that triggers an event loop spin, the response will sit unprocessed. In the case of servoshell, this would happen if the page isn't animating and the user doesn't trigger any inputs: servo/ports/servoshell/desktop/app.rs Lines 200 to 204 in 80e8441 Is this a big deal? Hard to say; I could imagine some embedding scenarios where pauses without user inputs could happen. However, there's another design possible which would avoid any polling:
|
I think it's worth to implement a more comprehensive solution. I have a draft at local. There are some points need to discuss:
|
The difference is that GenericEmbedderProxy contains an event loop waker, so any message sent on the channel also notifies the embedder to spin the event loop. |
If you can access an existing embedder proxy then you can use that. |
|
General question: How important is the asynchronous version? The other APIs in |
@mrobinson |
fa956dd to
2f033cf
Compare
2f033cf to
7558b9d
Compare
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Remove polling which depends on Servo spin loop. Instead, use an id when making a request to resource thread. Net thread will notify embedder with the id when request is done. Signed-off-by: batu_hoang <longvatrong111@gmail.com>
7558b9d to
7bbc97b
Compare
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
|
@mrobinson I've updated the solution to handle asynchronous callback and response data for all APIs, and implement |
jdm
left a comment
There was a problem hiding this comment.
Looks good! Thanks for making the changes.
Support applications to get cookies asynchronously from embedder.
Testing:
servo/components/servo/tests/site_data_manager.rs::test_get_cookie_async