summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-08-09 17:44:50 +0200
committerZeno Albisser <zeno.albisser@digia.com>2013-08-12 12:27:13 +0200
commit91701ca3fe9867b831d8a0fac0431875e8b9da99 (patch)
treea3c9a61fc0ad322510f3eb99c927129da2f50177 /lib
parent8172ee73e82a7a1ce4b61415e44ba95cbe3eb5b1 (diff)
Once created, keep the WebEngineContext until shutdown.
Chromium isn't expecting the destruction and reconstruction of the ContentMainRunner and BrowserMainRunner. This will need a few tweaks before we can do this without hitting asserts in debug builds. Change-Id: I0c46a2db27350b3f6352e3eb8a5ec7ecff06784e Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/web_engine_context.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/web_engine_context.cpp b/lib/web_engine_context.cpp
index 67202a9c2..49f38c682 100644
--- a/lib/web_engine_context.cpp
+++ b/lib/web_engine_context.cpp
@@ -63,7 +63,7 @@
namespace {
-static WebEngineContext* sContext = 0;
+scoped_refptr<WebEngineContext> sContext;
static QByteArray subProcessPath() {
static bool initialized = false;
@@ -112,9 +112,6 @@ WebEngineContext::WebEngineContext()
, m_contentRunner(content::ContentMainRunner::Create())
, m_browserRunner(content::BrowserMainRunner::Create())
{
- Q_ASSERT(!sContext);
- sContext = this;
-
QList<QByteArray> args;
Q_FOREACH (const QString& arg, QCoreApplication::arguments())
args << arg.toUtf8();
@@ -140,19 +137,11 @@ WebEngineContext::WebEngineContext()
WebEngineContext::~WebEngineContext()
{
m_runLoop->AfterRun();
-
- Q_ASSERT(sContext == this);
- sContext = 0;
-
- m_browserRunner.reset();
- m_contentRunner.reset();
}
scoped_refptr<WebEngineContext> WebEngineContext::current()
{
- scoped_refptr<WebEngineContext> current = sContext;
- if (!current)
- current = new WebEngineContext;
- Q_ASSERT(sContext == current);
- return current;
+ if (!sContext)
+ sContext = new WebEngineContext;
+ return sContext;
}