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

Issue 2630773002: Avoid blocking while mapping an X11 window (Closed)

Created:
3 years, 11 months ago by Tom (Use chromium acct)
Modified:
3 years, 9 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, tdresser+watch_chromium.org, tfarina, extensions-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid blocking while mapping an X11 window For most window managers, calling XMapWindow causes a corresponding MapNotify event to fire, indicating it is ready for drawing. Since this usually happens immediately, but asynchronously, chromium previously blocked the UI thread until it got this event, to avoid calling any further X11 commands on the window until it was ready. Unfortunately, not all window managers immediately map the window after a MapRequest. For example, the i3 window manager will not map the created window while you're in fullscreen mode (i.e. youtube video). This means chromium blocks indefinitely until the user manually exits out of fullscreen mode. The fix here is to avoid blocking, since we cannot make the assumption that we'll get a MapNotify event quickly. By simply not blocking on window map, we create two issues. The first issue occurs when dragging tabs outside a window to create a new one. The newly created window would fail to size itself properly according to the space given to it by the window manager. This was because the delayed_resize_task_ would get cancelled by SetBounds during the time the thread would have otherwise been blocked. This issue was fixed by only cancelling the task when the bounds changed in that function, since that's the only time it will call OnHostResized itself. The second issue occurs during TooltipControllerTests, where a tooltip is shown/hidden, and then immediately calls IsVisible() on the widget (which eventually calls it on the underlying native window). Since the mapping is now async, IsVisible() was false until MapNotify was called. The fix for this was to keep track of an additional variable for when we are waiting for a MapNotify event, and using that to make IsVisible() true during this time (after calling MapWindow, and before getting MapNotify). BUG=505669, 670959 patch from issue 2329323002 at patchset 120001 (http://crrev.com/2329323002#ps120001) Review-Url: https://codereview.chromium.org/2630773002 Cr-Commit-Position: refs/heads/master@{#456098} Committed: https://chromium.googlesource.com/chromium/src/+/662c24fc6debb33ee34a927d21dc26154b8973d6

Patch Set 1 #

Patch Set 2 : Fix a few tests #

Patch Set 3 : Fix CrOS build #

Total comments: 2

Patch Set 4 : fix flaky tests #

Total comments: 10

Patch Set 5 : Address feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+69 lines, -52 lines) Patch
M chrome/browser/extensions/extension_commands_global_registry_apitest.cc View 1 2 3 4 3 chunks +33 lines, -11 lines 0 comments Download
M chrome/browser/ui/views/passwords/manage_passwords_bubble_view_interactive_uitest.cc View 1 2 3 3 chunks +9 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc View 1 2 3 3 chunks +8 lines, -0 lines 0 comments Download
M ui/events/platform/x11/x11_event_source.h View 1 chunk +0 lines, -2 lines 0 comments Download
M ui/events/platform/x11/x11_event_source.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h View 1 2 3 4 1 chunk +4 lines, -6 lines 0 comments Download
M ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc View 1 2 3 4 9 chunks +15 lines, -27 lines 0 comments Download

Messages

