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

Issue 67145: Linux: move X operations from the IO to UI2 thread. (Closed)

Created:
11 years, 8 months ago by agl
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Linux: move X operations from the IO to UI2 thread. Currently we perform several X operations on the IO thread including geometry and clipboard work. This is causing races inside Xlib and crashing the browser. These are the result of synchronous calls from the renderer, so we cannot route these requests to the UI thread without risking deadlock. Thus we introduce the UI2 thread. This thread has a second connection to the X server and can perform X operations safely the without UI thread. Work remains to be done: Since we still have the hack where we pass GtkWidget pointers into the renderer and back, we still have to access these structures from the IO and UI2 threads. This still needs to be fixed, but this is not the patch for it. Also, not all the X calls from the IO thread have been moved over in this patch; just a few small ones.

Patch Set 1 #

Patch Set 2 : ... #

Total comments: 8

Patch Set 3 : ... #

Total comments: 15

Patch Set 4 : ... #

Patch Set 5 : ... #

Patch Set 6 : ... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+357 lines, -99 lines) Patch
M chrome/browser/browser_process.h View 3 1 chunk +9 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_impl.h View 3 2 chunks +14 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_impl.cc View 3 2 chunks +15 lines, -0 lines 0 comments Download
M chrome/browser/chrome_thread.h View 3 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/browser/chrome_thread.cc View 3 2 chunks +8 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.h View 1 2 3 3 chunks +10 lines, -4 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.cc View 1 2 3 5 chunks +19 lines, -7 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter_gtk.cc View 1 2 3 1 chunk +93 lines, -29 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter_mac.mm View 1 2 3 2 chunks +19 lines, -15 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter_win.cc View 1 2 3 1 chunk +11 lines, -4 lines 0 comments Download
M chrome/common/x11_util.h View 1 2 3 1 chunk +61 lines, -34 lines 0 comments Download
M chrome/common/x11_util.cc View 1 2 3 4 chunks +30 lines, -0 lines 0 comments Download
M chrome/test/testing_browser_process.h View 1 chunk +6 lines, -0 lines 0 comments Download
M webkit/tools/test_shell/test_shell.gyp View 2 chunks +3 lines, -1 line 0 comments Download
A webkit/tools/test_shell/test_shell_x11.h View 1 chunk +18 lines, -0 lines 0 comments Download
A webkit/tools/test_shell/test_shell_x11.cc View 1 chunk +19 lines, -0 lines 0 comments Download
M webkit/tools/test_shell/webwidget_host_gtk.cc View 2 chunks +5 lines, -2 lines 0 comments Download
M webkit/webkit.gyp View 4 3 chunks +7 lines, -3 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
agl
There's also a WebKit side to this patch. If this CL looks to be on ...
11 years, 8 months ago (2009-04-14 22:46:30 UTC) #1
darin (slow to review)
> +extern Display* kSecondaryXConnection; This is not going to work. We want to be able ...
11 years, 8 months ago (2009-04-15 16:52:39 UTC) #2
darin (slow to review)
http://codereview.chromium.org/67145/diff/1001/16 File chrome/browser/renderer_host/resource_message_filter.cc (right): http://codereview.chromium.org/67145/diff/1001/16#newcode51 Line 51: #include "third_party/WebKit/WebKit/chromium/public/gtk/WebScreenInfoFactory.h" looks like this include can be ...
11 years, 8 months ago (2009-04-15 17:08:49 UTC) #3
agl
If this looks better I'll make the bugs.webkit.org entry. http://codereview.chromium.org/67145/diff/1001/16 File chrome/browser/renderer_host/resource_message_filter.cc (right): http://codereview.chromium.org/67145/diff/1001/16#newcode51 Line ...
11 years, 8 months ago (2009-04-15 19:15:31 UTC) #4
Dean McNamee
http://codereview.chromium.org/67145/diff/27/28 File chrome/browser/browser_process.h (right): http://codereview.chromium.org/67145/diff/27/28#newcode103 Line 103: // from the UI thread so, if you've ...
11 years, 8 months ago (2009-04-16 09:25:12 UTC) #5
Dean McNamee
Ok, so. I see what we're trying to achieve, and understand the issues. What I ...
11 years, 8 months ago (2009-04-16 09:32:55 UTC) #6
darin (slow to review)
http://codereview.chromium.org/67145/diff/27/32 File chrome/browser/chrome_thread.h (right): http://codereview.chromium.org/67145/diff/27/32#newcode48 Line 48: UI2, maybe a better name for this would ...
11 years, 8 months ago (2009-04-16 18:06:07 UTC) #7
agl
http://codereview.chromium.org/67145/diff/27/29 File chrome/browser/browser_process_impl.cc (right): http://codereview.chromium.org/67145/diff/27/29#newcode175 Line 175: // The UI2 thread must be outlived by ...
11 years, 8 months ago (2009-04-16 19:56:04 UTC) #8
Dean McNamee
11 years, 8 months ago (2009-04-17 08:34:35 UTC) #9
Did you not upload the new snapshot?

