Commit b6ae771e authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Slight speedup for win occlusion calculation.

Use .find to determine if hwnd is a root window in
root_window_hwnds_occlusion_state_ instead of iterating
through it.

Bug: 1029842
Change-Id: I6e2fb476635e0479355983a07149ec7d85149f5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1949026
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Reviewed-by: default avatarChris Hamilton <chrisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721145}
parent 2601e86d
...@@ -528,20 +528,14 @@ bool NativeWindowOcclusionTrackerWin::WindowOcclusionCalculator:: ...@@ -528,20 +528,14 @@ bool NativeWindowOcclusionTrackerWin::WindowOcclusionCalculator::
// computed for all |root_window_hwnds_occlusion_state_|, and if so, skipping // computed for all |root_window_hwnds_occlusion_state_|, and if so, skipping
// further oclcusion calculations. However, we still want to keep computing // further oclcusion calculations. However, we still want to keep computing
// |current_pids_with_visible_windows_|, so this function always returns true. // |current_pids_with_visible_windows_|, so this function always returns true.
for (auto& root_window_pair : root_window_hwnds_occlusion_state_) { auto it = root_window_hwnds_occlusion_state_.find(hwnd);
if (hwnd == root_window_pair.first) { if (it != root_window_hwnds_occlusion_state_.end() &&
if (root_window_pair.second.occlusion_state == it->second.occlusion_state != Window::OcclusionState::HIDDEN) {
Window::OcclusionState::HIDDEN) { it->second.occlusion_state = it->second.unoccluded_region.isEmpty()
break; ? Window::OcclusionState::OCCLUDED
} : Window::OcclusionState::VISIBLE;
root_window_pair.second.occlusion_state =
root_window_pair.second.unoccluded_region.isEmpty()
? Window::OcclusionState::OCCLUDED
: Window::OcclusionState::VISIBLE;
break;
}
} }
if (!WindowCanOccludeOtherWindowsOnCurrentVirtualDesktop(hwnd, &window_rect)) if (!WindowCanOccludeOtherWindowsOnCurrentVirtualDesktop(hwnd, &window_rect))
return true; return true;
// We are interested in this window, but are not currently hooking it with // We are interested in this window, but are not currently hooking it with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment