summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/message_loop/message_loop.cc4
-rw-r--r--base/message_loop/message_loop.h20
-rw-r--r--base/message_loop/message_pump_x11.cc8
-rw-r--r--base/message_loop/message_pump_x11.h4
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc3
-rw-r--r--content/gpu/gpu_main.cc2
6 files changed, 36 insertions, 5 deletions
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index cdd8721..87a0b63 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -184,6 +184,10 @@ MessageLoop::MessageLoop(Type type)
pump_.reset(MESSAGE_PUMP_UI);
} else if (type_ == TYPE_IO) {
pump_.reset(MESSAGE_PUMP_IO);
+#if defined(TOOLKIT_GTK)
+ } else if (type_ == TYPE_GPU) {
+ pump_.reset(new MessagePumpX11());
+#endif
#if defined(OS_ANDROID)
} else if (type_ == TYPE_JAVA) {
pump_.reset(MESSAGE_PUMP_UI);
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index bdad1b2..3520b72 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -42,6 +42,9 @@
#else
#define USE_GTK_MESSAGE_PUMP
#include "base/message_loop/message_pump_gtk.h"
+#if defined(TOOLKIT_GTK)
+#include "base/message_loop/message_pump_x11.h"
+#endif
#endif
#endif
@@ -110,6 +113,11 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// This type of ML also supports native UI events (e.g., Windows messages).
// See also MessageLoopForUI.
//
+ // TYPE_GPU
+ // This type of ML also supports native UI events for use in the GPU
+ // process. On Linux this will always be an X11 ML (as compared with the
+ // sometimes-GTK ML in the browser process).
+ //
// TYPE_IO
// This type of ML also supports asynchronous IO. See also
// MessageLoopForIO.
@@ -123,6 +131,9 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
enum Type {
TYPE_DEFAULT,
TYPE_UI,
+#if defined(TOOLKIT_GTK)
+ TYPE_GPU,
+#endif
TYPE_IO,
#if defined(OS_ANDROID)
TYPE_JAVA,
@@ -416,6 +427,13 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
MessagePumpLibevent* pump_libevent() {
return static_cast<MessagePumpLibevent*>(pump_.get());
}
+#if defined(TOOLKIT_GTK)
+ friend class MessagePumpX11;
+ MessagePumpX11* pump_gpu() {
+ DCHECK_EQ(TYPE_GPU, type());
+ return static_cast<MessagePumpX11*>(pump_.get());
+ }
+#endif
#endif
scoped_ptr<MessagePump> pump_;
@@ -599,7 +617,7 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop {
#endif
protected:
-#if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL)
+#if defined(USE_X11)
friend class MessagePumpX11;
#endif
#if defined(USE_OZONE) && !defined(OS_NACL)
diff --git a/base/message_loop/message_pump_x11.cc b/base/message_loop/message_pump_x11.cc
index 7e780b2..dd8b965e 100644
--- a/base/message_loop/message_pump_x11.cc
+++ b/base/message_loop/message_pump_x11.cc
@@ -158,7 +158,13 @@ bool MessagePumpX11::HasXInput2() {
return InitializeXInput2();
}
-#if !defined(TOOLKIT_GTK)
+#if defined(TOOLKIT_GTK)
+// static
+MessagePumpX11* MessagePumpX11::Current() {
+ MessageLoop* loop = MessageLoop::current();
+ return static_cast<MessagePumpX11*>(loop->pump_gpu());
+}
+#else
// static
MessagePumpX11* MessagePumpX11::Current() {
MessageLoopForUI* loop = MessageLoopForUI::current();
diff --git a/base/message_loop/message_pump_x11.h b/base/message_loop/message_pump_x11.h
index 6f2c609..f1f678a 100644
--- a/base/message_loop/message_pump_x11.h
+++ b/base/message_loop/message_pump_x11.h
@@ -43,10 +43,8 @@ class BASE_EXPORT MessagePumpX11 : public MessagePumpGlib,
// Returns true if the system supports XINPUT2.
static bool HasXInput2();
-#if !defined(TOOLKIT_GTK)
- // Returns the UI message pump.
+ // Returns the UI or GPU message pump.
static MessagePumpX11* Current();
-#endif
// Adds/Removes |dispatcher| for the |xid|. This will route all messages from
// the window |xid| to |dispatcher.
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 58791d1..75b24ac 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -286,6 +286,9 @@ class TestMessageLoop : public base::MessageLoop {
virtual ~TestMessageLoop() {}
virtual bool IsType(base::MessageLoop::Type type) const OVERRIDE {
switch (type) {
+#if defined(TOOLKIT_GTK)
+ case base::MessageLoop::TYPE_GPU:
+#endif
case base::MessageLoop::TYPE_UI:
return BrowserThread::CurrentlyOn(BrowserThread::UI);
case base::MessageLoop::TYPE_IO:
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index da063d8..9e29e03 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -146,6 +146,8 @@ int GpuMain(const MainFunctionParams& parameters) {
gfx::kGLImplementationDesktopName) {
message_loop_type = base::MessageLoop::TYPE_UI;
}
+#elif defined(TOOLKIT_GTK)
+ message_loop_type = base::MessageLoop::TYPE_GPU;
#elif defined(OS_LINUX)
message_loop_type = base::MessageLoop::TYPE_DEFAULT;
#endif