summaryrefslogtreecommitdiffstats
path: root/src/core/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/api')
-rw-r--r--src/core/api/core_api.pro2
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp94
-rw-r--r--src/core/api/qtwebenginecoreglobal.h4
-rw-r--r--src/core/api/qwebenginecallback.h2
-rw-r--r--src/core/api/qwebenginecallback_p.h11
-rw-r--r--src/core/api/qwebenginecookiestore.cpp14
-rw-r--r--src/core/api/qwebenginecookiestore.h5
-rw-r--r--src/core/api/qwebenginecookiestore_p.h10
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp3
-rw-r--r--src/core/api/qwebengineurlrequestinfo.h2
-rw-r--r--src/core/api/qwebengineurlrequestinfo_p.h11
-rw-r--r--src/core/api/qwebengineurlrequestinterceptor.h4
-rw-r--r--src/core/api/qwebengineurlrequestjob.h2
-rw-r--r--src/core/api/qwebengineurlschemehandler.h2
14 files changed, 149 insertions, 17 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index d11994e98..19b67876c 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -5,6 +5,7 @@ TEMPLATE = lib
CONFIG += staticlib c++11
QT += network core-private
+QT_PRIVATE += webenginecoreheaders-private
# Don't create .prl file for this intermediate library because
# their contents get used when linking against them, breaking
@@ -42,6 +43,7 @@ HEADERS = \
qwebengineurlschemehandler.h
SOURCES = \
+ qtwebenginecoreglobal.cpp \
qwebenginecookiestore.cpp \
qwebengineurlrequestinfo.cpp \
qwebengineurlrequestjob.cpp \
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
new file mode 100644
index 000000000..0e857d7d9
--- /dev/null
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtwebenginecoreglobal_p.h"
+
+#include <QGuiApplication>
+#include <QOpenGLContext>
+#include <QThread>
+
+QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
+QT_END_NAMESPACE
+
+namespace QtWebEngineCore {
+
+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.
+
+QWEBENGINE_PRIVATE_EXPORT 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);
+}
+} // namespace QtWebEngineCore
diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h
index 16daaab7d..a17b355eb 100644
--- a/src/core/api/qtwebenginecoreglobal.h
+++ b/src/core/api/qtwebenginecoreglobal.h
@@ -39,6 +39,8 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_NAMESPACE
+
#if defined(BUILDING_CHROMIUM)
# define QWEBENGINE_EXPORT Q_DECL_EXPORT
#else
@@ -47,4 +49,6 @@
#define ASSERT_ENUMS_MATCH(A, B) Q_STATIC_ASSERT_X(static_cast<int>(A) == static_cast<int>(B), "The enum values must match");
+QT_END_NAMESPACE
+
#endif // QTWEBENGINECOREGLOBAL_H
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h
index b675438f5..a8758df7d 100644
--- a/src/core/api/qwebenginecallback.h
+++ b/src/core/api/qwebenginecallback.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINECALLBACK_H
#define QWEBENGINECALLBACK_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE
#include <QtCore/qshareddata.h>
diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h
index 9bc9b9727..348fed464 100644
--- a/src/core/api/qwebenginecallback_p.h
+++ b/src/core/api/qwebenginecallback_p.h
@@ -37,6 +37,17 @@
#ifndef QWEBENGINECALLBACK_P_H
#define QWEBENGINECALLBACK_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qtwebenginecoreglobal_p.h"
#include "qwebenginecallback.h"
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 51753e87b..2938eddbd 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -46,13 +46,12 @@ QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
-QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate(QWebEngineCookieStore* q)
+QWebEngineCookieStorePrivate::QWebEngineCookieStorePrivate()
: m_nextCallbackId(CallbackDirectory::ReservedCallbackIdsEnd)
, m_deleteSessionCookiesPending(false)
, m_deleteAllCookiesPending(false)
, m_getAllCookiesPending(false)
, delegate(0)
- , q_ptr(q)
{
}
@@ -89,6 +88,14 @@ void QWebEngineCookieStorePrivate::processPendingUserCookies()
m_pendingUserCookies.clear();
}
+void QWebEngineCookieStorePrivate::rejectPendingUserCookies()
+{
+ m_getAllCookiesPending = false;
+ m_deleteAllCookiesPending = false;
+ m_deleteSessionCookiesPending = false;
+ m_pendingUserCookies.clear();
+}
+
void QWebEngineCookieStorePrivate::setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin)
{
const quint64 currentCallbackId = callback ? m_nextCallbackId++ : static_cast<quint64>(CallbackDirectory::NoCallbackId);
@@ -246,8 +253,7 @@ bool QWebEngineCookieStorePrivate::canSetCookie(const QUrl &firstPartyUrl, const
*/
QWebEngineCookieStore::QWebEngineCookieStore(QObject *parent)
- : QObject(parent)
- , d_ptr(new QWebEngineCookieStorePrivate(this))
+ : QObject(*new QWebEngineCookieStorePrivate, parent)
{
}
diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h
index 6cbe399f2..b78f885ef 100644
--- a/src/core/api/qwebenginecookiestore.h
+++ b/src/core/api/qwebenginecookiestore.h
@@ -37,8 +37,8 @@
#ifndef QWEBENGINECOOKIESTORE_H
#define QWEBENGINECOOKIESTORE_H
-#include "qtwebenginecoreglobal.h"
-#include "qwebenginecallback.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebenginecallback.h>
#include <QtCore/qobject.h>
#include <QtCore/qscopedpointer.h>
@@ -94,7 +94,6 @@ private:
friend class QtWebEngineCore::CookieMonsterDelegateQt;
Q_DISABLE_COPY(QWebEngineCookieStore)
Q_DECLARE_PRIVATE(QWebEngineCookieStore)
- QScopedPointer<QWebEngineCookieStorePrivate> d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index d773c0d3e..348dcd69f 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -56,6 +56,7 @@
#include <QVector>
#include <QNetworkCookie>
#include <QUrl>
+#include <QtCore/private/qobject_p.h>
namespace QtWebEngineCore {
class CookieMonsterDelegateQt;
@@ -63,7 +64,9 @@ class CookieMonsterDelegateQt;
QT_BEGIN_NAMESPACE
-class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
+class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QWebEngineCookieStore)
struct CookieData {
quint64 callbackId;
QNetworkCookie cookie;
@@ -71,7 +74,6 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate {
};
friend class QTypeInfo<CookieData>;
public:
- Q_DECLARE_PUBLIC(QWebEngineCookieStore)
QtWebEngineCore::CallbackDirectory callbackDirectory;
QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> filterCallback;
QVector<CookieData> m_pendingUserCookies;
@@ -81,11 +83,11 @@ public:
bool m_getAllCookiesPending;
QtWebEngineCore::CookieMonsterDelegateQt *delegate;
- QWebEngineCookieStore *q_ptr;
- QWebEngineCookieStorePrivate(QWebEngineCookieStore *q);
+ QWebEngineCookieStorePrivate();
void processPendingUserCookies();
+ void rejectPendingUserCookies();
void setCookie(const QWebEngineCallback<bool> &callback, const QNetworkCookie &cookie, const QUrl &origin);
void deleteCookie(const QNetworkCookie &cookie, const QUrl &url);
void deleteSessionCookies();
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index 79801d190..db5627acb 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -236,6 +236,9 @@ QByteArray QWebEngineUrlRequestInfo::requestMethod() const
return d->method;
}
+/*!
+ \internal
+*/
bool QWebEngineUrlRequestInfo::changed() const
{
Q_D(const QWebEngineUrlRequestInfo);
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index 008df7751..9a13b3faf 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINEURLREQUESTINFO_H
#define QWEBENGINEURLREQUESTINFO_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qurl.h>
diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h
index df5f18d6e..c78a93613 100644
--- a/src/core/api/qwebengineurlrequestinfo_p.h
+++ b/src/core/api/qwebengineurlrequestinfo_p.h
@@ -37,6 +37,17 @@
#ifndef QWEBENGINEURLREQUESTINFO_P_H
#define QWEBENGINEURLREQUESTINFO_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qtwebenginecoreglobal_p.h"
#include "qwebengineurlrequestinfo.h"
diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h
index 372ee9066..a3b7cf979 100644
--- a/src/core/api/qwebengineurlrequestinterceptor.h
+++ b/src/core/api/qwebengineurlrequestinterceptor.h
@@ -37,8 +37,8 @@
#ifndef QWEBENINGEURLREQUESTINTERCEPTOR_H
#define QWEBENINGEURLREQUESTINTERCEPTOR_H
-#include "qtwebenginecoreglobal.h"
-#include "qwebengineurlrequestinfo.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtWebEngineCore/qwebengineurlrequestinfo.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qhash.h>
diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h
index fc9f4d911..922299fd9 100644
--- a/src/core/api/qwebengineurlrequestjob.h
+++ b/src/core/api/qwebengineurlrequestjob.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINEURLREQUESTJOB_H
#define QWEBENGINEURLREQUESTJOB_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qobject.h>
diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h
index fa24987c5..d9fc15250 100644
--- a/src/core/api/qwebengineurlschemehandler.h
+++ b/src/core/api/qwebengineurlschemehandler.h
@@ -37,7 +37,7 @@
#ifndef QWEBENGINEURLSCHEMEHANDLER_H
#define QWEBENGINEURLSCHEMEHANDLER_H
-#include "qtwebenginecoreglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
#include <QtCore/qobject.h>