Total messages: 94 (57 generated)
Tom (Use chromium acct)
sadrul@ PTAL This was coped from http://crrev.com/2329323002#ps120001 A few tests have become flaky: ManagePasswordsBubbleViewTest.AutoSigninNoFocus SSLClientCertificateSelectorMultiProfileTest.Escape ...
3 years, 11 months ago (2017-01-26 23:37:39 UTC) #16
sadrul
On 2017/01/26 23:37:39, Tom Anderson wrote: > sadrul@ PTAL > This was coped from http://crrev.com/2329323002#ps120001 ...
3 years, 10 months ago (2017-01-27 21:40:51 UTC) #19
sadrul
https://codereview.chromium.org/2630773002/diff/40001/chrome/browser/extensions/extension_commands_global_registry_apitest.cc File chrome/browser/extensions/extension_commands_global_registry_apitest.cc (right): https://codereview.chromium.org/2630773002/diff/40001/chrome/browser/extensions/extension_commands_global_registry_apitest.cc#newcode120 chrome/browser/extensions/extension_commands_global_registry_apitest.cc:120: #if defined(OS_LINUX) && defined(USE_X11) You can use just 'defined(USE_X11)'
3 years, 10 months ago (2017-01-27 21:41:01 UTC) #20
Tom (Use chromium acct)
On 2017/01/27 21:40:51, sadrul wrote: > On 2017/01/26 23:37:39, Tom Anderson wrote: > > sadrul@ ...
3 years, 10 months ago (2017-02-03 19:55:31 UTC) #21
sadrul
cool! lgtm https://codereview.chromium.org/2630773002/diff/60001/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc File ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc (right): https://codereview.chromium.org/2630773002/diff/60001/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc#newcode2175 ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:2175: has_window_focus_ = false; Should this update is_visible_ ...
3 years, 10 months ago (2017-02-04 02:27:51 UTC) #34
Tom (Use chromium acct)
https://codereview.chromium.org/2630773002/diff/60001/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc File ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc (right): https://codereview.chromium.org/2630773002/diff/60001/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc#newcode2175 ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc:2175: has_window_focus_ = false; On 2017/02/04 02:27:51, sadrul wrote: > ...
3 years, 10 months ago (2017-02-04 17:58:54 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2630773002/60001
3 years, 10 months ago (2017-02-04 17:59:11 UTC) #37
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
3 years, 10 months ago (2017-02-04 19:59:48 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2630773002/60001
3 years, 10 months ago (2017-02-05 02:59:21 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/356970)
3 years, 10 months ago (2017-02-05 03:06:00 UTC) #43
Tom (Use chromium acct)
+sky for OWNERS approval for: chrome/browser/extensions/extension_commands_global_registry_apitest.cc chrome/browser/ui/views/passwords/manage_passwords_bubble_view_interactive_uitest.cc chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
3 years, 10 months ago (2017-02-06 18:56:14 UTC) #45
sky
I suspect your change is going to introduce all sorts of racyness... https://codereview.chromium.org/2630773002/diff/60001/chrome/browser/extensions/extension_commands_global_registry_apitest.cc File chrome/browser/extensions/extension_commands_global_registry_apitest.cc ...
3 years, 10 months ago (2017-02-06 22:25:29 UTC) #46
Tom (Use chromium acct)
https://codereview.chromium.org/2630773002/diff/60001/chrome/browser/extensions/extension_commands_global_registry_apitest.cc File chrome/browser/extensions/extension_commands_global_registry_apitest.cc (right): https://codereview.chromium.org/2630773002/diff/60001/chrome/browser/extensions/extension_commands_global_registry_apitest.cc#newcode182 chrome/browser/extensions/extension_commands_global_registry_apitest.cc:182: views::DesktopWindowTreeHostX11* host = On 2017/02/06 22:25:28, sky wrote: > ...
3 years, 10 months ago (2017-02-06 22:31:08 UTC) #47
sky
On 2017/02/06 22:31:08, Tom Anderson wrote: > https://codereview.chromium.org/2630773002/diff/60001/chrome/browser/extensions/extension_commands_global_registry_apitest.cc > File chrome/browser/extensions/extension_commands_global_registry_apitest.cc > (right): > > ...
3 years, 10 months ago (2017-02-06 23:59:12 UTC) #48
Tom (Use chromium acct)
sky@ I don't believe this CL introduces any flakiness, can we land it as-is? browser_tests ...
3 years, 9 months ago (2017-03-09 01:37:09 UTC) #57
sky
+more X experts (derat and erg) as I'm still nervous this is going to cause ...
3 years, 9 months ago (2017-03-09 04:01:46 UTC) #60
Daniel Erat
i share scott's concerns about this having the potential to introduce tricky bugs. i'm skeptical ...
3 years, 9 months ago (2017-03-09 15:07:22 UTC) #61
sky
It seems wrong that apps have to work around the quirks of window managers. At ...
3 years, 9 months ago (2017-03-09 17:29:52 UTC) #62
Tom (Use chromium acct)
+danakj On 2017/03/09 15:07:22, Daniel Erat wrote: > i share scott's concerns about this having ...
3 years, 9 months ago (2017-03-09 18:47:10 UTC) #64
Elliot Glaysher
On 2017/03/09 17:29:52, sky wrote: > It seems wrong that apps have to work around ...
3 years, 9 months ago (2017-03-09 19:04:57 UTC) #65
sky
I'm not an expert here. If Evan and Elliot are ok with this, I'm ok ...
3 years, 9 months ago (2017-03-09 20:10:46 UTC) #66
danakj
I am confused by this claim: > Unfortunately, not all window managers fire MapNotify in ...
3 years, 9 months ago (2017-03-09 20:45:34 UTC) #67
Daniel Erat
On 2017/03/09 18:47:10, Tom Anderson wrote: > +danakj > > On 2017/03/09 15:07:22, Daniel Erat ...
3 years, 9 months ago (2017-03-09 21:13:43 UTC) #68
danakj
On Thu, Mar 9, 2017 at 4:13 PM, <derat@chromium.org> wrote: > On 2017/03/09 18:47:10, Tom ...
3 years, 9 months ago (2017-03-09 21:23:45 UTC) #69
Daniel Erat
On 2017/03/09 21:23:45, danakj wrote: > On Thu, Mar 9, 2017 at 4:13 PM, <mailto:derat@chromium.org> ...
3 years, 9 months ago (2017-03-09 21:34:28 UTC) #70
Tom (Use chromium acct)
On 2017/03/09 20:45:34, danakj wrote: > I am confused by this claim: > > > ...
3 years, 9 months ago (2017-03-10 01:29:58 UTC) #72
Daniel Erat
On 2017/03/10 01:29:58, Tom Anderson wrote: > On 2017/03/09 20:45:34, danakj wrote: > > I ...
3 years, 9 months ago (2017-03-10 15:59:46 UTC) #78
Daniel Erat
lgtm
3 years, 9 months ago (2017-03-10 15:59:59 UTC) #79
danakj
LGTM
3 years, 9 months ago (2017-03-10 16:12:04 UTC) #80
sky
Rubber stamp LGTM
3 years, 9 months ago (2017-03-10 16:25:23 UTC) #81
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2630773002/80001
3 years, 9 months ago (2017-03-10 17:48:02 UTC) #84
commit-bot: I haz the power
Committed patchset #5 (id:80001) as https://chromium.googlesource.com/chromium/src/+/662c24fc6debb33ee34a927d21dc26154b8973d6
3 years, 9 months ago (2017-03-10 17:54:49 UTC) #87
Nico
This made the msan bot pretty unhappy: https://build.chromium.org/p/chromium.memory.full/builders/Linux%20MSan%20Tests/builds/6277 Example: https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.memory.full%2FLinux_MSan_Tests%2F6277%2F%2B%2Frecipes%2Fsteps%2Fcomponents_unittests%2F0%2Flogs%2FConstrainedWindowViewsTest.NullModalParent%2F0 [18754:18754:0310/105850.976775:16618164712:ERROR:desktop_window_tree_host_x11.cc(1147)] Not implemented reached in ...
3 years, 9 months ago (2017-03-10 23:41:43 UTC) #89
Tom (Use chromium acct)
On 2017/03/10 23:41:43, Nico wrote: > This made the msan bot pretty unhappy: > > ...
3 years, 9 months ago (2017-03-10 23:57:08 UTC) #90
Tom (Use chromium acct)
On 2017/03/10 23:57:08, Tom Anderson wrote: > On 2017/03/10 23:41:43, Nico wrote: > > This ...
3 years, 9 months ago (2017-03-11 00:18:36 UTC) #91
Nico
Makes sense. On Mar 10, 2017 7:18 PM, <thomasanderson@google.com> wrote: > On 2017/03/10 23:57:08, Tom ...
3 years, 9 months ago (2017-03-11 01:05:33 UTC) #92
faisalsalipada7
3 years, 9 months ago (2017-03-18 04:58:08 UTC) #94
Message was sent while issue was closed.
faisalsalipada7@gmail.com

Powered by Google App Engine
This is Rietveld 408576698