Commit f93b585a authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Remove ui::X11EventSource::BlockUntilWindowMapped

This CL removes BlockUntilWindowMapped() and the 2 references to it.

The first reference, in X11WholeScreenMoveLoop, waits until an offscreen window
is mapped.  The window is override-redirect (so there's not WM that
asynchronously decides when to map the window), so any operations done on the
window should succeed after the window is mapped since the X server processes
events in sequence.

The second reference is from X11WindowBase.  A similar removal was done in
DesktopWindowTreeHostX11 in [1], so BlockUntilWindowMapped() shouldn't be needed
here either.

[1] https://chromium.googlesource.com/chromium/src/+/662c24fc6debb33ee34a927d21dc26154b8973d6

R=sadrul@chromium.org

Change-Id: I251e67839dd5216f5164a103a82ad8a906811a03
Bug: None
Reviewed-on: https://chromium-review.googlesource.com/823212
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525869}
parent 0c5139d0
...@@ -143,10 +143,6 @@ void X11EventSource::DispatchXEventNow(XEvent* event) { ...@@ -143,10 +143,6 @@ void X11EventSource::DispatchXEventNow(XEvent* event) {
ExtractCookieDataDispatchEvent(event); ExtractCookieDataDispatchEvent(event);
} }
void X11EventSource::BlockUntilWindowMapped(XID window) {
BlockOnWindowStructureEvent(window, MapNotify);
}
Time X11EventSource::GetCurrentServerTime() { Time X11EventSource::GetCurrentServerTime() {
DCHECK(display_); DCHECK(display_);
...@@ -276,16 +272,6 @@ void X11EventSource::PostDispatchEvent(XEvent* xevent) { ...@@ -276,16 +272,6 @@ void X11EventSource::PostDispatchEvent(XEvent* xevent) {
} }
} }
void X11EventSource::BlockOnWindowStructureEvent(XID window, int type) {
XEvent event;
do {
// Block until there's a StructureNotify event of |type| on |window|. Then
// remove it from the queue and stuff it in |event|.
XWindowEvent(display_, window, StructureNotifyMask, &event);
ExtractCookieDataDispatchEvent(&event);
} while (event.type != type);
}
void X11EventSource::StopCurrentEventStream() { void X11EventSource::StopCurrentEventStream() {
continue_stream_ = false; continue_stream_ = false;
} }
......
...@@ -62,17 +62,6 @@ class EVENTS_EXPORT X11EventSource { ...@@ -62,17 +62,6 @@ class EVENTS_EXPORT X11EventSource {
// main X11 event loop. // main X11 event loop.
void DispatchXEventNow(XEvent* event); void DispatchXEventNow(XEvent* event);
// Blocks on the X11 event queue until we receive notification from the
// xserver that |w| has been mapped; StructureNotifyMask events on |w| are
// pulled out from the queue and dispatched out of order.
//
// For those that know X11, this is really a wrapper around XWindowEvent
// which still makes sure the preempted event is dispatched instead of
// dropped on the floor. This method exists because mapping a window is
// asynchronous (and we receive an XEvent when mapped), while there are also
// functions which require a mapped window.
void BlockUntilWindowMapped(XID window);
XDisplay* display() { return display_; } XDisplay* display() { return display_; }
// Returns the timestamp of the event currently being dispatched. Falls back // Returns the timestamp of the event currently being dispatched. Falls back
...@@ -96,10 +85,6 @@ class EVENTS_EXPORT X11EventSource { ...@@ -96,10 +85,6 @@ class EVENTS_EXPORT X11EventSource {
// Handles updates after event has been dispatched. // Handles updates after event has been dispatched.
void PostDispatchEvent(XEvent* xevent); void PostDispatchEvent(XEvent* xevent);
// Block until receiving a structure notify event of |type| on |window|.
// Dispatch all encountered events prior to the one we're blocking on.
void BlockOnWindowStructureEvent(XID window, int type);
// Explicitly asks the X11 server for the current timestamp, and updates // Explicitly asks the X11 server for the current timestamp, and updates
// |last_seen_server_time_| with this value. // |last_seen_server_time_| with this value.
Time GetCurrentServerTime(); Time GetCurrentServerTime();
......
...@@ -144,18 +144,13 @@ void X11WindowBase::Show() { ...@@ -144,18 +144,13 @@ void X11WindowBase::Show() {
return; return;
XMapWindow(xdisplay_, xwindow_); 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.
if (X11EventSource::GetInstance())
X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_);
window_mapped_ = true; window_mapped_ = true;
} }
void X11WindowBase::Hide() { void X11WindowBase::Hide() {
if (!window_mapped_) if (!window_mapped_)
return; return;
XWithdrawWindow(xdisplay_, xwindow_, 0); XWithdrawWindow(xdisplay_, xwindow_, 0);
window_mapped_ = false; window_mapped_ = false;
} }
......
...@@ -275,7 +275,6 @@ void X11WholeScreenMoveLoop::CreateDragInputWindow(XDisplay* display) { ...@@ -275,7 +275,6 @@ void X11WholeScreenMoveLoop::CreateDragInputWindow(XDisplay* display) {
new ui::XScopedEventSelector(grab_input_window_, event_mask)); new ui::XScopedEventSelector(grab_input_window_, event_mask));
XMapRaised(display, grab_input_window_); XMapRaised(display, grab_input_window_);
ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(grab_input_window_);
} }
} // namespace views } // namespace views
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