On 2009/04/16 19:56:04, agl wrote:
> http://codereview.chromium.org/67145/diff/27/29
> File chrome/browser/browser_process_impl.cc (right):
> 
> http://codereview.chromium.org/67145/diff/27/29#newcode175
> Line 175: // The UI2 thread must be outlived by the IO thread
> On 2009/04/16 09:32:55, Dean McNamee wrote:
> > I would have worded this the opposite way.
> > 
> > The IO thread must outlive the UI2 thread.
> > 
> > Also, you missed a full stop
> 
> Done.
> 
> http://codereview.chromium.org/67145/diff/27/30
> File chrome/browser/browser_process_impl.h (right):
> 
> http://codereview.chromium.org/67145/diff/27/30#newcode80
> Line 80: // IO thread also creates the UI2 thread.
> On 2009/04/16 09:32:55, Dean McNamee wrote:
> > I am probably just dumb, but the way some of this worded I find a bit
> confusing
> > and it seems like it could be more straight forward.
> 
> Have reworded it. I don't know if it's better :(
> 
> http://codereview.chromium.org/67145/diff/27/32
> File chrome/browser/chrome_thread.h (right):
> 
> http://codereview.chromium.org/67145/diff/27/32#newcode48
> Line 48: UI2,
> On 2009/04/16 18:06:08, darin wrote:
> > maybe a better name for this would be X2 or BACKGROUND_X11 (longer and more
> > descriptive is probably better since this thread is rather obscure)
> 
> Renamed to BACKGROUND_X11.
> 
> http://codereview.chromium.org/67145/diff/27/35
> File chrome/browser/renderer_host/resource_message_filter_gtk.cc (right):
> 
> http://codereview.chromium.org/67145/diff/27/35#newcode22
> Line 22: // Called on the IO thread
> On 2009/04/16 09:32:55, Dean McNamee wrote:
> > full stops
> 
> I don't generally care for full stops unless it's a long comment with several
> sentences. But I don't really care either way so I've added them here.
> 
> http://codereview.chromium.org/67145/diff/27/35#newcode71
> Line 71: gdk_window_get_toplevel(gfx::NativeViewFromId(view)->window);
> On 2009/04/16 09:32:55, Dean McNamee wrote:
> > Is it safe to call GDK on these threads?  Have we verified it doesn't have
any
> > global / singleton state that it might be touching?
> 
> No it's not. We have to solve the issues where we pass GtkWidget* into the
> renderer and trust them. However, that's a different patch.
> 
> (I've thrown in a fixme for now.)
> 
> http://codereview.chromium.org/67145/diff/27/38
> File chrome/common/x11_util.cc (right):
> 
> http://codereview.chromium.org/67145/diff/27/38#newcode234
> Line 234: // Called on UI2 thread
> On 2009/04/16 09:32:55, Dean McNamee wrote:
> > blah blah full stops
> 
> Done.
> 
> http://codereview.chromium.org/67145/diff/27/39
> File chrome/common/x11_util.h (right):
> 
> http://codereview.chromium.org/67145/diff/27/39#newcode29
> Line 29: extern Display* kSecondaryXConnection;
> On 2009/04/16 09:32:55, Dean McNamee wrote:
> > woah?
> 
> I uploaded too soon; it's just a leftover. Removed.

Powered by Google App Engine
This is Rietveld 408576698