![canary mail slow canary mail slow](https://beebom.com/wp-content/uploads/2020/10/Canary-Mail.jpg)
Some of the events we listen for are windows getting activated or deactivated, windows moving or resizing, the user locking or unlocking the screen, turning off the monitor, etc. Because we may get several events in a very short time, we don’t calculate occlusion more than once every 16 milliseconds, which corresponds to the time a single frame is displayed, assuming a frame rate of 60 frames per second (fps).
![canary mail slow canary mail slow](https://9to5mac.com/wp-content/uploads/sites/6/2019/03/Edison-Mail.png)
The occlusion-calculation thread tells Windows that it wants to track those events, and when notified of an event, it examines the event to decide whether to do a new occlusion calculation. Fortunately, Windows lets you track various system events, like windows moving or getting resized/maximized/minimized. This is all done without synchronization locks, so the occlusion calculation has minimal effect on the UI thread, e.g., it will not ever block the UI thread and degrade the user experience.įor more detailed implementation information, see the documentation.ĭeciding When to Calculate OcclusionWe don’t want to continuously calculate occlusion because it would degrade the performance of Chrome, so we need to know when a window might become visible or occluded.
#Canary mail slow update
Whew! Now we post a task to the UI thread to update the visibility of the Chrome windows. At this point, any Chrome window that we haven’t marked occluded is visible, and we’re done computing occlusion.Keep iterating until all Chrome windows are captured.If it didn’t, that means the Chrome window is completely covered by previous windows, so it is occluded. If the window is a Chrome window, check if its area overlapped with the unoccluded area.Subtract the window's area from the unoccluded screen rectangle.Ignoring these kinds of windows may cause some occluded windows to be considered visible (false negatives) but importantly it won’t lead to treating visible windows as occluded (false positives). Iterate over the open windows on the desktop from front to back, ignoring invisible windows, transparent windows, floating windows (windows with style WS_EX_TOOLBAR), cloaked windows, windows on other virtual desktops, non-rectangular windows, etc.
![canary mail slow canary mail slow](https://static01.nyt.com/images/2020/11/02/us/politics/02dc-postal/02dc-postal-articleLarge-v2.jpg)