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

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: UpdateMinAndMaxSize in MapWindow Created 4 years, 2 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..93c68748fee0c3aa37145354eac5beda59d16e4b 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,7 +187,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
x_root_window_(DefaultRootWindow(xdisplay_)),
atom_cache_(xdisplay_, kAtomsToCache),
window_mapped_(false),
- wait_for_unmap_(false),
+ is_visible_(false),
is_fullscreen_(false),
is_always_on_top_(false),
use_native_frame_(false),
@@ -584,7 +584,7 @@ void DesktopWindowTreeHostX11::ShowMaximizedWithBounds(
}
bool DesktopWindowTreeHostX11::IsVisible() const {
- return window_mapped_ && !wait_for_unmap_;
+ return is_visible_;
}
void DesktopWindowTreeHostX11::SetSize(const gfx::Size& requested_size) {
@@ -1198,7 +1198,7 @@ void DesktopWindowTreeHostX11::ShowImpl() {
void DesktopWindowTreeHostX11::HideImpl() {
if (IsVisible()) {
XWithdrawWindow(xdisplay_, xwindow_, 0);
- wait_for_unmap_ = true;
+ is_visible_ = false;
}
native_widget_delegate_->OnNativeWidgetVisibilityChanged(false);
}
@@ -1216,9 +1216,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();
@@ -1897,19 +1900,10 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) {
ui::X11EventSource* event_source = ui::X11EventSource::GetInstance();
DCHECK(event_source);
- if (wait_for_unmap_) {
- // Block until our window is unmapped. This avoids a race condition when
- // remapping an unmapped window.
- event_source->BlockUntilWindowUnmapped(xwindow_);
- DCHECK(!wait_for_unmap_);
- }
+ UpdateMinAndMaxSize();
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_);
+ is_visible_ = true;
}
void DesktopWindowTreeHostX11::SetWindowTransparency() {
@@ -2138,8 +2132,6 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
observer_list_,
OnWindowMapped(xwindow_));
- UpdateMinAndMaxSize();
-
// Some WMs only respect maximize hints after the window has been mapped.
// Check whether we need to re-do a maximization.
if (should_maximize_after_map_) {
@@ -2151,7 +2143,6 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
case UnmapNotify: {
window_mapped_ = false;
- wait_for_unmap_ = false;
has_pointer_ = false;
has_pointer_grab_ = false;
has_pointer_focus_ = false;
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698