Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 2329323002: Avoid blocking while mapping an X11 window (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 66a424a3b2fa782de0337b0d6a267aecb136b1a5..128887af23a76e9dc6430e548365944a0c30d438 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -187,6 +187,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
x_root_window_(DefaultRootWindow(xdisplay_)),
atom_cache_(xdisplay_, kAtomsToCache),
window_mapped_(false),
+ wait_for_map_(false),
wait_for_unmap_(false),
is_fullscreen_(false),
is_always_on_top_(false),
@@ -584,7 +585,7 @@ void DesktopWindowTreeHostX11::ShowMaximizedWithBounds(
}
bool DesktopWindowTreeHostX11::IsVisible() const {
- return window_mapped_ && !wait_for_unmap_;
+ return wait_for_map_ || (window_mapped_ && !wait_for_unmap_);
}
void DesktopWindowTreeHostX11::SetSize(const gfx::Size& requested_size) {
@@ -1199,6 +1200,7 @@ void DesktopWindowTreeHostX11::HideImpl() {
if (IsVisible()) {
XWithdrawWindow(xdisplay_, xwindow_, 0);
wait_for_unmap_ = true;
+ wait_for_map_ = false;
}
native_widget_delegate_->OnNativeWidgetVisibilityChanged(false);
}
@@ -1216,9 +1218,12 @@ void DesktopWindowTreeHostX11::SetBounds(
XWindowChanges changes = {0};
unsigned value_mask = 0;
- delayed_resize_task_.Cancel();
if (size_changed) {
+ // Only cancel the delayed resize task if we're already about to call
+ // OnHostResized in this function.
+ delayed_resize_task_.Cancel();
+
// Update the minimum and maximum sizes in case they have changed.
UpdateMinAndMaxSize();
@@ -1905,11 +1910,7 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) {
}
XMapWindow(xdisplay_, xwindow_);
-
- // We now block until our window is mapped. Some X11 APIs will crash and
- // burn if passed |xwindow_| before the window is mapped, and XMapWindow is
- // asynchronous.
- event_source->BlockUntilWindowMapped(xwindow_);
+ wait_for_map_ = true;
}
void DesktopWindowTreeHostX11::SetWindowTransparency() {
@@ -2132,6 +2133,7 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
break;
}
case MapNotify: {
+ wait_for_map_ = false;
window_mapped_ = true;
FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11,

Powered by Google App Engine
This is Rietveld 408576698