glib and x aren't thread-safe. To work around this our intention is to
only call into them from the UI thread. Unfortunately we currently
don't follow through on this.

To query the clipboard the renderer sends a sync IPC call to the
browser. The browser handles this call on the IO thread (in
resource_message_filter.cc), where it calls into base::Clipboard. On
linux this makes copious use of GTK+ functions (which in turn wrap
calls to X). Oops! We'd like to be able to proxy off the calls to the
UI thread, but I hear handling a sync IPC message on the UI thread is
a nono. A couple options have been suggested, although neither is
really all that appealing:

a) wrap the clipboard calls in gtk_threads_{enter,leave}(). This makes
the calls thread safe, but it does so by locking a process-wide mutex,
which will block our UI thread's main loop.

b) Create a second UI thread with its own X connection. Adam suggested
this one so he's better able than I to explain the implications.

Anyone with thoughts, advice, insight?

p.s. So yes, webview copy-pasta is currently very dicey. You can
always use the selection clipboard though, as long as you only care
about text.

-- Evan Stade

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to