diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-04 11:43:54 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-04 11:45:58 +0100 |
commit | 2b3f5b66af4f06a57216575a44f54c1d20fb12a0 (patch) | |
tree | b58f6a31b9d97b4693d485ea1a794fa6b8c5d875 /src/core/api | |
parent | 4dc312011bcaa2ee2cf812b5b84dc9238130e608 (diff) | |
parent | 56fadb571f32b721d8b99554e6e38692009ec37f (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I1dd136df7004b11e2f38a2ec4e82a6fa81627479
Diffstat (limited to 'src/core/api')
-rw-r--r-- | src/core/api/core_api.pro | 2 | ||||
-rw-r--r-- | src/core/api/qwebenginecookiestore.cpp | 2 | ||||
-rw-r--r-- | src/core/api/qwebenginemessagepumpscheduler.cpp | 72 | ||||
-rw-r--r-- | src/core/api/qwebenginemessagepumpscheduler_p.h | 80 | ||||
-rw-r--r-- | src/core/api/qwebengineurlschemehandler.cpp | 2 |
5 files changed, 156 insertions, 2 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index 4d3ddcc8e..326d4481f 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -38,6 +38,7 @@ HEADERS = \ qwebenginecookiestore.h \ qwebenginecookiestore_p.h \ qwebenginehttprequest.h \ + qwebenginemessagepumpscheduler_p.h \ qwebenginenotification.h \ qwebenginequotarequest.h \ qwebengineregisterprotocolhandlerrequest.h \ @@ -53,6 +54,7 @@ SOURCES = \ qwebengineclientcertificatestore.cpp \ qwebenginecookiestore.cpp \ qwebenginehttprequest.cpp \ + qwebenginemessagepumpscheduler.cpp \ qwebenginenotification.cpp \ qwebenginequotarequest.cpp \ qwebengineregisterprotocolhandlerrequest.cpp \ diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index 035c98342..3897fb128 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -382,7 +382,7 @@ void QWebEngineCookieStore::setCookieFilter(std::function<bool(const FilterReque \inmodule QtWebEngineCore \since 5.11 - \brief This struct is used in conjunction with QWebEngineCookieStore::setCookieFilter() and is + \brief The QWebEngineCookieStore::FilterRequest struct is used in conjunction with QWebEngineCookieStore::setCookieFilter() and is the type \a filterCallback operates on. \sa QWebEngineCookieStore::setCookieFilter() diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp new file mode 100644 index 000000000..34cbc49bf --- /dev/null +++ b/src/core/api/qwebenginemessagepumpscheduler.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwebenginemessagepumpscheduler_p.h" + +#include <QAbstractEventDispatcher> +#include <QCoreApplication> +#include <QTimerEvent> + +QWebEngineMessagePumpScheduler::QWebEngineMessagePumpScheduler(std::function<void()> callback) + : m_callback(std::move(callback)) +{} + +void QWebEngineMessagePumpScheduler::scheduleWork() +{ + QCoreApplication::postEvent(this, new QTimerEvent(0)); +} + +void QWebEngineMessagePumpScheduler::scheduleDelayedWork(int delay) +{ + if (delay < 0) { + killTimer(m_timerId); + m_timerId = 0; + } else if (!m_timerId || delay < QAbstractEventDispatcher::instance()->remainingTime(m_timerId)) { + killTimer(m_timerId); + m_timerId = startTimer(delay); + } +} + +void QWebEngineMessagePumpScheduler::timerEvent(QTimerEvent *ev) +{ + Q_ASSERT(!ev->timerId() || m_timerId == ev->timerId()); + killTimer(m_timerId); + m_timerId = 0; + m_callback(); +} diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h new file mode 100644 index 000000000..4c9e4d600 --- /dev/null +++ b/src/core/api/qwebenginemessagepumpscheduler_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWEBENGINEMESSAGEPUMPSCHEDULER_P_H +#define QWEBENGINEMESSAGEPUMPSCHEDULER_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 <QtCore/qobject.h> + +#include <functional> + +QT_BEGIN_NAMESPACE + +class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject +{ + Q_OBJECT +public: + QWebEngineMessagePumpScheduler(std::function<void()> callback); + void scheduleWork(); + void scheduleDelayedWork(int delay); + +protected: + void timerEvent(QTimerEvent *ev) override; + +private: + int m_timerId = 0; + std::function<void()> m_callback; +}; + +QT_END_NAMESPACE + +#endif // !QWEBENGINEMESSAGEPUMPSCHEDULER_P_H diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index 2e93f4b73..aecee5044 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE /*! \class QWebEngineUrlSchemeHandler - \brief The QWebEngineUrlSchemeHandler is a base class for handling custom URL schemes. + \brief The QWebEngineUrlSchemeHandler class is a base class for handling custom URL schemes. \since 5.6 To implement a custom URL scheme for QtWebEngine, you first have to create an instance of |