forked from spentak/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rewire the desktop capturer API to remove race conditions (e…
…lectron#18029) We now create a new instance of atom::api::DesktopCapturer for every request instead of weirdly re-using the same instance and queuing requests. This means there is now a 1:1 relationship between request and DesktopCapturer so there isn't a race condition between the observer for one request calling back before the observer of another. This is an issue ever since the backing APIs moved to worker threads. This also does a few things to ensure memory management * Only ever listen to one event per-request, after that we wipe the emit function to ignore all future events * Ensures we clean up the window_capturer_, screen_capturer_ and captured_sources_ in native land once the request is over. This _in theory_ fixes a flake we've been seeing on CI where we try to resolve the promise for a request that no longerr exists.
- Loading branch information
1 parent
1183feb
commit 31af717
Showing
2 changed files
with
67 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters