summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qtwebengineglobal.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-12-11 12:41:06 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-12-15 09:55:35 +0000
commit92261a7883809a2ef17a6ae12b472d3631f303d8 (patch)
tree5037f4e97fe8c7ecd72f8b02b8e5553fd3b3b1b8 /src/webengine/api/qtwebengineglobal.cpp
parentd239b60313f798cf75a4e34a768d9f4a1fc8f92a (diff)
Move WebEngine initialization to core library
This means QtWebEngineWidgets no longer needs to depend on and link to the QML API. Change-Id: If59693bf0ae1fb43dc86c141daf4e09c8cc68c25 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/webengine/api/qtwebengineglobal.cpp')
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp52
1 files changed, 5 insertions, 47 deletions
diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp
index 07561be6e..8efbc3799 100644
--- a/src/webengine/api/qtwebengineglobal.cpp
+++ b/src/webengine/api/qtwebengineglobal.cpp
@@ -36,15 +36,13 @@
#include "qtwebengineglobal.h"
-#include <QGuiApplication>
-#include <QOpenGLContext>
-#include <QThread>
+namespace QtWebEngineCore
+{
+ extern void initialize();
+}
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
-Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
-
namespace QtWebEngine {
/*!
@@ -58,19 +56,6 @@ namespace QtWebEngine {
The \l[CPP]{QtWebEngine} namespace is part of the Qt WebEngine module.
*/
-static QOpenGLContext *shareContext;
-
-static void deleteShareContext()
-{
- delete shareContext;
- shareContext = 0;
-}
-
-// ### Qt 6: unify this logic and Qt::AA_ShareOpenGLContexts.
-// QtWebEngine::initialize was introduced first and meant to be called
-// after the QGuiApplication creation, when AA_ShareOpenGLContexts fills
-// the same need but the flag has to be set earlier.
-
/*!
\fn QtWebEngine::initialize()
@@ -82,34 +67,7 @@ static void deleteShareContext()
*/
void initialize()
{
-#ifdef Q_OS_WIN32
- qputenv("QT_D3DCREATE_MULTITHREADED", "1");
-#endif
-
- // No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts).
- if (qt_gl_global_share_context())
- return;
-
- QCoreApplication *app = QCoreApplication::instance();
- if (!app) {
- qFatal("QtWebEngine::initialize() must be called after the construction of the application object.");
- return;
- }
- if (app->thread() != QThread::currentThread()) {
- qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
- return;
- }
-
- if (shareContext)
- return;
-
- shareContext = new QOpenGLContext;
- shareContext->create();
- qAddPostRoutine(deleteShareContext);
- qt_gl_set_global_share_context(shareContext);
-
- // Classes like QOpenGLWidget check for the attribute
- app->setAttribute(Qt::AA_ShareOpenGLContexts);
+ QtWebEngineCore::initialize();
}
} // namespace QtWebEngine