summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorWebKit Team <webkit@WebKits-Mac-Pro.local>2014-08-28 17:48:49 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-09-01 17:04:29 +0200
commitfd5bba617a152b11bb8b6e5429ef185dee4684b2 (patch)
tree1fee080e07b9203ee90d1f80a8e325cefb92de49 /src/core/content_browser_client_qt.cpp
parent5b8e3ecf388d9f8921412822049ef90565553067 (diff)
Support using MessagePumpForUIQt in standalone base::Threads
We currently assume that MessagePumpForUIQt will only be used on Qt's GUI thread but OSX and Windows do have some cases where TYPE_UI is used for non-UI threads. This currently causes asserts in debug on OSX since the DNS thread quits prematurely. Instead of overriding all those edge cases to use TYPE_DEFAULT, properly support MessagePumpForUIQt::Run by using a QEventLoop. Change-Id: Icdb65966867ca6fd3679c75a698007f63848babc Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index f19199cc3..022c02ff5 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -99,18 +99,24 @@ public:
// Usually this gets passed through Run, but since we have
// our own event loop, attach it explicitly ourselves.
: m_delegate(base::MessageLoopForUI::current())
+ , m_explicitLoop(0)
{
}
virtual void Run(Delegate *delegate) Q_DECL_OVERRIDE
{
- // FIXME: This could be needed if we want to run Chromium tests.
- // We could run a QEventLoop here.
+ Q_ASSERT(delegate == m_delegate);
+ // This is used only when MessagePumpForUIQt is used outside of the GUI thread.
+ QEventLoop loop;
+ m_explicitLoop = &loop;
+ loop.exec();
+ m_explicitLoop = 0;
}
virtual void Quit() Q_DECL_OVERRIDE
{
- Q_UNREACHABLE();
+ Q_ASSERT(m_explicitLoop);
+ m_explicitLoop->quit();
}
virtual void ScheduleWork() Q_DECL_OVERRIDE
@@ -159,6 +165,7 @@ private:
}
Delegate *m_delegate;
+ QEventLoop *m_explicitLoop;
};
scoped_ptr<base::MessagePump> messagePumpFactory()