summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 17:56:06 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 17:56:06 +0000
commit4c3cd741778f0df792d6b8f4acbacd6675784aa8 (patch)
tree70211d12b189d67e9345244397262f3cefd21a6c /webkit/tools
parent47e3a17c0dd7898eda6622d0bafe189b75db3c83 (diff)
downloadchromium_src-4c3cd741778f0df792d6b8f4acbacd6675784aa8.zip
chromium_src-4c3cd741778f0df792d6b8f4acbacd6675784aa8.tar.gz
chromium_src-4c3cd741778f0df792d6b8f4acbacd6675784aa8.tar.bz2
Linux: move X operations from the IO to UI2 thread.
(r14075 take two) 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. http://codereview.chromium.org/67145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/test_shell.gyp4
-rw-r--r--webkit/tools/test_shell/test_shell_x11.cc19
-rw-r--r--webkit/tools/test_shell/test_shell_x11.h18
-rw-r--r--webkit/tools/test_shell/webwidget_host_gtk.cc7
4 files changed, 45 insertions, 3 deletions
diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp
index 3c0f3e7..393aa92 100644
--- a/webkit/tools/test_shell/test_shell.gyp
+++ b/webkit/tools/test_shell/test_shell.gyp
@@ -72,6 +72,7 @@
'test_shell.cc',
'test_shell.h',
'test_shell_gtk.cc',
+ 'test_shell_x11.cc',
'test_shell_mac.mm',
'test_shell_platform_delegate.h',
'test_shell_platform_delegate_gtk.cc',
@@ -116,7 +117,8 @@
'cflags': ['-Wno-multichar'],
}, { # else: OS!=linux
'sources/': [
- ['exclude', '_gtk\\.cc$']
+ ['exclude', '_gtk\\.cc$'],
+ ['exclude', '_x11\\.cc$'],
],
}],
['OS!="mac"', {
diff --git a/webkit/tools/test_shell/test_shell_x11.cc b/webkit/tools/test_shell/test_shell_x11.cc
new file mode 100644
index 0000000..865954b
--- /dev/null
+++ b/webkit/tools/test_shell/test_shell_x11.cc
@@ -0,0 +1,19 @@
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include "webkit/tools/test_shell/test_shell_x11.h"
+
+namespace test_shell_x11 {
+
+Display* GtkWidgetGetDisplay(GtkWidget* widget) {
+ GdkDisplay* gdk_display = gtk_widget_get_display(widget);
+ return gdk_x11_display_get_xdisplay(gdk_display);
+}
+
+int GtkWidgetGetScreenNum(GtkWidget* widget) {
+ GdkDisplay* gdk_display = gtk_widget_get_display(widget);
+ GdkScreen* gdk_screen = gdk_display_get_default_screen(gdk_display);
+ return gdk_x11_screen_get_screen_number(gdk_screen);
+}
+
+} // namespace test_shell_x11
diff --git a/webkit/tools/test_shell/test_shell_x11.h b/webkit/tools/test_shell/test_shell_x11.h
new file mode 100644
index 0000000..a17356d
--- /dev/null
+++ b/webkit/tools/test_shell/test_shell_x11.h
@@ -0,0 +1,18 @@
+#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_X11_H
+#define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_X11_H
+
+// This header is required because one cannot include both Xlib headers and
+// WebKit headers in the same source file.
+
+typedef struct _XDisplay Display;
+
+namespace test_shell_x11 {
+
+// Return an Xlib Display pointer for the given widget
+Display* GtkWidgetGetDisplay(GtkWidget* widget);
+// Return the screen number for the given widget
+int GtkWidgetGetScreenNum(GtkWidget* widget);
+
+} // namespace test_shell_x11
+
+#endif // !WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_X11_H
diff --git a/webkit/tools/test_shell/webwidget_host_gtk.cc b/webkit/tools/test_shell/webwidget_host_gtk.cc
index 5645da7..3bba172 100644
--- a/webkit/tools/test_shell/webwidget_host_gtk.cc
+++ b/webkit/tools/test_shell/webwidget_host_gtk.cc
@@ -13,12 +13,13 @@
#include "skia/ext/platform_canvas_linux.h"
#include "skia/ext/platform_device_linux.h"
#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h"
-#include "third_party/WebKit/WebKit/chromium/public/gtk/WebScreenInfoFactory.h"
+#include "third_party/WebKit/WebKit/chromium/public/x11/WebScreenInfoFactory.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "webkit/glue/webwidget.h"
#include "webkit/tools/test_shell/test_shell.h"
+#include "webkit/tools/test_shell/test_shell_x11.h"
using WebKit::WebInputEventFactory;
using WebKit::WebKeyboardEvent;
@@ -368,7 +369,9 @@ void WebWidgetHost::Paint() {
}
WebScreenInfo WebWidgetHost::GetScreenInfo() {
- return WebScreenInfoFactory::screenInfo(view_);
+ Display* display = test_shell_x11::GtkWidgetGetDisplay(view_);
+ int screen_num = test_shell_x11::GtkWidgetGetScreenNum(view_);
+ return WebScreenInfoFactory::screenInfo(display, screen_num);
}
void WebWidgetHost::ResetScrollRect() {